diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-31 12:47:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-31 12:56:07 -0400 |
commit | 380839299ea8ffa2c98ce6219e62b979ede0c93b (patch) | |
tree | 9740bd5a861b9b47b2ee6ed5564a3b221137e115 /Command/FromKey.hs | |
parent | cc1ea8f84463c7e333bfa17a815f250d8d088841 (diff) |
The fromkey command now takes the key as its first parameter. The --key option is no longer used.
Diffstat (limited to 'Command/FromKey.hs')
-rw-r--r-- | Command/FromKey.hs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Command/FromKey.hs b/Command/FromKey.hs index 4e4644708..b910dd1f0 100644 --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -12,26 +12,26 @@ import Command import qualified Annex.Queue import Annex.Content import Types.Key -import Config def :: [Command] -def = [command "fromkey" paramPath seek "adds a file using a specific key"] +def = [command "fromkey" (paramPair paramKey paramPath) seek + "adds a file using a specific key"] seek :: [CommandSeek] -seek = [withFilesMissing start] +seek = [withWords start] -start :: FilePath -> CommandStart -start file = notBareRepo $ do - key <- cmdlineKey +start :: [String] -> CommandStart +start (keyname:file:[]) = notBareRepo $ do + let key = maybe (error "bad key") id $ readKey keyname inbackend <- inAnnex key unless inbackend $ error $ - "key ("++keyName key++") is not present in backend" + "key ("++ keyname ++") is not present in backend" showStart "fromkey" file - next $ perform file + next $ perform key file +start _ = error "specify a key and a dest file" -perform :: FilePath -> CommandPerform -perform file = do - key <- cmdlineKey +perform :: Key -> FilePath -> CommandPerform +perform key file = do link <- calcGitLink file key liftIO $ createDirectoryIfMissing True (parentDir file) liftIO $ createSymbolicLink link file |