aboutsummaryrefslogtreecommitdiff
path: root/CmdLine/Batch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 17:46:46 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 17:48:42 -0400
commit90b1891e1e2be29ae122a2613a462959f3c32611 (patch)
tree306af03e34b7d219d178a3f0d16975b8de5ca58a /CmdLine/Batch.hs
parent8d1ac05755f970f0ec9553c9a7680a5512726c28 (diff)
add --batch
Diffstat (limited to 'CmdLine/Batch.hs')
-rw-r--r--CmdLine/Batch.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/CmdLine/Batch.hs b/CmdLine/Batch.hs
index d8d210de4..e7706881a 100644
--- a/CmdLine/Batch.hs
+++ b/CmdLine/Batch.hs
@@ -54,3 +54,14 @@ batchInput parser a = do
batchInput parser a
where
parseerr s = error $ "Batch input parse failure: " ++ s
+
+-- Runs a CommandStart in batch mode.
+--
+-- The batch mode user expects to read a line of output, and it's up to the
+-- CommandStart to generate that output as it succeeds or fails to do its
+-- job. However, if it stops without doing anything, it won't generate
+-- any output, so in that case, batchBadInput is used to provide the caller
+-- with an empty line.
+batchCommandAction :: CommandStart -> Annex ()
+batchCommandAction a = maybe (batchBadInput Batch) (const noop)
+ =<< callCommandAction' a