geut / chan

A Changelog CLI based on http://keepachangelog.com/
ISC License
87 stars 10 forks source link

Allow for non-zero exit code #66

Closed bianchidotdev closed 2 years ago

bianchidotdev commented 3 years ago

Hello! I appreciate the work you've put into this tool. It's very straightforward to use and much less opinionated and forceful than other tools I've found.

I have a request for a feature though, which is allowing for chan returning a non-zero exit code if it runs into an error.

Current Behavior

 λ chan release 0.1.3
[chan] [release] › ✖  error     There are not new changes to release.
 λ echo $?
0

Desired behavior

 λ chan release 0.1.3
[chan] [release] › ✖  error     There are not new changes to release.
 λ echo $?
1 # or other exit code

This is primarily for use in scripting/CI where I want to not continue if there was an error in running chan.

I do not use js typically, but I might be willing to attempt a PR if you'd like.

dpaez commented 3 years ago

Hi @michaeldbianchi 👋

This is a valid and good feature in my opinion. Right now we are just logging the error but we can do more and add the exit code as you mention.

If you feel motivated, a PR is welcomed. I think, from a quick look, that adding the right process.exit(code) to the different commands can be a good start.

tinchoz49 commented 2 years ago

Thank you for report this @michaeldbianchi. In the latest version a command with error messages ends with exitCode 1.