27 lines
1.0 KiB
Diff
27 lines
1.0 KiB
Diff
Adapted from: https://github.com/commercialhaskell/stack/commit/4afcf774d2a821e69b6a1afca67bf34341c84e85
|
|
|
|
--- a/src/Options/Applicative/Complicated.hs
|
|
+++ b/src/Options/Applicative/Complicated.hs
|
|
@@ -136,20 +136,9 @@ complicatedParser commandMetavar commonP
|
|
(,) <$>
|
|
commonParser <*>
|
|
case runWriter (runExceptT commandParser) of
|
|
- (Right (),d) -> hsubparser' commandMetavar d
|
|
+ (Right (), m) -> hsubparser (m <> metavar commandMetavar)
|
|
(Left b,_) -> pure (b,mempty)
|
|
|
|
--- | Subparser with @--help@ argument. Borrowed with slight modification
|
|
--- from Options.Applicative.Extra.
|
|
-hsubparser' :: String -> Mod CommandFields a -> Parser a
|
|
-hsubparser' commandMetavar m = mkParser d g rdr
|
|
- where
|
|
- Mod _ d g = metavar commandMetavar `mappend` m
|
|
- (groupName, cmds, subs) = mkCommand m
|
|
- rdr = CmdReader groupName cmds (fmap add_helper . subs)
|
|
- add_helper pinfo = pinfo
|
|
- { infoParser = infoParser pinfo <**> helpOption }
|
|
-
|
|
-- | Non-hidden help option.
|
|
helpOption :: Parser (a -> a)
|
|
helpOption =
|