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
|
@ -1,6 +1,6 @@
|
|||
{- git-annex command-line option parsing
|
||||
-
|
||||
- Copyright 2010-2023 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2024 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -109,9 +109,12 @@ gitAnnexCommonOptions = commonOptions ++
|
|||
|
||||
{- Parser that accepts all non-option params. -}
|
||||
cmdParams :: CmdParamsDesc -> Parser CmdParams
|
||||
cmdParams paramdesc = many $ argument str
|
||||
cmdParams paramdesc = cmdParamsWithCompleter paramdesc completeFiles
|
||||
|
||||
cmdParamsWithCompleter :: String -> Mod ArgumentFields String -> Parser CmdParams
|
||||
cmdParamsWithCompleter paramdesc completers = many $ argument str
|
||||
( metavar paramdesc
|
||||
<> action "file"
|
||||
<> completers
|
||||
)
|
||||
|
||||
parseAutoOption :: Parser Bool
|
||||
|
@ -597,3 +600,7 @@ completeRemotes' g input = do
|
|||
completeBackends :: HasCompleter f => Mod f a
|
||||
completeBackends = completeWith $
|
||||
map (decodeBS . formatKeyVariety . Backend.backendVariety) Backend.builtinList
|
||||
|
||||
completeFiles :: HasCompleter f => Mod f a
|
||||
completeFiles = action "file"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue