add new commander

master
cyl19970726 2 years ago
parent 3355ed7abb
commit 705e04bbb5

@ -61,7 +61,7 @@ export const HubMemberActions = [
name: 'role',
message: 'add contributor or manager into hub',
choices: [
'contribotor',
'contributor',
'manager',
],
},
@ -74,7 +74,7 @@ export const HubGetMemberActions = [
message: 'get members corresponding to the role',
choices: [
'admin',
'contribotor',
'contributor',
'manager',
],
},

@ -242,14 +242,18 @@ hub
let protocol = await parseGit3URI(hub, { ignoreProtocolHeader: true, skipRepoName: true })
let answers = await inquirer.prompt(HubGetMemberActions)
let role:string = "0x0000000000000000000000000000000000000000000000000000000000000000";
switch (answers.role) {
case "admin":
role = "0x0000000000000000000000000000000000000000000000000000000000000000"
case "manager":
role = "0x0000000000000000000000000000000000000000000000000000000000000001"
case "contributor":
role = "0x0000000000000000000000000000000000000000000000000000000000000002"
if (answers.role == "admin") {
role = "0x0000000000000000000000000000000000000000000000000000000000000000"
}else if (answers.role == "manager") {
role = "0x0000000000000000000000000000000000000000000000000000000000000001"
}else if (answers.role == "contributor") {
role = "0x0000000000000000000000000000000000000000000000000000000000000002"
}else {
throw new Error(`Invalid role ${answers.role}`)
}
console.error(`role:${role}`)
let members = await protocol.hub.getMembersByRole(role)
console.error(`${answers.role} : ${members}`)
@ -388,6 +392,16 @@ hub
// =============================Repo Commands===================================
repo
.command("list")
.argument("<hub>", "hub_name.NS or hub_address:chain_id")
.description("get all members from hub")
.action(async (hub) => {
let protocol = await parseGit3URI(hub, { ignoreProtocolHeader: true, skipRepoName: true })
let repos = await protocol.hub.repoList()
console.error(`repos : ${repos}`)
})
repo
.command("create")
.argument("<uri>", "ex: git3.w3q/repo_name or hub_addr:chainid/repo_name")

Loading…
Cancel
Save