Help option fixes
This commit is contained in:
parent
d7fd7546bb
commit
19e72112ea
28
myvc.js
28
myvc.js
|
@ -78,6 +78,8 @@ class MyVC {
|
||||||
}
|
}
|
||||||
|
|
||||||
const allOpts = Object.assign({}, baseOpts);
|
const allOpts = Object.assign({}, baseOpts);
|
||||||
|
|
||||||
|
if (command.localOpts)
|
||||||
for (const key in command.localOpts) {
|
for (const key in command.localOpts) {
|
||||||
const baseValue = baseOpts[key];
|
const baseValue = baseOpts[key];
|
||||||
const cmdValue = command.localOpts[key];
|
const cmdValue = command.localOpts[key];
|
||||||
|
@ -388,21 +390,19 @@ class MyVC {
|
||||||
if (usage.description)
|
if (usage.description)
|
||||||
console.log(`${'Description:'.gray} ${usage.description}`);
|
console.log(`${'Description:'.gray} ${usage.description}`);
|
||||||
|
|
||||||
if (opts) {
|
if (opts && opts.alias) {
|
||||||
console.log('Options:'.gray);
|
const alias = opts.alias;
|
||||||
this.printOpts(opts, usage, 'alias');
|
const boolean = opts.boolean || [];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printOpts(opts, usage, group) {
|
console.log('Options:'.gray);
|
||||||
const optGroup = opts[group];
|
for (const opt in alias) {
|
||||||
if (optGroup)
|
const paramDescription = usage.params[opt] || '';
|
||||||
for (const opt in optGroup) {
|
let longOpt = opt;
|
||||||
const paramDescription = usage.params[opt] || '';
|
if (boolean.indexOf(longOpt) === -1)
|
||||||
let longOpt = opt;
|
longOpt += ` <string>`;
|
||||||
if (group !== 'boolean') longOpt += ` <string>`;
|
longOpt = camelToSnake(longOpt).padEnd(22, ' ')
|
||||||
longOpt = camelToSnake(longOpt).padEnd(22, ' ')
|
console.log(` -${alias[opt]}, --${longOpt} ${paramDescription}`);
|
||||||
console.log(` -${optGroup[opt]}, --${longOpt} ${paramDescription}`);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "myvc",
|
"name": "myvc",
|
||||||
"version": "1.3.10",
|
"version": "1.3.11",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "MySQL Version Control",
|
"description": "MySQL Version Control",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
"type": "git"
|
"type": "git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"myvc": "^1.3.10"
|
"myvc": "^1.3.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue