代码拉取完成,页面将自动刷新
#!/usr/bin/env node
function urlOf(name, is_org=false) {
var url = "https://gitee.com/api/v5" + (is_org ? "/orgs/"+name : "/user")
return url
}
function getEnvOf(name) {
return process.env[name]
}
function getAccessToken() {
return getEnvOf('gitee_token')
}
function jsonOfResponse(response, callback) {
let dt = ''
// read data buffer with Buffer type
// var buff = new Buffer(parseInt(size))
// var offset = 0
response.on("data", (data) => {
dt += data
}).on('end', () => {
var json = JSON.parse(dt)
callback(json)
})
}
function config(argv) {
let offset = 2
var name, owner;
switch(argv.length) {
case 1 + offset:
console.log("name: " + argv[0 + offset])
name = argv[0 + offset]
return { type:"user", name: name }
case 2 + offset:
console.log("owner: "+ argv[0 + offset] + ", name: " + argv[1 + offset])
name = argv[0 + offset]
owner = argv[1 + offset]
return { type:"orgs", owner: owner, name: name }
default:
console.log("Usage:")
console.log("\tsub-command ")
console.log("\tsub-command projectName")
console.log("\tsub-command owner projectName")
return { type:"unknown" }
}
}
exports.config = config(process.argv)
exports.getAccessToken = getAccessToken
exports.jsonOfResponse = jsonOfResponse
exports.getEnvOf = getEnvOf
exports.urlOf = urlOf
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。