mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-22 10:45:56 +02:00
Add more config help
This commit is contained in:
parent
13e48d46bf
commit
0f022b8068
1 changed files with 34 additions and 30 deletions
36
oputil.js
36
oputil.js
|
@ -47,22 +47,17 @@ valid args:
|
||||||
--user USERNAME : specify username
|
--user USERNAME : specify username
|
||||||
-- password PASS : specify password (to reset)
|
-- password PASS : specify password (to reset)
|
||||||
`,
|
`,
|
||||||
|
|
||||||
|
Config :
|
||||||
|
`usage: optutil.js config <args>
|
||||||
|
|
||||||
|
valid args:
|
||||||
|
--new : generate a new/initial configuration
|
||||||
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
function printUsage(command) {
|
function printUsage(command) {
|
||||||
let usage;
|
console.error(USAGE_HELP[command]);
|
||||||
|
|
||||||
switch(command) {
|
|
||||||
case '' :
|
|
||||||
usage = USAGE_HELP.General;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'user' :
|
|
||||||
usage = USAGE_HELP.User;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.error(usage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initConfig(cb) {
|
function initConfig(cb) {
|
||||||
|
@ -74,7 +69,7 @@ function initConfig(cb) {
|
||||||
function handleUserCommand() {
|
function handleUserCommand() {
|
||||||
if(true === argv.help || !_.isString(argv.user) || 0 === argv.user.length) {
|
if(true === argv.help || !_.isString(argv.user) || 0 === argv.user.length) {
|
||||||
process.exitCode = ExitCodes.ERROR;
|
process.exitCode = ExitCodes.ERROR;
|
||||||
return printUsage('user');
|
return printUsage('User');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_.isString(argv.password)) {
|
if(_.isString(argv.password)) {
|
||||||
|
@ -342,6 +337,12 @@ function askQuestions(cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleConfigCommand() {
|
function handleConfigCommand() {
|
||||||
|
if(true === argv.help) {
|
||||||
|
process.exitCode = ExitCodes.ERROR;
|
||||||
|
return printUsage('Config');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(argv.new) {
|
||||||
askQuestions( (err, configPath, config) => {
|
askQuestions( (err, configPath, config) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return;
|
return;
|
||||||
|
@ -356,7 +357,10 @@ function handleConfigCommand() {
|
||||||
console.error('Exception attempting to create config: ' + e.toString());
|
console.error('Exception attempting to create config: ' + e.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
process.exitCode = ExitCodes.ERROR;
|
||||||
|
return printUsage('Config');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
@ -370,7 +374,7 @@ function main() {
|
||||||
if(0 === argv._.length ||
|
if(0 === argv._.length ||
|
||||||
'help' === argv._[0])
|
'help' === argv._[0])
|
||||||
{
|
{
|
||||||
printUsage('');
|
printUsage('General');
|
||||||
process.exit(ExitCodes.SUCCESS);
|
process.exit(ExitCodes.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue