mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
update slice help doc
This commit is contained in:
@ -9,7 +9,10 @@ jc changelog
|
|||||||
- Enhance `proc-net-tcp` parser to add opposite endian support for architectures
|
- Enhance `proc-net-tcp` parser to add opposite endian support for architectures
|
||||||
like the s390x
|
like the s390x
|
||||||
- Enhance `url` parser to add `parent`, `filename`, `stem`, and `extension` fields
|
- Enhance `url` parser to add `parent`, `filename`, `stem`, and `extension` fields
|
||||||
|
- Enhance `/proc` file magic syntax to allow slurping when multiple files are selected
|
||||||
|
and to include the `_file` metadata field in the data
|
||||||
- Fix `ini` and `ini-dup` parsers to consistently handle null values as empty strings
|
- Fix `ini` and `ini-dup` parsers to consistently handle null values as empty strings
|
||||||
|
- Fix line slicer to not skip blank lines
|
||||||
- Add source link to online parser documentation
|
- Add source link to online parser documentation
|
||||||
- Add snap package build scripts
|
- Add snap package build scripts
|
||||||
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`
|
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`
|
||||||
|
@ -21,7 +21,7 @@ from .jc_types import JSONDictType, CustomColorType, ParserInfoType
|
|||||||
from . import utils
|
from . import utils
|
||||||
from .cli_data import (
|
from .cli_data import (
|
||||||
long_options_map, new_pygments_colors, old_pygments_colors, helptext_preamble_string,
|
long_options_map, new_pygments_colors, old_pygments_colors, helptext_preamble_string,
|
||||||
helptext_end_string
|
slicetext_string, helptext_end_string
|
||||||
)
|
)
|
||||||
from .shell_completions import bash_completion, zsh_completion
|
from .shell_completions import bash_completion, zsh_completion
|
||||||
from . import tracebackplus
|
from . import tracebackplus
|
||||||
@ -289,7 +289,7 @@ class JcCli():
|
|||||||
"""Return the help text with the list of parsers"""
|
"""Return the help text with the list of parsers"""
|
||||||
parsers_string: str = self.parsers_text()
|
parsers_string: str = self.parsers_text()
|
||||||
options_string: str = self.options_text()
|
options_string: str = self.options_text()
|
||||||
helptext_string: str = f'{helptext_preamble_string}{parsers_string}\nOptions:\n{options_string}\n{helptext_end_string}'
|
helptext_string: str = f'{helptext_preamble_string}{parsers_string}\nOptions:\n{options_string}\n{slicetext_string}\n{helptext_end_string}'
|
||||||
return helptext_string
|
return helptext_string
|
||||||
|
|
||||||
def help_doc(self) -> None:
|
def help_doc(self) -> None:
|
||||||
|
@ -79,6 +79,17 @@ Usage:
|
|||||||
Parsers:
|
Parsers:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
slicetext_string: str = '''\
|
||||||
|
Slice:
|
||||||
|
[start]:[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
|
||||||
|
'''
|
||||||
|
|
||||||
helptext_end_string: str = '''\
|
helptext_end_string: str = '''\
|
||||||
Examples:
|
Examples:
|
||||||
Standard Syntax:
|
Standard Syntax:
|
||||||
@ -90,7 +101,8 @@ Examples:
|
|||||||
$ jc --pretty /proc/meminfo
|
$ jc --pretty /proc/meminfo
|
||||||
|
|
||||||
Line Slicing:
|
Line Slicing:
|
||||||
$ cat file.csv | jc :101 --csv # parse first 100 lines
|
$ $ cat output.txt | jc 4:15 --parser # Parse from line 4 to 14
|
||||||
|
with parser (zero-based)
|
||||||
|
|
||||||
Parser Documentation:
|
Parser Documentation:
|
||||||
$ jc --help --dig
|
$ jc --help --dig
|
||||||
|
Reference in New Issue
Block a user