Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHelp text duplicated when using more than 1 CLI instance #1002
Labels
Milestone
Comments
|
I have a very vague recollection of researching how to make a deep copy of a parser and finding that it was possible in Python 3.7+ (or something similar) but not beforehand. |
|
Yeah, inability to deep-copy an |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this program, run
alias -h. The subcommand help gets repeated.Since the parsers (e.g.
Cmd.alias_parser) are class objects, they get updated with each instantiation. This problem has existed since we added theargparsedecorators, but it's being exercised a bit more since we addedCommandSetandas_subcommand_todecorators. This specific issue of repeated text was introduced when cmd2.py started using theas_subcommand_todecorator.For the 2.0 release, we need to find a way to make deep copies of the parsers and tie each copy to an instance. We won't have 1 parser attached to the functions anymore. Instead the decorators will need to retrieve the instance-specific parser.