From 441bcbde80e8248204329a85e2c099601caaadbe Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 6 Mar 2026 15:50:52 -0800 Subject: [PATCH] fix indent on help text so lines don't wrap over 80 chars. Also fix mypy uncovered value assignment issue. --- jc/cli.py | 16 ++++++++++++---- jc/cli_data.py | 52 +++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/jc/cli.py b/jc/cli.py index 855aaa78..7f559286 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -300,8 +300,8 @@ class JcCli(): Pages the parser documentation if a parser is found in the arguments, otherwise the general help text is printed. """ - self.indent = 4 - self.pad = 22 + self.indent = 2 + self.pad = 21 if self.show_categories: utils._safe_print(self.parser_categories_text()) @@ -569,7 +569,11 @@ class JcCli(): if self.debug: raise - error_msg = os.strerror(e.errno) + if e.errno: + error_msg = os.strerror(e.errno) + else: + error_msg = "no further information provided" + utils.error_message([ f'"{file}" file could not be opened: {error_msg}.' ]) @@ -594,7 +598,11 @@ class JcCli(): if self.debug: raise - error_msg = os.strerror(e.errno) + if e.errno: + error_msg = os.strerror(e.errno) + else: + error_msg = "no further information provided" + utils.error_message([ f'"{self.magic_run_command_str}" command could not be run: {error_msg}.' ]) diff --git a/jc/cli_data.py b/jc/cli_data.py index 261bc989..6cdaae10 100644 --- a/jc/cli_data.py +++ b/jc/cli_data.py @@ -62,52 +62,52 @@ jc converts the output of many commands, file-types, and strings to JSON or YAML Usage: - Standard syntax: + Standard syntax: - COMMAND | jc [SLICE] [OPTIONS] PARSER + COMMAND | jc [SLICE] [OPTIONS] PARSER - cat FILE | jc [SLICE] [OPTIONS] PARSER + cat FILE | jc [SLICE] [OPTIONS] PARSER - echo STRING | jc [SLICE] [OPTIONS] PARSER + echo STRING | jc [SLICE] [OPTIONS] PARSER - Magic syntax: + Magic syntax: - jc [SLICE] [OPTIONS] COMMAND + jc [SLICE] [OPTIONS] COMMAND - jc [SLICE] [OPTIONS] /proc/ + jc [SLICE] [OPTIONS] /proc/ Parsers: ''' slicetext_string: str = '''\ Slice: - [start]:[end] + [start]:[end] - start: [[-]index] - Zero-based start line, negative index for - counting from the end + start: [[-]index] - Zero-based start line, negative index for + counting from the end - end: [[-]index] - Zero-based end line (excluding the index), - negative index for counting from the end + end: [[-]index] - Zero-based end line (excluding the index), + negative index for counting from the end ''' helptext_end_string: str = '''\ Examples: - Standard Syntax: - $ dig www.google.com | jc --pretty --dig - $ cat /proc/meminfo | jc --pretty --proc + Standard Syntax: + $ dig www.google.com | jc --pretty --dig + $ cat /proc/meminfo | jc --pretty --proc - Magic Syntax: - $ jc --pretty dig www.google.com - $ jc --pretty /proc/meminfo + Magic Syntax: + $ jc --pretty dig www.google.com + $ jc --pretty /proc/meminfo - Line Slicing: - $ cat output.txt | jc 4:15 -- # Parse from line 4 to 14 - # with (zero-based) + Line Slicing: + $ cat output.txt | jc 4:15 -- # Parse from line 4 to 14 + # with (zero-based) - Parser Documentation: - $ jc --help --dig + Parser Documentation: + $ jc --help --dig - More Help: - $ jc -hh # show hidden parsers - $ jc -hhh # list parsers by category tags + More Help: + $ jc -hh # show hidden parsers + $ jc -hhh # list parsers by category tags ''' \ No newline at end of file