summaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Command.hs b/Command.hs
index 35034a494..6522924c3 100644
--- a/Command.hs
+++ b/Command.hs
@@ -7,6 +7,7 @@
module Command (
command,
+ commandParser,
noRepo,
noCommit,
noMessages,
@@ -32,10 +33,17 @@ import CmdLine.Action as ReExported
import CmdLine.Option as ReExported
import CmdLine.GitAnnex.Options as ReExported
-{- Generates a normal command -}
-command :: String -> String -> CommandSeek -> CommandSection -> String -> Command
+import qualified Options.Applicative as O
+
+{- Generates a normal Command -}
+command :: String -> String -> CommandSection -> String -> CommandParser -> Command
command = Command [] Nothing commonChecks False False
+{- Simple CommandParser generator, for when the CommandSeek wants all
+ - non-option parameters. -}
+commandParser :: (CmdParams -> CommandSeek) -> CommandParser
+commandParser mkseek = mkseek <$> O.many (O.argument O.str O.idm)
+
{- Indicates that a command doesn't need to commit any changes to
- the git-annex branch. -}
noCommit :: Command -> Command