Fix config --new
This commit is contained in:
parent
985d239ab9
commit
07ed70a5d0
17
oputil.js
17
oputil.js
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/* jslint node: true */
|
||||
/* eslint-disable no-console */
|
||||
'use strict';
|
||||
|
||||
// ENiGMA½
|
||||
|
@ -18,14 +19,14 @@ const fs = require('fs');
|
|||
const hjson = require('hjson');
|
||||
const paths = require('path');
|
||||
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
const ExitCodes = {
|
||||
SUCCESS : 0,
|
||||
ERROR : -1,
|
||||
BAD_COMMAND : -2,
|
||||
BAD_ARGS : -3,
|
||||
}
|
||||
};
|
||||
|
||||
const USAGE_HELP = {
|
||||
General :
|
||||
|
@ -45,7 +46,7 @@ commands:
|
|||
|
||||
valid args:
|
||||
--user USERNAME : specify username
|
||||
-- password PASS : specify password (to reset)
|
||||
--password PASS : specify password (to reset)
|
||||
`,
|
||||
|
||||
Config :
|
||||
|
@ -54,7 +55,7 @@ valid args:
|
|||
valid args:
|
||||
--new : generate a new/initial configuration
|
||||
`
|
||||
}
|
||||
};
|
||||
|
||||
function printUsage(command) {
|
||||
console.error(USAGE_HELP[command]);
|
||||
|
@ -127,7 +128,9 @@ function handleUserCommand() {
|
|||
}
|
||||
|
||||
function getAnswers(questions, cb) {
|
||||
inq.prompt(questions, cb);
|
||||
inq.prompt(questions).then( answers => {
|
||||
return cb(answers);
|
||||
});
|
||||
}
|
||||
|
||||
function getDefaultConfigPath() {
|
||||
|
@ -212,7 +215,7 @@ function makeMsgConfAreaName(s) {
|
|||
return s.toLowerCase().replace(/\s+/g, '_');
|
||||
}
|
||||
|
||||
function askQuestions(cb) {
|
||||
function askNewConfigQuestions(cb) {
|
||||
|
||||
const ui = new inq.ui.BottomBar();
|
||||
|
||||
|
@ -343,7 +346,7 @@ function handleConfigCommand() {
|
|||
}
|
||||
|
||||
if(argv.new) {
|
||||
askQuestions( (err, configPath, config) => {
|
||||
askNewConfigQuestions( (err, configPath, config) => {
|
||||
if(err) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue