-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Flag errors are not ExitCoder
#1088
Comments
Makes sense! I would be happy to review a PR from anyone that fixes this 🙏 |
Would you prefer it to be a global setting for the whole App or Command or one specific to a flag? |
I'm not quite sure I'm understanding where a setting is coming into play here? I think my expectation is that the existing required flags error satisfies that |
Yes but what should that exit code be? Should it be static and unchanging? I think that it should be able to be set by users of this library. |
Ah, gotcha! I'm of the opinion that we should either:
I'd be interested in more opinions from @urfave/cli though! |
I think returning an Another option (I like this one because it is the most customization while still having a fast path for global setting):
|
Though, now that I have looked more deeply at the code, there is a slight problem with having the flags define their own exit codes. What happens if multiple flags produce errors (currently only required).
I have looked at some what other programs do (such as posix |
Nice investigative work ✨ |
This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else. |
bump |
This issue or PR has been bumped and is no longer marked as stale! Feel free to bump it again in the future, if it's still relevant. |
This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else. |
Closing this as it has become stale. |
This issue or PR has been bumped and is no longer marked as stale! Feel free to bump it again in the future, if it's still relevant. |
ExitCoder
ExitCoder
@urfave/admins Any thoughts on this ? |
This should be fixed as part of #1662 |
my urfave/cli version is
v2.2.0
Checklist
Dependency Management
Describe the bug
If you mark a flag as "required" for instance and it is missing, then the error that is bubbled up to the root
cli.App.Run(..)
call does not satisfy the required interfaces forHandleExitCoder
.To reproduce
HandleExitCoder
Observed behavior
The panic is called
Expected behavior
HandleExitCoder calls
os.Exit(..)
Additional context
It should be possible to define the exit code for a specific flag (or for the application in general) if there are flag errors. Be them required, or not defined as a flag.
The text was updated successfully, but these errors were encountered: