You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to start using it in a CLI project of my own, but before adoption, I am facing a usability question, which I was not able to find an immediate answer to.
Does shtab support the "one ArgumentParser per command class" use case?
Briefly explained, in this model, each CLI command inherits from a Command base class, which defines a parser for that specific argument only. Resolving the subcommand can then happen in an argument parser for the bare command. An example of a project using this is pip, with the base command implemented here.
Whereas for dvc, each command gets a subparser added to the single main dvc command parser, and the completion is added to the base parser, if I understood correctly.
The completion I am looking for would then do, say for two available subcommands bb and bbcc,
prog b<TAB>
# bb bbcc
Is this possible to do in current shtab if both of my bb and bbcc subcommands have their own argument parsers, as well as the base prog parser?
Thanks!
The text was updated successfully, but these errors were encountered:
Sweet, thank you for the sources!
For clarification, in order to achieve my subcommand completion example, would I need to add a subcommand argument to the main parser, with all available subcommands as choices, and then use shtab.CHOICE on that?
Hey, thanks for creating this!
I wanted to start using it in a CLI project of my own, but before adoption, I am facing a usability question, which I was not able to find an immediate answer to.
Does
shtab
support the "oneArgumentParser
per command class" use case?Briefly explained, in this model, each CLI command inherits from a
Command
base class, which defines a parser for that specific argument only. Resolving the subcommand can then happen in an argument parser for the bare command. An example of a project using this ispip
, with the base command implemented here.Whereas for
dvc
, each command gets a subparser added to the single maindvc
command parser, and the completion is added to the base parser, if I understood correctly.The completion I am looking for would then do, say for two available subcommands
bb and bbcc
,Is this possible to do in current
shtab
if both of mybb
andbbcc
subcommands have their own argument parsers, as well as the baseprog
parser?Thanks!
The text was updated successfully, but these errors were encountered: