Tab completion of many commands like info and trust now includes remotes
Especially useful with proxied remotes and clusters, where the user may not be entirely familiar with the name and can learn by tab completion.
This commit is contained in:
parent
3d646703ee
commit
0033e6c0a6
13 changed files with 33 additions and 14 deletions
|
@ -22,7 +22,7 @@ cmd = withAnnexOptions [jsonOptions] $
|
|||
data DeadOptions = DeadRemotes [RemoteName] | DeadKeys [Key]
|
||||
|
||||
optParser :: CmdParamsDesc -> Parser DeadOptions
|
||||
optParser desc = (DeadRemotes <$> cmdParams desc)
|
||||
optParser desc = (DeadRemotes <$> cmdParamsWithCompleter desc completeRemotes)
|
||||
<|> (DeadKeys <$> many (option (str >>= parseKey)
|
||||
( long "key" <> metavar paramKey
|
||||
<> help "keys whose content has been irretrievably lost"
|
||||
|
|
|
@ -14,8 +14,8 @@ import Logs.UUID
|
|||
cmd :: Command
|
||||
cmd = command "describe" SectionSetup
|
||||
"change description of a repository"
|
||||
(paramPair paramRemote paramDesc)
|
||||
(withParams seek)
|
||||
(paramPair paramRepository paramDesc)
|
||||
(withParams' seek completeRemotes)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords (commandAction . start)
|
||||
|
|
|
@ -20,7 +20,7 @@ import qualified Data.Map as M
|
|||
|
||||
cmd :: Command
|
||||
cmd = noMessages $ command "group" SectionSetup "add a repository to a group"
|
||||
(paramPair paramRemote paramDesc) (seek <$$> optParser)
|
||||
(paramPair paramRepository paramDesc) (seek <$$> optParser)
|
||||
|
||||
data GroupOptions = GroupOptions
|
||||
{ cmdparams :: CmdParams
|
||||
|
@ -29,7 +29,7 @@ data GroupOptions = GroupOptions
|
|||
|
||||
optParser :: CmdParamsDesc -> Parser GroupOptions
|
||||
optParser desc = GroupOptions
|
||||
<$> cmdParams desc
|
||||
<$> cmdParamsWithCompleter desc completeRemotes
|
||||
<*> switch
|
||||
( long "list"
|
||||
<> help "list all currently defined groups"
|
||||
|
|
|
@ -116,7 +116,7 @@ data InfoOptions = InfoOptions
|
|||
|
||||
optParser :: CmdParamsDesc -> Parser InfoOptions
|
||||
optParser desc = InfoOptions
|
||||
<$> cmdParams desc
|
||||
<$> cmdParamsWithCompleter desc (completeFiles <> completeRemotes)
|
||||
<*> switch
|
||||
( long "bytes"
|
||||
<> help "display file sizes in bytes"
|
||||
|
|
|
@ -15,7 +15,8 @@ cmd :: Command
|
|||
cmd = withAnnexOptions [jsonOptions] $
|
||||
command "semitrust" SectionSetup
|
||||
"return repository to default trust level"
|
||||
(paramRepeating paramRepository) (withParams seek)
|
||||
(paramRepeating paramRepository)
|
||||
(withParams' seek completeRemotes)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "semitrust" SemiTrusted
|
||||
|
|
|
@ -19,7 +19,8 @@ import qualified Data.Set as S
|
|||
cmd :: Command
|
||||
cmd = withAnnexOptions [jsonOptions] $
|
||||
command "trust" SectionSetup "trust a repository"
|
||||
(paramRepeating paramRepository) (withParams seek)
|
||||
(paramRepeating paramRepository)
|
||||
(withParams' seek completeRemotes)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "trust" Trusted
|
||||
|
|
|
@ -16,7 +16,8 @@ import qualified Data.Set as S
|
|||
|
||||
cmd :: Command
|
||||
cmd = command "ungroup" SectionSetup "remove a repository from a group"
|
||||
(paramPair paramRemote paramDesc) (withParams seek)
|
||||
(paramPair paramRemote paramDesc)
|
||||
(withParams' seek completeRemotes)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords (commandAction . start)
|
||||
|
|
|
@ -14,7 +14,8 @@ import Command.Trust (trustCommand)
|
|||
cmd :: Command
|
||||
cmd = withAnnexOptions [jsonOptions] $
|
||||
command "untrust" SectionSetup "do not trust a repository"
|
||||
(paramRepeating paramRepository) (withParams seek)
|
||||
(paramRepeating paramRepository)
|
||||
(withParams' seek completeRemotes)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "untrust" UnTrusted
|
||||
|
|
|
@ -56,6 +56,7 @@ optParser :: CmdParamsDesc -> Parser UnusedOptions
|
|||
optParser _ = UnusedOptions
|
||||
<$> optional (strOption
|
||||
( long "from" <> short 'f' <> metavar paramRemote
|
||||
<> completeRemotes
|
||||
<> help "remote to check for unused content"
|
||||
))
|
||||
<*> optional (option (eitherReader parseRefSpec)
|
||||
|
|
|
@ -27,7 +27,8 @@ cmd'
|
|||
-> (UUID -> PreferredContentExpression -> Annex ())
|
||||
-> Command
|
||||
cmd' name desc getter setter = noMessages $
|
||||
command name SectionSetup desc pdesc (withParams seek)
|
||||
command name SectionSetup desc pdesc
|
||||
(withParams' seek completeRemotes)
|
||||
where
|
||||
pdesc = paramPair paramRemote (paramOptional paramExpression)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue