Skip to content

Commit

Permalink
fix(cli): add requiresArg to --edit arg #2065
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Aug 21, 2020
1 parent 59849dc commit 727b5de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions @commitlint/cli/src/cli.test.ts
Expand Up @@ -441,8 +441,8 @@ test('should print help', async () => {
--config, -g path to the config file [string]
--cwd, -d directory to execute in
[string] [default: (Working Directory)]
--edit, -e read last commit message from the specified file or
fallbacks to ./.git/COMMIT_EDITMSG
--edit, -e read last commit message from the specified file or use
'' as fallback to ./.git/COMMIT_EDITMSG
[string] [default: false]
--env, -E check message in the file at path given by environment
variable value [string]
Expand Down
5 changes: 3 additions & 2 deletions @commitlint/cli/src/cli.ts
Expand Up @@ -44,8 +44,9 @@ const cli = yargs
alias: 'e',
default: false,
description:
'read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG',
"read last commit message from the specified file or use '' as fallback to ./.git/COMMIT_EDITMSG",
type: 'string',
requiresArg: true,
},
env: {
alias: 'E',
Expand Down Expand Up @@ -281,7 +282,7 @@ function getEditValue(flags: CliFlags) {
return process.env[flags.env];
}
const {edit} = flags;
// If the edit flag is set but empty (i.e '-e') we default
// If the edit flag is set but empty (i.e "-e ''") we default
// to .git/COMMIT_EDITMSG
if (edit === '') {
return true;
Expand Down

0 comments on commit 727b5de

Please sign in to comment.