diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-08-21 17:12:49 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-08-21 17:12:49 -0400 |
commit | fe83dc063216e80c99e4e429494d56e36d4dc055 (patch) | |
tree | 77aa8459c161a6108578030e10d9d65de0f1922a | |
parent | ede83be05f047451d56b7d28e2d66eed1c953adc (diff) | |
download | cmd2-git-fe83dc063216e80c99e4e429494d56e36d4dc055.tar.gz |
Fixed get_all_commands and get_help_topics to only return function names
-rw-r--r-- | cmd2/cmd2.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f516248a..f39ee2ee 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1553,7 +1553,8 @@ class Cmd(cmd.Cmd): def get_all_commands(self) -> List[str]: """Returns a list of all commands.""" - return [cur_name[3:] for cur_name in self.get_names() if cur_name.startswith('do_')] + return [name[3:] for name in self.get_names() + if name.startswith('do_') and isinstance(getattr(self, name), Callable)] def get_visible_commands(self) -> List[str]: """Returns a list of commands that have not been hidden.""" @@ -1568,7 +1569,8 @@ class Cmd(cmd.Cmd): def get_help_topics(self) -> List[str]: """ Returns a list of help topics """ - return [name[5:] for name in self.get_names() if name.startswith('help_')] + return [name[5:] for name in self.get_names() + if name.startswith('help_') and isinstance(getattr(self, name), Callable)] def complete_help(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: """ |