From 3ba6c697731b7ad6e7da31840b20bc6fd12ca47a Mon Sep 17 00:00:00 2001 From: Atul Bagga Date: Thu, 17 Oct 2019 12:52:16 +0530 Subject: [PATCH 1/5] Fix warning/deprecated msg indentation in help text --- knack/help.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knack/help.py b/knack/help.py index 78570f7..a14b782 100644 --- a/knack/help.py +++ b/knack/help.py @@ -382,9 +382,9 @@ def _build_long_summary(item): if item.long_summary: lines.append(item.long_summary) if item.deprecate_info: - lines.append(str(item.deprecate_info.message)) + lines.append(''.join(['\n', str(item.deprecate_info.message)])) if item.preview_info: - lines.append(str(item.preview_info.message)) + lines.append(''.join(['\n', str(item.preview_info.message)])) return ' '.join(lines) indent += 1 From 7fb94d6ed3814a4240d07adcbe14df3dc2d94930 Mon Sep 17 00:00:00 2001 From: Atul Bagga Date: Fri, 18 Oct 2019 10:59:51 +0530 Subject: [PATCH 2/5] Update help.py --- knack/help.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knack/help.py b/knack/help.py index a14b782..ea099b6 100644 --- a/knack/help.py +++ b/knack/help.py @@ -382,9 +382,9 @@ def _build_long_summary(item): if item.long_summary: lines.append(item.long_summary) if item.deprecate_info: - lines.append(''.join(['\n', str(item.deprecate_info.message)])) + lines.append('\n' + str(item.deprecate_info.message)) if item.preview_info: - lines.append(''.join(['\n', str(item.preview_info.message)])) + lines.append('\n' + str(item.preview_info.message)) return ' '.join(lines) indent += 1 From 51a2c4ee389e984fe0b2ffa31d4890a764292803 Mon Sep 17 00:00:00 2001 From: Atul Bagga Date: Tue, 22 Oct 2019 17:24:43 +0530 Subject: [PATCH 3/5] Fix properly for long summary deprecate info and preview cases --- knack/help.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/knack/help.py b/knack/help.py index ea099b6..5c09404 100644 --- a/knack/help.py +++ b/knack/help.py @@ -379,12 +379,15 @@ def _print_header(self, cli_name, help_file): def _build_long_summary(item): lines = [] + skip_line = '' if item.long_summary: lines.append(item.long_summary) + skip_line = '\n' if item.deprecate_info: - lines.append('\n' + str(item.deprecate_info.message)) + lines.append(skip_line + str(item.deprecate_info.message)) + skip_line = '\n' if item.preview_info: - lines.append('\n' + str(item.preview_info.message)) + lines.append(skip_line + str(item.preview_info.message)) return ' '.join(lines) indent += 1 From 47b0b09ddbd57bd4405eb8a33286dc4e6338d6bb Mon Sep 17 00:00:00 2001 From: Atul Bagga Date: Tue, 22 Oct 2019 17:51:12 +0530 Subject: [PATCH 4/5] Simpler fix --- knack/help.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/knack/help.py b/knack/help.py index 5c09404..80ccd72 100644 --- a/knack/help.py +++ b/knack/help.py @@ -379,16 +379,13 @@ def _print_header(self, cli_name, help_file): def _build_long_summary(item): lines = [] - skip_line = '' if item.long_summary: lines.append(item.long_summary) - skip_line = '\n' if item.deprecate_info: - lines.append(skip_line + str(item.deprecate_info.message)) - skip_line = '\n' + lines.append(str(item.deprecate_info.message)) if item.preview_info: - lines.append(skip_line + str(item.preview_info.message)) - return ' '.join(lines) + lines.append(str(item.preview_info.message)) + return '\n'.join(lines) indent += 1 long_sum = _build_long_summary(help_file) From fb39f104df5e52effa1c01fb756bd629719ed578 Mon Sep 17 00:00:00 2001 From: Atul Bagga Date: Tue, 11 Feb 2020 12:03:00 +0530 Subject: [PATCH 5/5] Fix tests --- tests/test_deprecation.py | 11 ++++++----- tests/test_preview.py | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py index fc2165b..323f956 100644 --- a/tests/test_deprecation.py +++ b/tests/test_deprecation.py @@ -93,8 +93,9 @@ def test_deprecate_command_help_hidden(self): expected = """ Command {} cmd3 : Short summary here. - Long summary here. Still long summary. This command has been deprecated and will be - removed in a future release. Use 'alt-cmd3' instead. + Long summary here. Still long summary. + This command has been deprecated and will be removed in a future release. Use 'alt- + cmd3' instead. Arguments -b [Required] : Allowed values: a, b, c. @@ -245,9 +246,9 @@ def test_deprecate_command_implicitly(self): expected = """ Command {} group1 cmd1 : Short summary here. - Long summary here. Still long summary. This command is implicitly deprecated because - command group 'group1' is deprecated and will be removed in a future release. Use 'alt- - group1' instead. + Long summary here. Still long summary. + This command is implicitly deprecated because command group 'group1' is deprecated and + will be removed in a future release. Use 'alt-group1' instead. """.format(self.cli_ctx.name) self.assertIn(expected, actual) diff --git a/tests/test_preview.py b/tests/test_preview.py index e70216b..f6e7084 100644 --- a/tests/test_preview.py +++ b/tests/test_preview.py @@ -141,8 +141,9 @@ def test_preview_command_implicitly(self): expected = """ Command {} group1 cmd1 : Short summary here. - Long summary here. Still long summary. Command group 'group1' is in preview. It may be - changed/removed in a future release. + Long summary here. Still long summary. + Command group 'group1' is in preview. It may be changed/removed in a future + release. """.format(self.cli_ctx.name) self.assertIn(expected, actual)