aboutsummaryrefslogtreecommitdiff
path: root/Command/LookupKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-11 20:43:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-11 20:43:45 -0400
commitd49e9f6a744c490cf4374039fde26c0eb57dc675 (patch)
tree8309f1255db293d410145573c0cd831015d6629c /Command/LookupKey.hs
parentdb0fd46eddd191632d849f425f5db5ab3eed3905 (diff)
converted ContentLocation, ExampleKey, LookupKey
Diffstat (limited to 'Command/LookupKey.hs')
-rw-r--r--Command/LookupKey.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/Command/LookupKey.hs b/Command/LookupKey.hs
index 021dc963b..54023eab7 100644
--- a/Command/LookupKey.hs
+++ b/Command/LookupKey.hs
@@ -14,16 +14,17 @@ import Annex.CatFile
import Types.Key
cmd :: Command
-cmd = withOptions [batchOption] $ notBareRepo $ noCommit $ noMessages $
+cmd = notBareRepo $ noCommit $ noMessages $
command "lookupkey" SectionPlumbing
"looks up key used for file"
- (paramRepeating paramFile) (withParams seek)
+ (paramRepeating paramFile)
+ (batchable run (pure ()))
-seek :: CmdParams -> CommandSeek
-seek = batchable withStrings start
-
-start :: Batchable String
-start batchmode file = do
- maybe (batchBadInput batchmode) (liftIO . putStrLn . key2file)
- =<< catKeyFile file
- stop
+run :: () -> String -> Annex Bool
+run _ file = do
+ mk <- catKeyFile file
+ case mk of
+ Just k -> do
+ liftIO $ putStrLn $ key2file k
+ return True
+ Nothing -> return False