diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-24 17:36:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 17:36:08 -0500 |
commit | 5f5c48d51927c27d107b5e9540f5ef867b180145 (patch) | |
tree | 2c3e396b1b022ad6f24ea22773bd03f36cf7ee8e /cmd2/utils.py | |
parent | ec7b442eff9f6488509d43b6ae2e902fcdb79ddf (diff) | |
parent | d25fd7146131688e934290a3c5bf0407e904dbb2 (diff) | |
download | cmd2-git-5f5c48d51927c27d107b5e9540f5ef867b180145.tar.gz |
Merge branch 'master' into bug-898
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r-- | cmd2/utils.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 237a6d1e..f119999a 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -969,10 +969,22 @@ def get_styles_in_text(text: str) -> Dict[int, str]: def categorize(func: Union[Callable, Iterable[Callable]], category: str) -> None: """Categorize a function. - The help command output will group this function under the specified category heading + The help command output will group the passed function under the + specified category heading :param func: function or list of functions to categorize :param category: category to put it in + + :Example: + + >>> class MyApp(cmd2.Cmd): + >>> def do_echo(self, arglist): + >>> self.poutput(' '.join(arglist) + >>> + >>> utils.categorize(do_echo, "Text Processing") + + For an alternative approach to categorizing commands using a decorator, see + :func:`~cmd2.decorators.with_category` """ if isinstance(func, Iterable): for item in func: |