Skip to content

Commit

Permalink
feat: add support for version -v alias (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns authored Aug 27, 2021
1 parent af43a7d commit 2e9919d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ asyncapi [options] [command]
OPTIONS
-h, --help display help for command
--version output the version number
-v, --version output the version number
COMMANDS
Expand Down
3 changes: 3 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const cli = meow({
},
help: {
alias: 'h'
},
version: {
alias: 'v'
}
}
});
Expand Down
7 changes: 1 addition & 6 deletions src/help-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class HelpMessage {

readonly flags = [
this.helpFlag,
'--version, output version string'
'-v, --version output version number'
];

readonly commands: Command = {
Expand Down Expand Up @@ -83,11 +83,6 @@ export class HelpMessageBuilder {
const [alias, ...rest] = flag.split(',');
const flg = rest[0]?.split(' ')[1];
const msg = rest[0]?.split(' ').splice(2, rest[0].length).join(' ');
if (alias === '--version') {
return <Text key={flag}>
<Text color="yellowBright">{alias}</Text> {rest}
</Text>;
}
return <Text key={flag}>
<Text color="yellowBright" bold>{alias}</Text>,<Text color='yellowBright'>{flg}</Text> {msg}
</Text>;
Expand Down

0 comments on commit 2e9919d

Please sign in to comment.