-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
cmd module should sort misc help topics #67248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've discovered that do_help method of cmd.Cmd prints the documented and undocumented commands in sorted order, but does not sort the miscellaneous topics. This would be an easy fix, just change "self.print_topics(self.misc_header, help.keys(),15,80)" to use "sorted(help.keys())". |
cmd.Cmd has a documented do_help(self, arg) method (written in 2000). If arg is '', it prints
The dict called 'help' (which should be a set, and might better be called 'topics') ends up with a member for each help_y topic without a do_y command. Not sorting the keys is at least a design bug. Leaving users aside, it makes do_help unpredictable and hard to test. Our test.test_cmd omits misc help topics. In verbose mode, it prints Trying: As near as I can tell, text_cmd would still pass if Misc topics were removed and never printed. Topics can only be added to the test above is they are dependably ordered (ie, sorted). --- "With no arguments, it lists all topics with defined help_ functions, broken into up to three topics; documented commands, miscellaneous help topics, and undocumented commands." 3.4 doc says "With no argument, do_help() lists all available help topics (that is, all commands with corresponding help_*() methods or commands that have docstrings), and also lists any undocumented commands." |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: