addon commands
Seems only fair, that, like git runs git-annex, git-annex runs git-annex-foo. Implementation relies on O.forwardOptions, so that any options are passed through to the addon program. Note that this includes options before the subcommand, eg: git-annex -cx=y foo Unfortunately, git-annex eats the --help/-h options. This is because it uses O.hsubparser, which injects that option into each subcommand. Seems like this should be possible to avoid somehow, to let commands display their own --help, instead of the dummy one git-annex displays. The two step searching mirrors how git works, it makes finding git-annex-foo fast when "git annex foo" is run, but will also support fuzzy matching, once findAllAddonCommands gets implemented. This commit was sponsored by Dr. Land Raider on Patreon.
This commit is contained in:
parent
e78d2c9642
commit
aec2cf0abe
9 changed files with 92 additions and 24 deletions
|
@ -243,7 +243,7 @@ addGitAnnexGlobalOptions c = c { cmdglobaloptions = gitAnnexGlobalOptions ++ cmd
|
|||
run :: Parser TestOptions -> TestRunner -> MkBenchmarkGenerator -> [String] -> IO ()
|
||||
run testoptparser testrunner mkbenchmarkgenerator args = go envmodes
|
||||
where
|
||||
go [] = dispatch True args
|
||||
go [] = dispatch True True args
|
||||
(cmds testoptparser testrunner mkbenchmarkgenerator)
|
||||
[] Git.CurrentRepo.get
|
||||
"git-annex"
|
||||
|
|
|
@ -122,7 +122,7 @@ builtin cmd dir params = do
|
|||
let (params', fieldparams, opts) = partitionParams params
|
||||
rsyncopts = ("RsyncOptions", unwords opts)
|
||||
fields = rsyncopts : filter checkField (parseFields fieldparams)
|
||||
dispatch False (cmd : params') cmdsList fields mkrepo
|
||||
dispatch False False (cmd : params') cmdsList fields mkrepo
|
||||
"git-annex-shell"
|
||||
"Restricted login shell for git-annex only SSH access"
|
||||
where
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{- git-annex global options
|
||||
-
|
||||
- Copyright 2015 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2015-2021 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -19,6 +19,7 @@ globalFlag setter = flag' (DeferredParse setter)
|
|||
globalSetter :: (v -> Annex ()) -> Parser v -> GlobalOption
|
||||
globalSetter setter parser = DeferredParse . setter <$> parser
|
||||
|
||||
combineGlobalOptions :: [GlobalOption] -> Parser GlobalSetter
|
||||
combineGlobalOptions l = DeferredParse . mapM_ getParsed
|
||||
parserGlobalOptions :: [GlobalOption] -> Parser GlobalSetter
|
||||
parserGlobalOptions [] = DeferredParse <$> pure noop
|
||||
parserGlobalOptions l = DeferredParse . mapM_ getParsed
|
||||
<$> many (foldl1 (<|>) l)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue