blob: 6af73670bbdf1209e0cd8be3d583655bf8b23f63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Todo List
Things to be done to implement the changes described in
[issue 907](https://github.com/python-cmd2/cmd2/issues/907)
- [ ] fix enabling and disabling commands and categories
- [x] make get_all_commands() look at the _command_methods dict
- [x] add documentation showing how to make help that isn't associated
with a command
- [ ] write documentation on renaming commands
- [ ] create decorator that does the same as rename_command
- [ ] create dashify-builtin-commands() method
- [x] make get_all_commands() look at _command_methods
- [ ] in __init__ we verify that command names don't start with shortcuts. Do
we have to do the same verification when we rename a command and throw an
error if they map it to a shortcut name?
- [x] write tests for cmd_func
- [x] write tests for get_help_func
- [ ] consider renaming cmd_func() to _get_command_func()
- [ ] consider renaming _cmd_func_name() to _command_func_name()
- [ ] make cmd_func() check if target is callable else return ''
- [ ] consider whether get_help_func() and get_complete_func() should start with _
- [x] complete implementation of rename_command
## help related
- [ ] fix get_help_topics()
- iterate through the valid commands and call a new method to
find the help for each one. _print_topics() should call this same method
- add additional items found by looking for help_mymischelptopic() functions
- [ ] refactor _print_topics()
- [ ] unit tests for get_help_topics(): test_get_help_topics(), test_get_help_topics_custom()
- [ ] refactor _help_menu(). It should:
- get the list of commands
- get the list of help topics, ie check the map and look for help_topic() functions
- for each command check whether it has help (argparse or function), if so, remove it from the list of help topics
- if it doesn't, add it to undocumented commands
- you are left with a list of commands with help, a list of other help topics, and a list of undocumented commands
## Changelog items
- in some places within cmd2 get_help_topics() was assumed to have command names, in others it was assumed not to. Now it returns all help topics, misc and command.
## Design principles
The unique thing that identifies a command is not the function, it's the name.
By default the name of the function defines the name of the command.
Renaming a command is therefore changing the primary identifier of that
command. When you do so, you are messing with everything else that uses that
primary identifier for the command, like hidden and disabled commands.
## Documentation Updates
- self.hidden_commands
- self.disabled_commands
|