disable_category does not disable commands that were registered later using register_command_set
#1556
-
|
I know this is not much of a concern, but i saw this happening in my code: class MyCmd2App(cmd2.Cmd):
def __init__(self) -> None:
super().__init__()
...
self.disable_category("VI. MyCategory", "Enable by ...")
...
self.register_command_set(MyCommandSet(self.dependency1))
cmd2.categorize((do_xxx), "VI. MyCategory")Now, on command Is this the expected behaviour or i shouldn't be adding commands to that category after disabling it? I see on decorator like syntax, the order is to put the category above the argparser so should the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
@kmvanbrunt Do you have any thoughts about this? |
Beta Was this translation helpful? Give feedback.
-
|
I just created a pull request to fix this. |
Beta Was this translation helpful? Give feedback.
disable_categoryonly disables commands which currently exist. It's basically just a wrapper arounddisable_command.For now you will need to call
disable_categoryany time a newCommandSetis registered. I'll eventually update it to be more dynamic.These functions predate the
CommandSetstuff so they were written in a way which made sense at the time.