aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Command.hs b/Command.hs
index e3508d68c..df72ad2a7 100644
--- a/Command.hs
+++ b/Command.hs
@@ -8,6 +8,7 @@
module Command (
command,
withParams,
+ (<--<),
noRepo,
noCommit,
noMessages,
@@ -46,6 +47,17 @@ command name section desc paramdesc mkparser =
withParams :: (CmdParams -> v) -> CmdParamsDesc -> O.Parser v
withParams mkseek paramdesc = mkseek <$> cmdParams paramdesc
+{- Uses the supplied option parser, which yields a deferred parse,
+ - and calls finishParse on the result before passing it to the
+ - CommandSeek constructor. -}
+(<--<) :: DeferredParseClass a
+ => (a -> CommandSeek)
+ -> (CmdParamsDesc -> Parser a)
+ -> CmdParamsDesc
+ -> Parser CommandSeek
+(<--<) mkseek optparser paramsdesc =
+ (mkseek <=< finishParse) <$> optparser paramsdesc
+
{- Indicates that a command doesn't need to commit any changes to
- the git-annex branch. -}
noCommit :: Command -> Command