mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-03-12 16:25:50 +02:00
fix indent on help text so lines don't wrap over 80 chars. Also fix mypy uncovered value assignment issue.
This commit is contained in:
16
jc/cli.py
16
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}.'
|
||||
])
|
||||
|
||||
@@ -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/<path-to-procfile>
|
||||
jc [SLICE] [OPTIONS] /proc/<path-to-procfile>
|
||||
|
||||
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 --<PARSER> # Parse from line 4 to 14
|
||||
# with <PARSER> (zero-based)
|
||||
Line Slicing:
|
||||
$ cat output.txt | jc 4:15 --<PARSER> # Parse from line 4 to 14
|
||||
# with <PARSER> (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
|
||||
'''
|
||||
Reference in New Issue
Block a user