Skip to content

Commit

Permalink
fix: change exit code if an error occurred
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed Oct 16, 2020
1 parent acd5288 commit e97b234
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/bin.ts
Expand Up @@ -30,19 +30,23 @@ Examples
`)
}

if (arg === 'add') {
add({
cwd: process.cwd(),
hookName: params[0],
cmd: params[1],
})
} else if (arg === 'install') {
install({
cwd: process.cwd(),
dir: params[0],
})
} else if (['--version', '-v'].includes(arg)) {
version()
} else {
help()
try {
if (arg === 'add') {
add({
cwd: process.cwd(),
hookName: params[0],
cmd: params[1],
})
} else if (arg === 'install') {
install({
cwd: process.cwd(),
dir: params[0],
})
} else if (['--version', '-v'].includes(arg)) {
version()
} else {
help()
}
} catch {
process.exitCode = 1;
}

0 comments on commit e97b234

Please sign in to comment.