converted fsck's options to optparse-applicative

Global options and seeking and key options are still to be done.
This commit is contained in:
Joey Hess 2015-07-08 16:58:54 -04:00
parent b59b8be737
commit 6a88c7c101
4 changed files with 72 additions and 45 deletions

View file

@ -75,8 +75,13 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
parseCmd :: CmdParams -> [Command] -> (Command -> O.Parser v) -> O.ParserResult (Command, v)
parseCmd allargs allcmds getparser = O.execParserPure (O.prefs O.idm) pinfo allargs
where
pinfo = O.info (O.subparser $ mconcat $ map mkcommand allcmds) O.idm
mkcommand c = O.command (cmdname c) (O.info (mkparser c) O.idm)
pinfo = O.info (O.subparser $ mconcat $ map mkcommand allcmds)
( O.fullDesc
<> O.progDesc "hiya"
<> O.header "ook - aaa"
)
mkcommand c = O.command (cmdname c) $ O.info (mkparser c)
(O.fullDesc <> O.progDesc (cmddesc c))
mkparser c = (,)
<$> pure c
<*> getparser c