Skip to content

Commit 441bcbd

Browse files
fix indent on help text so lines don't wrap over 80 chars. Also fix mypy uncovered value assignment issue.
1 parent 936432d commit 441bcbd

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

jc/cli.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ def help_doc(self) -> None:
300300
Pages the parser documentation if a parser is found in the arguments,
301301
otherwise the general help text is printed.
302302
"""
303-
self.indent = 4
304-
self.pad = 22
303+
self.indent = 2
304+
self.pad = 21
305305

306306
if self.show_categories:
307307
utils._safe_print(self.parser_categories_text())
@@ -569,7 +569,11 @@ def do_magic(self) -> None:
569569
if self.debug:
570570
raise
571571

572-
error_msg = os.strerror(e.errno)
572+
if e.errno:
573+
error_msg = os.strerror(e.errno)
574+
else:
575+
error_msg = "no further information provided"
576+
573577
utils.error_message([
574578
f'"{file}" file could not be opened: {error_msg}.'
575579
])
@@ -594,7 +598,11 @@ def do_magic(self) -> None:
594598
if self.debug:
595599
raise
596600

597-
error_msg = os.strerror(e.errno)
601+
if e.errno:
602+
error_msg = os.strerror(e.errno)
603+
else:
604+
error_msg = "no further information provided"
605+
598606
utils.error_message([
599607
f'"{self.magic_run_command_str}" command could not be run: {error_msg}.'
600608
])

jc/cli_data.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,52 +62,52 @@
6262
6363
Usage:
6464
65-
Standard syntax:
65+
Standard syntax:
6666
67-
COMMAND | jc [SLICE] [OPTIONS] PARSER
67+
COMMAND | jc [SLICE] [OPTIONS] PARSER
6868
69-
cat FILE | jc [SLICE] [OPTIONS] PARSER
69+
cat FILE | jc [SLICE] [OPTIONS] PARSER
7070
71-
echo STRING | jc [SLICE] [OPTIONS] PARSER
71+
echo STRING | jc [SLICE] [OPTIONS] PARSER
7272
73-
Magic syntax:
73+
Magic syntax:
7474
75-
jc [SLICE] [OPTIONS] COMMAND
75+
jc [SLICE] [OPTIONS] COMMAND
7676
77-
jc [SLICE] [OPTIONS] /proc/<path-to-procfile>
77+
jc [SLICE] [OPTIONS] /proc/<path-to-procfile>
7878
7979
Parsers:
8080
'''
8181

8282
slicetext_string: str = '''\
8383
Slice:
84-
[start]:[end]
84+
[start]:[end]
8585
86-
start: [[-]index] - Zero-based start line, negative index for
87-
counting from the end
86+
start: [[-]index] - Zero-based start line, negative index for
87+
counting from the end
8888
89-
end: [[-]index] - Zero-based end line (excluding the index),
90-
negative index for counting from the end
89+
end: [[-]index] - Zero-based end line (excluding the index),
90+
negative index for counting from the end
9191
'''
9292

9393
helptext_end_string: str = '''\
9494
Examples:
95-
Standard Syntax:
96-
$ dig www.google.com | jc --pretty --dig
97-
$ cat /proc/meminfo | jc --pretty --proc
95+
Standard Syntax:
96+
$ dig www.google.com | jc --pretty --dig
97+
$ cat /proc/meminfo | jc --pretty --proc
9898
99-
Magic Syntax:
100-
$ jc --pretty dig www.google.com
101-
$ jc --pretty /proc/meminfo
99+
Magic Syntax:
100+
$ jc --pretty dig www.google.com
101+
$ jc --pretty /proc/meminfo
102102
103-
Line Slicing:
104-
$ cat output.txt | jc 4:15 --<PARSER> # Parse from line 4 to 14
105-
# with <PARSER> (zero-based)
103+
Line Slicing:
104+
$ cat output.txt | jc 4:15 --<PARSER> # Parse from line 4 to 14
105+
# with <PARSER> (zero-based)
106106
107-
Parser Documentation:
108-
$ jc --help --dig
107+
Parser Documentation:
108+
$ jc --help --dig
109109
110-
More Help:
111-
$ jc -hh # show hidden parsers
112-
$ jc -hhh # list parsers by category tags
110+
More Help:
111+
$ jc -hh # show hidden parsers
112+
$ jc -hhh # list parsers by category tags
113113
'''

0 commit comments

Comments
 (0)