convert all commands to work with optparse-applicative

Still no options though.
This commit is contained in:
Joey Hess 2015-07-08 15:08:02 -04:00
parent 3125da54f6
commit 6e5c1f8db3
99 changed files with 391 additions and 297 deletions

View file

@ -7,7 +7,6 @@
module Command (
command,
commandParser,
noRepo,
noCommit,
noMessages,
@ -33,20 +32,11 @@ import CmdLine.Action as ReExported
import CmdLine.Option as ReExported
import CmdLine.GitAnnex.Options as ReExported
import qualified Options.Applicative as O
{- Generates a normal Command -}
command :: String -> String -> CommandSection -> String -> (Command -> CommandParser) -> Command
command name paramdesc section desc parser = c
where
c = Command [] Nothing commonChecks False False name paramdesc section desc (parser c)
{- Simple CommandParser generator, for when the CommandSeek wants all
- non-option parameters. -}
commandParser :: (CmdParams -> CommandSeek) -> Command -> CommandParser
commandParser mkseek c = mkseek <$> O.many cmdparams
where
cmdparams = O.argument O.str (O.metavar (cmdparamdesc c))
command :: String -> CommandSection -> String -> String -> (String -> CommandParser) -> Command
command name section desc paramdesc mkparser =
Command [] Nothing commonChecks False False name paramdesc
section desc (mkparser paramdesc)
{- Indicates that a command doesn't need to commit any changes to
- the git-annex branch. -}