fix CLI management
This commit is contained in:
@@ -22,16 +22,18 @@ require('yargs')
|
||||
.option('config', {
|
||||
alias: 'c',
|
||||
describe: 'Configuration file',
|
||||
default: path.resolve(process.env.cwd, 'config.json')
|
||||
})
|
||||
.coerce('config', config_path => {
|
||||
const absolute_config_path = path.resolve(process.env.cwd, config_path)
|
||||
process.env.config_path = absolute_config_path
|
||||
return absolute_config_path
|
||||
})
|
||||
.command(['accounts'], 'Manage accounts', accountsCLI)
|
||||
default: path.resolve(process.env.cwd, 'config.json'),
|
||||
coerce: config_path => {
|
||||
const absolute_config_path = path.resolve(process.env.cwd, config_path)
|
||||
process.env.config_path = absolute_config_path
|
||||
return absolute_config_path
|
||||
}})
|
||||
.command(['start', 'run', '$0'], 'Start gancio', {}, start)
|
||||
.command(['accounts'], 'Manage accounts', accountsCLI)
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.epilog('Made with ❤ by underscore hacklab - https://gancio.org')
|
||||
.recommendCommands()
|
||||
.strict()
|
||||
.demandCommand(1, '')
|
||||
.argv
|
||||
|
||||
@@ -38,8 +38,7 @@ async function list () {
|
||||
console.log()
|
||||
}
|
||||
|
||||
const accountsCLI = yargs => {
|
||||
return yargs
|
||||
const accountsCLI = yargs => yargs
|
||||
.command('list', 'List all accounts', list)
|
||||
.command('modify', 'Modify', {
|
||||
account: {
|
||||
@@ -48,7 +47,7 @@ const accountsCLI = yargs => {
|
||||
demandOption: true
|
||||
},
|
||||
'reset-password': {
|
||||
describe: 'Resets the password of the given accoun ',
|
||||
describe: 'Resets the password of the given account ',
|
||||
type: 'boolean'
|
||||
}
|
||||
}, modify)
|
||||
@@ -56,6 +55,6 @@ const accountsCLI = yargs => {
|
||||
.recommendCommands()
|
||||
.strict()
|
||||
.demandCommand(1, '')
|
||||
}
|
||||
.argv
|
||||
|
||||
module.exports = accountsCLI
|
||||
module.exports = accountsCLI
|
||||
Reference in New Issue
Block a user