summaryrefslogtreecommitdiff
path: root/Command/Get.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-02 19:04:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-02 19:04:24 -0400
commit0eae5b806c76b0fa3e21fbae6e5f2d9a39a04cce (patch)
tree53aada39ec10bc6217507bce1a9add3b86b3793b /Command/Get.hs
parent606ed6bb3566fa86c1783e3f1c7d799a6f1be8d1 (diff)
broke subcommands out into separate modules
Diffstat (limited to 'Command/Get.hs')
-rw-r--r--Command/Get.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Command/Get.hs b/Command/Get.hs
new file mode 100644
index 000000000..1433bc8d0
--- /dev/null
+++ b/Command/Get.hs
@@ -0,0 +1,31 @@
+{- git-annex command
+ -
+ - Copyright 2010 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Command.Get where
+
+import Command
+import qualified Backend
+import Types
+import Core
+
+{- Gets an annexed file from one of the backends. -}
+start :: SubCmdStartString
+start file = isAnnexed file $ \(key, backend) -> do
+ inannex <- inAnnex key
+ if (inannex)
+ then return Nothing
+ else do
+ showStart "get" file
+ return $ Just $ perform key backend
+
+perform :: Key -> Backend -> SubCmdPerform
+perform key backend = do
+ ok <- getViaTmp key (Backend.retrieveKeyFile backend key)
+ if (ok)
+ then return $ Just $ return True -- no cleanup needed
+ else return Nothing
+