Skip to content

Commit c99a821

Browse files
authored
Merge pull request #5786 from mpilgrem/fix809
Fix #809 Use `showHelpOnEmpty`
2 parents e14a2b7 + 49bf07c commit c99a821

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Other enhancements:
2929
comment in `Script.hs` on the command line. That may help test that scripts
3030
compile in CI (continuous integration). See
3131
[#5755](https://github.com/commercialhaskell/stack/issues/5755)
32+
* Fuller help is provided at the command line if a subcommand is missing (for
33+
example, `stack ls` now yields the equivalent of `stack ls --help`). See
34+
[#809](https://github.com/commercialhaskell/stack/issues/809)
3235

3336
Bug fixes:
3437

src/Options/Applicative/Complicated.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ complicatedOptions
4848
-> IO (a,b)
4949
complicatedOptions numericVersion stringVersion numericHpackVersion h pd footerStr commonParser mOnFailure commandParser =
5050
do args <- getArgs
51-
(a,(b,c)) <- case execParserPure (prefs noBacktrack) parser args of
52-
Failure _ | null args -> withArgs ["--help"] (execParser parser)
51+
(a,(b,c)) <- let parserPrefs = prefs $ noBacktrack <> showHelpOnEmpty
52+
in case execParserPure parserPrefs parser args of
5353
-- call onFailure handler if it's present and parsing options failed
5454
Failure f | Just onFailure <- mOnFailure -> onFailure f args
5555
parseResult -> handleParseResult parseResult

0 commit comments

Comments
 (0)