Skip to content

Commit

Permalink
fix(command): depends info is not shown in help output
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed May 20, 2020
1 parent 0998f55 commit 0e2e860
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/command/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,16 @@ export class HelpCommand extends BaseCommand implements IHelpCommand {

const getHints = ( option: IFlagOptions ): string => {
const hints = [];
if ( option.required || option.conflicts ) {
option.required && hints.push( yellow( `required` ) );
typeof option.default !== 'undefined' && hints.push( blue( bold( `Default: ` ) ) + blue( format( option.default ) ) );
option.conflicts && hints.push( red( bold( `conflicts: ` ) ) + option.conflicts.map( conflict => red( conflict ) ).join( ', ' ) );
}

option.required && hints.push( yellow( `required` ) );
typeof option.default !== 'undefined' && hints.push( blue( bold( `Default: ` ) ) + blue( format( option.default ) ) );
option.depends && option.depends.length && hints.push( red( bold( `depends: ` ) ) + option.depends.map( depends => red( depends ) ).join( ', ' ) );
option.conflicts && option.conflicts.length && hints.push( red( bold( `conflicts: ` ) ) + option.conflicts.map( conflict => red( conflict ) ).join( ', ' ) );

if ( hints.length ) {
return `(${ hints.join( ', ' ) })`;
}

return '';
};

Expand Down

0 comments on commit 0e2e860

Please sign in to comment.