Help text duplicated when using more than 1 CLI instance
See original GitHub issueimport sys
from cmd2 import cmd2
instance_1 = cmd2.Cmd()
instance_2 = cmd2.Cmd()
sys.exit(instance_2.cmdloop())
With this program, run alias -h. The subcommand help gets repeated.
SUBCOMMAND
create create or overwrite an alias
delete delete aliases
list delete aliases
create create or overwrite an alias
delete delete aliases
list delete aliases
Since the parsers (e.g. Cmd.alias_parser) are class objects, they get updated with each instantiation. This problem has existed since we added the argparse decorators, but it’s being exercised a bit more since we added CommandSet and as_subcommand_to decorators. This specific issue of repeated text was introduced when cmd2.py started using the as_subcommand_to decorator.
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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Help text duplicated when using more than 1 CLI instance -
import sys from cmd2 import cmd2 instance_1 = cmd2.Cmd() instance_2 = cmd2.Cmd() sys.exit(instance_2.cmdloop()). With this program, run alias -h .
Read more >Atlassian CLI 3.8.0 - Help text - Atlassian Command Line Interface ...
To get help for a specific action, type the action followed by --help - example: --action getProjectList --help · Use double dash for...
Read more >How to use the uniq command to process lists in Linux - Red Hat
In this scenario, the uniq command helps you to print duplicate lines once in the output. It actually discards the lines which are...
Read more >uniq Command in LINUX with examples - GeeksforGeeks
In simple words, uniq is the tool that helps to detect the adjacent duplicate lines and also deletes the duplicate lines.
Read more >Zsh tab completion duplicating command name - Stack Overflow
This effect also could be reproduced if you use any of fancy UTF-8 characters like arrow, "git branch" character and so on.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@anselor and I agree the 2.0 release does not have to wait for this fix. The risk of someone using two cmd2 objects and editing common parsers between them is pretty low.
@kmvanbrunt Is this fixed now? Or are we waiting on some better fix?