diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-24 20:27:32 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-24 20:27:32 -0400 |
commit | 9e4ea5c2079376a451ccd3c6ae9ec03301164064 (patch) | |
tree | 6b761a99a2afa5267314e38e12bafb480c02c221 | |
parent | c8a9a7a9d99c50b069a848a78ac41b2c3de0f7e1 (diff) | |
parent | c8890646d88fab3e07ccd71b30c2fed3785a7d5e (diff) | |
download | cmd2-git-9e4ea5c2079376a451ccd3c6ae9ec03301164064.tar.gz |
Merge branch 'master' into macro
-rwxr-xr-x | README.md | 4 | ||||
-rw-r--r-- | cmd2/cmd2.py | 14 | ||||
-rw-r--r-- | tests/test_cmd2.py | 5 |
3 files changed, 16 insertions, 7 deletions
@@ -14,8 +14,8 @@ applications. It provides a simple API which is an extension of Python's built- of cmd to make your life easier and eliminates much of the boilerplate code which would be necessary when using cmd. -[](https://github.com/python-cmd2/cmd2/blob/master/cmd2.png) - +Click on image below to watch a short video demonstrating the capabilities of cmd2: +[](https://youtu.be/DDU_JH6cFsA) Main Features ------------- diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index ccf463b2..57660331 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2474,13 +2474,17 @@ class Cmd(cmd.Cmd): doc_block = [] found_first = False for doc_line in doc.splitlines(): - str(doc_line).strip() - if len(doc_line.strip()) > 0: - doc_block.append(doc_line.strip()) - found_first = True - else: + stripped_line = doc_line.strip() + + # Don't include :param type lines + if stripped_line.startswith(':'): if found_first: break + elif stripped_line: + doc_block.append(stripped_line) + found_first = True + elif found_first: + break for doc_line in doc_block: self.stdout.write('{: <{col_width}}{doc}\n'.format(command, diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 4b0687c9..7a8a52a0 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -46,6 +46,11 @@ def test_base_help_verbose(base_app): expected = normalize(BASE_HELP_VERBOSE) assert out == expected + # Make sure :param type lines are filtered out of help summary + help_doc = base_app.do_help.__func__.__doc__ + help_doc += "\n:param fake param" + base_app.do_help.__func__.__doc__ = help_doc + out = run_cmd(base_app, 'help --verbose') assert out == expected |