summaryrefslogtreecommitdiff
path: root/Command/LookupKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-06 13:44:53 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-06 13:44:53 -0400
commit2bbb276e38fb8503daccf7a419336d67c0a23c9c (patch)
treed796474a8b82bc5e79ae99a40ee93fd81cdf83a7 /Command/LookupKey.hs
parent582fa3e2f10f1e1064314a8a1d9bb5aa5cf84f92 (diff)
contentlocation, examinekey, lookupkey: Added --batch mode option.
Diffstat (limited to 'Command/LookupKey.hs')
-rw-r--r--Command/LookupKey.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Command/LookupKey.hs b/Command/LookupKey.hs
index 0485232ae..6e7f07049 100644
--- a/Command/LookupKey.hs
+++ b/Command/LookupKey.hs
@@ -9,18 +9,20 @@ module Command.LookupKey where
import Common.Annex
import Command
+import CmdLine.Batch
import Annex.CatFile
import Types.Key
cmd :: [Command]
-cmd = [notBareRepo $ noCommit $ noMessages $
+cmd = [withOptions [batchOption] $ notBareRepo $ noCommit $ noMessages $
command "lookupkey" (paramRepeating paramFile) seek
SectionPlumbing "looks up key used for file"]
seek :: CommandSeek
-seek = withStrings start
+seek = batchable withStrings start
-start :: String -> CommandStart
-start file = do
- liftIO . maybe exitFailure (putStrLn . key2file) =<< catKeyFile file
+start :: Batchable String
+start batchmode file = do
+ maybe (batchBadInput batchmode) (liftIO . putStrLn . key2file)
+ =<< catKeyFile file
stop