diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-24 19:49:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-24 19:49:10 -0400 |
commit | 87ec2820929e4757af58e166896169b41459a08c (patch) | |
tree | 2c5897da5eb21389c8368fad2ebc5c611f1b225d | |
parent | a1d64f2a12295c24e983f5ce137e0810b80831ad (diff) | |
parent | 0269c6c4b3aed822aadef08f4c28865db58055ca (diff) | |
download | cmd2-git-87ec2820929e4757af58e166896169b41459a08c.tar.gz |
Merge branch 'master' into video_animation
-rw-r--r-- | cmd2/cmd2.py | 14 | ||||
-rw-r--r-- | tests/test_cmd2.py | 5 |
2 files changed, 14 insertions, 5 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 546b03cd..c2d3eb1c 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2459,13 +2459,17 @@ Usage: Usage: unalias [-a] name [name ...] 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 |