aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 16:05:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 16:05:45 -0400
commit525e04af35bb588b4f8a8721cfa77b2b285ac914 (patch)
tree9d00a7d7066a8ad30c9e6313706d47de2609f82a /Command.hs
parent87896574f32be5aa1636facc494faeab34cd0845 (diff)
wip
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