Help option fixes

This commit is contained in:
Juan Ferrer 2022-04-04 21:14:04 +02:00
parent d7fd7546bb
commit 19e72112ea
3 changed files with 16 additions and 16 deletions

22
myvc.js
View File

@ -78,6 +78,8 @@ class MyVC {
}
const allOpts = Object.assign({}, baseOpts);
if (command.localOpts)
for (const key in command.localOpts) {
const baseValue = baseOpts[key];
const cmdValue = command.localOpts[key];
@ -388,21 +390,19 @@ class MyVC {
if (usage.description)
console.log(`${'Description:'.gray} ${usage.description}`);
if (opts) {
console.log('Options:'.gray);
this.printOpts(opts, usage, 'alias');
}
}
if (opts && opts.alias) {
const alias = opts.alias;
const boolean = opts.boolean || [];
printOpts(opts, usage, group) {
const optGroup = opts[group];
if (optGroup)
for (const opt in optGroup) {
console.log('Options:'.gray);
for (const opt in alias) {
const paramDescription = usage.params[opt] || '';
let longOpt = opt;
if (group !== 'boolean') longOpt += ` <string>`;
if (boolean.indexOf(longOpt) === -1)
longOpt += ` <string>`;
longOpt = camelToSnake(longOpt).padEnd(22, ' ')
console.log(` -${optGroup[opt]}, --${longOpt} ${paramDescription}`);
console.log(` -${alias[opt]}, --${longOpt} ${paramDescription}`);
}
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "myvc",
"version": "1.3.10",
"version": "1.3.11",
"author": "Verdnatura Levante SL",
"description": "MySQL Version Control",
"license": "GPL-3.0",

View File

@ -8,6 +8,6 @@
"type": "git"
},
"dependencies": {
"myvc": "^1.3.10"
"myvc": "^1.3.11"
}
}