summaryrefslogtreecommitdiff
path: root/CmdLine/Batch.hs
diff options
context:
space:
mode:
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