Skip to content

Commit

Permalink
fix: help option conflict with common-bin and yargs
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Oct 19, 2020
1 parent a48b5e3 commit 1f401c0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ export class SurgioCommand extends Command {
updateNotifier({ pkg: require('../package.json') }).notify();

this.usage = '使用方法: surgio <command> [options]';
this.yargs.option('V', {
alias: 'verbose',
demandOption: false,
describe: '打印调试日志',
type: 'boolean',
});

this.load(path.join(__dirname, './command'));

this.options = {
V: {
alias: 'verbose',
demandOption: false,
describe: '打印调试日志',
type: 'boolean',
},
};
// 禁用 yargs 内部生成的 help 信息,似乎和 common-bin 的 load 有冲突
this.yargs.help(false);

// istanbul ignore next
if (this.yargs.argv.verbose) {
transports.console.level = 'debug';
Expand Down

0 comments on commit 1f401c0

Please sign in to comment.