convert Dead, and allow multiple --key options
This commit is contained in:
parent
adec382bc2
commit
3d8a8e9792
3 changed files with 17 additions and 13 deletions
|
@ -72,7 +72,7 @@ import qualified Command.NumCopies
|
||||||
import qualified Command.Trust
|
import qualified Command.Trust
|
||||||
import qualified Command.Untrust
|
import qualified Command.Untrust
|
||||||
import qualified Command.Semitrust
|
import qualified Command.Semitrust
|
||||||
--import qualified Command.Dead
|
import qualified Command.Dead
|
||||||
import qualified Command.Group
|
import qualified Command.Group
|
||||||
import qualified Command.Wanted
|
import qualified Command.Wanted
|
||||||
import qualified Command.GroupWanted
|
import qualified Command.GroupWanted
|
||||||
|
@ -150,7 +150,7 @@ cmds =
|
||||||
, Command.Trust.cmd
|
, Command.Trust.cmd
|
||||||
, Command.Untrust.cmd
|
, Command.Untrust.cmd
|
||||||
, Command.Semitrust.cmd
|
, Command.Semitrust.cmd
|
||||||
-- , Command.Dead.cmd
|
, Command.Dead.cmd
|
||||||
, Command.Group.cmd
|
, Command.Group.cmd
|
||||||
, Command.Wanted.cmd
|
, Command.Wanted.cmd
|
||||||
, Command.GroupWanted.cmd
|
, Command.GroupWanted.cmd
|
||||||
|
|
|
@ -9,26 +9,29 @@ module Command.Dead where
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import qualified Annex
|
|
||||||
import Types.TrustLevel
|
import Types.TrustLevel
|
||||||
import Types.Key
|
import Types.Key
|
||||||
import Command.Trust (trustCommand)
|
import Command.Trust (trustCommand)
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import Remote (keyLocations)
|
import Remote (keyLocations)
|
||||||
|
import Git.Types
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = withOptions [keyOption] $
|
cmd = command "dead" SectionSetup "hide a lost repository or key"
|
||||||
command "dead" SectionSetup "hide a lost repository or key"
|
(paramRepeating paramRemote) (seek <$$> optParser)
|
||||||
(paramRepeating paramRemote) (withParams seek)
|
|
||||||
|
|
||||||
seek :: CmdParams -> CommandSeek
|
data DeadOptions = DeadRemotes [RemoteName] | DeadKeys [Key]
|
||||||
seek ps = maybe (trustCommand "dead" DeadTrusted ps) (flip seekKey ps)
|
|
||||||
=<< Annex.getField "key"
|
|
||||||
|
|
||||||
seekKey :: String -> CmdParams -> CommandSeek
|
optParser :: CmdParamsDesc -> Parser DeadOptions
|
||||||
seekKey ks = case file2key ks of
|
optParser desc = (DeadRemotes <$> cmdParams desc)
|
||||||
Nothing -> error "Invalid key"
|
<|> (DeadKeys <$> many (option (str >>= parseKey)
|
||||||
Just key -> withNothing (startKey key)
|
( 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 -> CommandStart
|
||||||
startKey key = do
|
startKey key = do
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -6,6 +6,7 @@
|
||||||
* Bash completion code is built-in to git-annex, and can be enabled by
|
* Bash completion code is built-in to git-annex, and can be enabled by
|
||||||
running: source <(git-annex --bash-completion-script git-annex)
|
running: source <(git-annex --bash-completion-script git-annex)
|
||||||
* version --raw now works when run outside a git repository.
|
* version --raw now works when run outside a git repository.
|
||||||
|
* dead now accepts multiple --key options.
|
||||||
|
|
||||||
git-annex (5.20150710) unstable; urgency=medium
|
git-annex (5.20150710) unstable; urgency=medium
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue