-
-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite CLI using the derive API #225
Conversation
Thank you very much for your contribution!
This is something we came across in |
Even if `-h` is specified, other than the first sentence will also be printed.
Changed so that even if Difference of the short help output between 16cc5d9 and f8b87cc A command-line hex viewer
Usage: hexyl [OPTIONS] [FILE]
Arguments:
- [FILE] The file to display. If no FILE argument is given, read from STDIN.
+ [FILE] The file to display. If no FILE argument is given, read from STDIN
Options:
-n, --length <N> Only read N bytes from the input. The N argument can
also include a unit with a decimal prefix (kB, MB, ..)
or binary prefix (kiB, MiB, ..), or can be specified
using a hex number. The short option '-l' can be used as
an alias.
Examples: --length=64, --length=4KiB, --length=0xff
- -c, --bytes <N> An alias for -n/--length
+ [aliases: bytes] [short aliases: c]
-s, --skip <N> Skip the first N bytes of the input. The N argument can
- also include a unit (see `--length` for details)
+ also include a unit (see `--length` for details).
A negative value is valid and will seek from the end of
the file.
- --block-size <SIZE> Sets the size of the `block` unit to SIZE (default is
- 512).
- Examples: --block-size=1024, --block-size=4kB
+ --block-size <SIZE> Sets the size of the `block` unit to SIZE.
+ Examples: --block-size=1024, --block-size=4kB [default:
+ 512]
-v, --no-squeezing Displays all input data. Otherwise any number of groups
of output lines which would be identical to the
preceding group of lines, are replaced with a line
- comprised of a single asterisk.
- --color <WHEN> When to use colors. The 'auto' mode only displays colors
- if the output goes to an interactive terminal. 'force'
- can be used to override the NO_COLOR environment
- variable. [default: always] [possible values: always,
- auto, never, force]
- --border <STYLE> Whether to draw a border with Unicode characters, ASCII
- characters, or none at all [default: unicode] [possible
+ comprised of a single asterisk
+ --color <WHEN> When to use colors [default: always] [possible values:
+ always, auto, never, force]
+ --border <STYLE> Whether to draw a border [default: unicode] [possible
values: unicode, ascii, none]
-p, --plain Display output with --no-characters, --no-position,
- --border=none, and --color=never.
- --no-characters Do not show the character panel on the right.
+ --border=none, and --color=never
+ --no-characters Do not show the character panel on the right
-C, --characters Show the character panel on the right. This is the
- default, unless --no-characters has been specified.
- --character-table <FORMAT> Defines how bytes are mapped to characters:
- "default": show printable ASCII characters as-is, '⋄'
- for NULL bytes, ' ' for space, '_' for other ASCII
- whitespace, '•' for other ASCII characters, and '×'
- for non-ASCII bytes.
- "ascii": show printable ASCII as-is, ' ' for space,
- '.' for everything else.
- "codepage-437": uses code page 437 (for non-ASCII
- bytes).
- [default: default] [possible values: default, ascii,
- codepage-437]
- -P, --no-position Whether to display the position panel on the left.
+ default, unless --no-characters has been specified
+ --character-table <FORMAT> Defines how bytes are mapped to characters [default:
+ default] [possible values: default, ascii, codepage-437]
+ -P, --no-position Whether to display the position panel on the left
-o, --display-offset <N> Add N bytes to the displayed file position. The N
argument can also include a unit (see `--length` for
- details)
+ details).
A negative value is valid and calculates an offset
- relative to the end of the file.
+ relative to the end of the file. [default: 0]
--panels <N> Sets the number of hex data panels to be displayed.
`--panels=auto` will display the maximum number of hex
data panels based on the current terminal width. By
default, hexyl will show two panels, unless the terminal
- is not wide enough for that.
+ is not wide enough for that
-g, --group-size <N> Number of bytes/octets that should be grouped together.
- Possible group sizes are 1, 2, 4, 8. The default is 1.
You can use the '--endianness' option to control the
ordering of the bytes within a group. '--groupsize' can
- be used as an alias (xxd-compatibility).
+ be used as an alias (xxd-compatibility) [default: 1]
+ [possible values: 1, 2, 4, 8]
--endianness <FORMAT> Whether to print out groups in little-endian or
big-endian format. This option only has an effect if the
'--group-size' is larger than 1. '-e' can be used as an
- alias for '--endianness=little'. [default: big]
- [possible values: big, little]
+ alias for '--endianness=little' [default: big] [possible
+ values: little, big]
-b, --base <B> Sets the base used for the bytes. The possible options
- are binary, octal, decimal, and hexadecimal. The default
- base is hexadecimal.
+ are binary, octal, decimal, and hexadecimal [default:
+ hexadecimal]
--terminal-width <N> Sets the number of terminal columns to be displayed.
Since the terminal width may not be an evenly divisible
by the width per hex data column, this will use the
greatest number of hex data panels that can fit in the
requested width but still leave some space to the right.
Cannot be used with other width-setting options.
- -h, --help Print help
+ -h, --help Print help (see more with '--help')
-V, --version Print version The long help output at f8b87cc
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! This looks much cleaner now.
Change to use clap's derive API to implement CLI. Probably, this should not change the behavior.
However, the help message is changed to:
When-h
is specified, only the first sentence of the help message for each option is printed.