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:
Fabian Homborg
2017-07-04 22:52:14 +02:00
parent 4152bdc698
commit 9fb7037174
3 changed files with 10 additions and 2 deletions

View File

@@ -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;