diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-15 22:28:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-15 22:28:18 -0400 |
commit | da504f647fdbec7aa3a3c08244520de2c00898ef (patch) | |
tree | 1c15687033b47e1f6c915a1bdff966331d3836f4 | |
parent | 27472710c73320449ce96bc409fa82e0a46be1cf (diff) |
fromkey, and url backend download work now
-rw-r--r-- | Backend/URL.hs | 6 | ||||
-rw-r--r-- | Command.hs | 19 |
2 files changed, 11 insertions, 14 deletions
diff --git a/Backend/URL.hs b/Backend/URL.hs index b40ff3959..02ce3563c 100644 --- a/Backend/URL.hs +++ b/Backend/URL.hs @@ -8,12 +8,12 @@ module Backend.URL (backends) where import Control.Monad.State (liftIO) -import Data.String.Utils import Types import BackendClass import Utility import Messages +import Key backends :: [Backend Annex] backends = [backend] @@ -52,8 +52,8 @@ dummyOk _ = return True downloadUrl :: Key -> FilePath -> Annex Bool downloadUrl key file = do - showNote "downloading" + showNote $ "downloading" showProgress -- make way for curl progress bar liftIO $ boolSystem "curl" [Params "-# -o", File file, File url] where - url = join ":" $ drop 1 $ split ":" $ show key + url = keyName key diff --git a/Command.hs b/Command.hs index 18b4a167a..27598fff0 100644 --- a/Command.hs +++ b/Command.hs @@ -17,7 +17,6 @@ import Data.List import Types import qualified Backend -import qualified BackendClass import Messages import qualified Annex import qualified GitRepo as Git @@ -230,20 +229,18 @@ paramName = "NAME" paramNothing :: String paramNothing = "" -{- The Key specified by the --key and --backend parameters. -} +{- The Key specified by the --key parameter. -} cmdlineKey :: Annex Key cmdlineKey = do k <- Annex.getState Annex.defaultkey - backends <- Backend.list - return $ stubKey { - keyName = kname k, - keyBackendName = BackendClass.name $ head backends - } + case k of + Nothing -> nokey + Just "" -> nokey + Just kstring -> case readKey kstring of + Nothing -> error "bad key" + Just key -> return key where - kname Nothing = badkey - kname (Just "") = badkey - kname (Just n) = n - badkey = error "please specify the key with --key" + nokey = error "please specify the key with --key" {- Given an original list of files, and an expanded list derived from it, - ensures that the original list's ordering is preserved. |