summaryrefslogtreecommitdiff
path: root/cmd2/command_definition.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/command_definition.py')
-rw-r--r--cmd2/command_definition.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd2/command_definition.py b/cmd2/command_definition.py
index 64adaada..96bd9c46 100644
--- a/cmd2/command_definition.py
+++ b/cmd2/command_definition.py
@@ -6,6 +6,7 @@ from typing import Optional, Type
from .constants import COMMAND_FUNC_PREFIX
from .exceptions import CommandSetRegistrationError
+from .utils import get_defining_class
# Allows IDEs to resolve types without impacting imports at runtime, breaking circular dependency issues
try: # pragma: no cover
@@ -32,7 +33,8 @@ def with_default_category(category: str):
from .decorators import with_category
methods = inspect.getmembers(
cls,
- predicate=lambda meth: inspect.isfunction(meth) and meth.__name__.startswith(COMMAND_FUNC_PREFIX))
+ predicate=lambda meth: inspect.isfunction(meth) and meth.__name__.startswith(COMMAND_FUNC_PREFIX)
+ and meth in inspect.getmro(cls)[0].__dict__.values())
category_decorator = with_category(category)
for method in methods:
if not hasattr(method[1], CMD_ATTR_HELP_CATEGORY):