summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-13 10:26:54 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-13 10:26:54 -0400
commit533a5242b66831d56fb437fb356ef906b4b4fe0a (patch)
tree6b2c1bb81b3a22fbab2fc9af2c3dd1f7c5e44b68
parentacf8d5eb7d1e543a0cebb90b79d1b16695a1c5e3 (diff)
convert Dead, and allow multiple --key options
-rw-r--r--CmdLine/GitAnnex.hs4
-rw-r--r--Command/Dead.hs25
-rw-r--r--debian/changelog1
3 files changed, 17 insertions, 13 deletions
diff --git a/CmdLine/GitAnnex.hs b/CmdLine/GitAnnex.hs
index 640507380..37f5ce8ba 100644
--- a/CmdLine/GitAnnex.hs
+++ b/CmdLine/GitAnnex.hs
@@ -72,7 +72,7 @@ import qualified Command.NumCopies
import qualified Command.Trust
import qualified Command.Untrust
import qualified Command.Semitrust
---import qualified Command.Dead
+import qualified Command.Dead
import qualified Command.Group
import qualified Command.Wanted
import qualified Command.GroupWanted
@@ -150,7 +150,7 @@ cmds =
, Command.Trust.cmd
, Command.Untrust.cmd
, Command.Semitrust.cmd
--- , Command.Dead.cmd
+ , Command.Dead.cmd
, Command.Group.cmd
, Command.Wanted.cmd
, Command.GroupWanted.cmd
diff --git a/Command/Dead.hs b/Command/Dead.hs
index e487b3b5e..04c754d07 100644
--- a/Command/Dead.hs
+++ b/Command/Dead.hs
@@ -9,26 +9,29 @@ module Command.Dead where
import Command
import Common.Annex
-import qualified Annex
import Types.TrustLevel
import Types.Key
import Command.Trust (trustCommand)
import Logs.Location
import Remote (keyLocations)
+import Git.Types
cmd :: Command
-cmd = withOptions [keyOption] $
- command "dead" SectionSetup "hide a lost repository or key"
- (paramRepeating paramRemote) (withParams seek)
+cmd = command "dead" SectionSetup "hide a lost repository or key"
+ (paramRepeating paramRemote) (seek <$$> optParser)
-seek :: CmdParams -> CommandSeek
-seek ps = maybe (trustCommand "dead" DeadTrusted ps) (flip seekKey ps)
- =<< Annex.getField "key"
+data DeadOptions = DeadRemotes [RemoteName] | DeadKeys [Key]
-seekKey :: String -> CmdParams -> CommandSeek
-seekKey ks = case file2key ks of
- Nothing -> error "Invalid key"
- Just key -> withNothing (startKey key)
+optParser :: CmdParamsDesc -> Parser DeadOptions
+optParser desc = (DeadRemotes <$> cmdParams desc)
+ <|> (DeadKeys <$> many (option (str >>= parseKey)
+ ( long "key" <> metavar paramKey
+ <> help "keys whose content has been irretrievably lost"
+ )))
+
+seek :: DeadOptions -> CommandSeek
+seek (DeadRemotes rs) = trustCommand "dead" DeadTrusted rs
+seek (DeadKeys ks) = seekActions $ pure $ map startKey ks
startKey :: Key -> CommandStart
startKey key = do
diff --git a/debian/changelog b/debian/changelog
index f4d6c51c3..36cde0735 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@
* Bash completion code is built-in to git-annex, and can be enabled by
running: source <(git-annex --bash-completion-script git-annex)
* version --raw now works when run outside a git repository.
+ * dead now accepts multiple --key options.
git-annex (5.20150710) unstable; urgency=medium