-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set exit code depending on what went wrong #66
Conversation
What about:
|
Thanks for the feedback @mondeja 🙂
I'm not sure the distinction between
So, if Additionally, I was actually wondering if we should have just one exit code for when something's wrong related to the configuration - the log output should tell you what exactly went wrong. Even with 2 exit codes related to configuration I wondered if I was being too granular, with 3 even more so, and I'm afraid we could go more granular (maybe after new features are added). What do you think?
This makes some sense to me, but I'm not sure how common and/or useful this is. Do other CLI applications do this? Could you provide some examples? If we want to add this, this snippet can be used as a starting point (ref): process.on('SIGINT', () => {
// Handle `Ctrl`+`C`
});
Can you elaborate? Do you mean that this exit code should be used if, with the provided options, the CLI can't run. If yes, I'm not sure if that's currently applicable 🤔 Where in the code would we exit in this manner? |
Use the "projects" directory to create a broken project with an invalid configuration file.
Invalid could mean that the configuration is invalid for SVGLint, but it's supposed to mean that it's invalid JavaScript. Broken seems clearer while being equally brief.
From the perspective of a writer of scripts, always is easy and convenient to check the exit code rather than outputs to know what is really happening.
I'm thinking in the typical context where an argument is built dinamically with Bash, Shell, Powershell... You don't know if the argument is passed until is executed.
As you prefer, I don't have a strong opinion about it.
See pytest exit codes.
For example, if I pass an argument that do not exist like |
- Combine exit codes related to configuration into one - Add exit code for SIGINT - Define `EXIT_CODES` object for readability and to avoid duplication
That actually makes a lot of sense as a guiding principle, thanks for sharing.
In that case I'm going to simplify it for now and stick with one exit code to represent configuration problems.
Thanks for the example, in that case I'm okay adding it 👍
I see, thanks for elaborating. However, since using non-existent arguments isn't currently a problem I won't change that (at least within the scope of this Pull Request). |
🎉 This PR is included in version 2.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Update the CLI to exit with unique exit codes depending on what went wrong:
0
: Success1
: There are linting errors2
: Something unexpected went wrong3
: Interrupted4
: Configuration-related problemSuggestions are welcome.