1
0
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:
Kelly Brazil
2024-01-20 16:05:26 -08:00
parent f863cfdef4
commit 9e269f070f
3 changed files with 18 additions and 3 deletions

View File

@ -9,7 +9,10 @@ jc changelog
- Enhance `proc-net-tcp` parser to add opposite endian support for architectures
like the s390x
- 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 line slicer to not skip blank lines
- Add source link to online parser documentation
- Add snap package build scripts
- Refactor parser aliases for `kv`, `pkg_index_deb`, `lsb_release`, and `os-release`

View File

@ -21,7 +21,7 @@ from .jc_types import JSONDictType, CustomColorType, ParserInfoType
from . import utils
from .cli_data import (
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 . import tracebackplus
@ -289,7 +289,7 @@ class JcCli():
"""Return the help text with the list of parsers"""
parsers_string: str = self.parsers_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
def help_doc(self) -> None:

View File

@ -79,6 +79,17 @@ Usage:
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 = '''\
Examples:
Standard Syntax:
@ -90,7 +101,8 @@ Examples:
$ jc --pretty /proc/meminfo
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:
$ jc --help --dig