Поправки вывода консоль текста помощи
This commit is contained in:
@@ -16,15 +16,15 @@ let argv;
|
|||||||
let branch = '';
|
let branch = '';
|
||||||
const argvStrings = ['host', 'port', 'app-dir', 'lib-dir', 'inpx'];
|
const argvStrings = ['host', 'port', 'app-dir', 'lib-dir', 'inpx'];
|
||||||
|
|
||||||
function showHelp() {
|
function showHelp(defaultConfig) {
|
||||||
console.log(utils.versionText(config));
|
console.log(utils.versionText(config));
|
||||||
console.log(
|
console.log(
|
||||||
`Usage: ${config.name} [options]
|
`Usage: ${config.name} [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--help Print ${config.name} command line options
|
--help Print ${config.name} command line options
|
||||||
--host=<ip> Set web server host, default: 0.0.0.0
|
--host=<ip> Set web server host, default: ${defaultConfig.server.host}
|
||||||
--port=<port> Set web server port, default: 22380
|
--port=<port> Set web server port, default: ${defaultConfig.server.port}
|
||||||
--app-dir=<dirpath> Set application working directory, default: <execDir>/.${config.name}
|
--app-dir=<dirpath> Set application working directory, default: <execDir>/.${config.name}
|
||||||
--lib-dir=<dirpath> Set library directory, default: the same as ${config.name} executable's
|
--lib-dir=<dirpath> Set library directory, default: the same as ${config.name} executable's
|
||||||
--inpx=<filepath> Set INPX collection file, default: the one that found in library dir
|
--inpx=<filepath> Set INPX collection file, default: the one that found in library dir
|
||||||
@@ -40,6 +40,8 @@ async function init() {
|
|||||||
//config
|
//config
|
||||||
const configManager = new (require('./config'))();//singleton
|
const configManager = new (require('./config'))();//singleton
|
||||||
await configManager.init(dataDir);
|
await configManager.init(dataDir);
|
||||||
|
const defaultConfig = configManager.config;
|
||||||
|
|
||||||
await configManager.load();
|
await configManager.load();
|
||||||
config = configManager.config;
|
config = configManager.config;
|
||||||
branch = config.branch;
|
branch = config.branch;
|
||||||
@@ -61,7 +63,7 @@ async function init() {
|
|||||||
|
|
||||||
//cli
|
//cli
|
||||||
if (argv.help) {
|
if (argv.help) {
|
||||||
showHelp();
|
showHelp(defaultConfig);
|
||||||
ayncExit.exit(0);
|
ayncExit.exit(0);
|
||||||
} else {
|
} else {
|
||||||
log(utils.versionText(config));
|
log(utils.versionText(config));
|
||||||
|
|||||||
Reference in New Issue
Block a user