From 57813276d9de0b368d1390f22e4e04b0f57246a7 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 24 Sep 2018 16:48:30 -0400 Subject: Prevent :param and :return type lines from showing in help summaries --- cmd2/cmd2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd2/cmd2.py') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 546b03cd..efc35a3a 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2459,9 +2459,12 @@ 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()) + stripped_line = doc_line.strip() + if stripped_line.startswith(':'): + # Stop since we've now hit the :param type lines + break + elif stripped_line: + doc_block.append(stripped_line) found_first = True else: if found_first: -- cgit v1.2.1 From 5d8ac434ec81bb50eb4e4650885f79347f302cca Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 24 Sep 2018 17:18:46 -0400 Subject: Allow first comment block to appear before or after :param type lines --- cmd2/cmd2.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cmd2/cmd2.py') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index efc35a3a..c2d3eb1c 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2460,15 +2460,16 @@ Usage: Usage: unalias [-a] name [name ...] found_first = False for doc_line in doc.splitlines(): stripped_line = doc_line.strip() + + # Don't include :param type lines if stripped_line.startswith(':'): - # Stop since we've now hit the :param type lines - break + if found_first: + break elif stripped_line: doc_block.append(stripped_line) found_first = True - else: - if found_first: - break + elif found_first: + break for doc_line in doc_block: self.stdout.write('{: <{col_width}}{doc}\n'.format(command, -- cgit v1.2.1