mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 15:37:24 +00:00
fish_key_reader had no -h output
This commit is contained in:
parent
b7c96417d1
commit
f839282ac0
2 changed files with 14 additions and 6 deletions
|
@ -2,22 +2,24 @@
|
|||
|
||||
\subsection fish_key_reader-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
fish_key_reader [-c] [-d LEVEL]
|
||||
fish_key_reader [-c] [-d LEVEL] | [-h]
|
||||
\endfish
|
||||
|
||||
\subsection fish_key_reader-description Description
|
||||
|
||||
`fish_key_reader` is used to study input `fish` receives from the terminal and can help with key binds. The program is interactive and works on standard input. Individual characters themselves and their hexadecimal values are displayed.
|
||||
`fish_key_reader` is used to study input received from the terminal and can help with key binds. The program is interactive and works on standard input. Individual characters themselves and their hexadecimal values are displayed.
|
||||
|
||||
The tool will output an example `bind` command matching the character sequence captured. If a character sequence is read that matches a key name recognized by the `bind` command (see `bind --key-names`), additionally a bind command will also be shown for `bind -k` usage.
|
||||
The tool will output an example `bind` command matching the character sequence captured. If the character sequence matches a special key name (see `bind --key-names`), both `bind CHARS ...` and `bind -k KEYNAME ...` usage will be shown.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- `-c` or `--continuous` begins a session where multiple key sequences can be inspected. By default the program exits after capturing a single key sequence.
|
||||
|
||||
- `-d` or `--debug-level=DEBUG_LEVEL` enables debug output and specifies a verbosity level. Like `fish -d`. Defaults to 0.
|
||||
- `-d` or `--debug-level=DEBUG_LEVEL` enables debug output and specifies a verbosity level (like `fish -d`). Defaults to 0.
|
||||
|
||||
If using `-c`, the delay in milliseconds since the previous character was received is also shown. This timing data may be useful to determine a preferred `fish_escape_delay_ms` setting or learn the amount of lag introduced by `ssh` or `tmux`.
|
||||
- '-h' or '--help' prints usage information.
|
||||
|
||||
In continuous mode (`-c`), the delay in milliseconds since the previous character was received is also shown. This information may be useful to determine a preferred `fish_escape_delay_ms` setting or learn the amount of lag introduced by `ssh` or `tmux`.
|
||||
|
||||
`fish_key_reader` intentionally disables handling of many signals. To terminate `fish_key_reader` in a `--continuous` run:
|
||||
- press `Ctrl-C` twice, or
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "input.h"
|
||||
#include "input_common.h"
|
||||
#include "proc.h"
|
||||
#include "print_help.h"
|
||||
#include "reader.h"
|
||||
#include "signal.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
@ -289,10 +290,11 @@ static void setup_and_process_keys(bool continuous_mode) {
|
|||
int main(int argc, char **argv) {
|
||||
program_name = L"fish_key_reader";
|
||||
bool continuous_mode = false;
|
||||
const char *short_opts = "+cd:D:";
|
||||
const char *short_opts = "+cd:D:h";
|
||||
const struct option long_opts[] = {{"continuous", no_argument, NULL, 'c'},
|
||||
{"debug-level", required_argument, NULL, 'd'},
|
||||
{"debug-stack-frames", required_argument, NULL, 'D'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
|
||||
|
@ -305,6 +307,10 @@ int main(int argc, char **argv) {
|
|||
continuous_mode = true;
|
||||
break;
|
||||
}
|
||||
case 'h': {
|
||||
print_help("fish_key_reader", 0);
|
||||
exit(0);
|
||||
}
|
||||
case 'd': {
|
||||
char *end;
|
||||
long tmp;
|
||||
|
|
Loading…
Reference in a new issue