-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only look for help and version flags in the first argument
" mow.cli" used to search for -h, --help, -v, --version, ... shortcuts in all the arguments. This causes an issue with `--` (all what follows is an arg), e.g.: ``` app -- -h ``` Would still display the app help instead of treating `-h` as the argument it is. Also, this PR changes how the library handles encountering help and version flags. Instead of calling os.exit, the value of `errorHandling` is now used to decide. If it is `ContinueOnError`, than exit is not called and an nil error is returned from `app.Run`. The old behaviour is still available with `ExitOnError`. Fixes #41
- Loading branch information
Showing
4 changed files
with
120 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cli | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ( | ||
errHelpRequested = errors.New("Help requested") | ||
errVersionRequested = errors.New("Version requested") | ||
) |