mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 04:58:57 +00:00
fish_key_reader: Add --version option
This should be there anyway, and we try to find fish_key_reader for .app bundles, so this stops us from defining aliases to the command. See #4179.
This commit is contained in:
parent
4152bdc698
commit
9fb7037174
3 changed files with 10 additions and 2 deletions
|
@ -21,6 +21,8 @@ The following options are available:
|
|||
|
||||
- `-h` or `--help` prints usage information.
|
||||
|
||||
- `-v` or `--version` prints fish_key_reader's version and exits.
|
||||
|
||||
\subsection fish_key_reader-usage-notes Usage Notes
|
||||
|
||||
The delay in milliseconds since the previous character was received is included in the diagnostic information written to stderr. This information may be useful to determine the optimal `fish_escape_delay_ms` setting or learn the amount of lag introduced by tools like `ssh`, `mosh` or `tmux`.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# check if command fish_key_reader works and is the same version that
|
||||
# came with this fish. This will happen one time.
|
||||
command -sq fish_key_reader
|
||||
and command fish_key_reader --version 2>&1 | string match -rq $FISH_VERSION
|
||||
and command fish_key_reader --version 2>&1 | string match -q -- $FISH_VERSION
|
||||
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
||||
# the command (if there is one) will be used by default.
|
||||
or alias fish_key_reader=(string escape $__fish_bin_dir/fish_key_reader)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "common.h"
|
||||
#include "env.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "fish_version.h"
|
||||
#include "input.h"
|
||||
#include "input_common.h"
|
||||
#include "print_help.h"
|
||||
|
@ -331,11 +332,12 @@ static bool parse_debug_frames_flag() {
|
|||
}
|
||||
|
||||
static bool parse_flags(int argc, char **argv, bool *continuous_mode) {
|
||||
const char *short_opts = "+cd:D:h";
|
||||
const char *short_opts = "+cd:D:hv";
|
||||
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'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
int opt;
|
||||
bool error = false;
|
||||
|
@ -358,6 +360,10 @@ static bool parse_flags(int argc, char **argv, bool *continuous_mode) {
|
|||
error = !parse_debug_frames_flag();
|
||||
break;
|
||||
}
|
||||
case 'v': {
|
||||
fwprintf(stdout, L"%s\n", get_fish_version());
|
||||
return false;
|
||||
}
|
||||
default: {
|
||||
// We assume getopt_long() has already emitted a diagnostic msg.
|
||||
error = true;
|
||||
|
|
Loading…
Reference in a new issue