mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
parent
75e9c863f6
commit
cbae738882
4 changed files with 25 additions and 17 deletions
|
@ -468,7 +468,7 @@ static int builtin_bind(parser_t &parser, io_streams_t &streams, wchar_t **argv)
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case L'a': {
|
||||
all = true;
|
||||
|
@ -520,7 +520,7 @@ static int builtin_bind(parser_t &parser, io_streams_t &streams, wchar_t **argv)
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ static int string_escape(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) { //!OCLINT(too few branches)
|
||||
case 'n': {
|
||||
flags |= ESCAPE_NO_QUOTED;
|
||||
|
@ -113,7 +113,7 @@ static int string_escape(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static int string_join(parser_t &parser, io_streams_t &streams, int argc, wchar_
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) { //!OCLINT(too few branches)
|
||||
case L'q': {
|
||||
quiet = true;
|
||||
|
@ -157,7 +157,7 @@ static int string_join(parser_t &parser, io_streams_t &streams, int argc, wchar_
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ static int string_length(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) { //!OCLINT(too few branches)
|
||||
case L'q': {
|
||||
quiet = true;
|
||||
|
@ -214,7 +214,7 @@ static int string_length(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ static int string_split(parser_t &parser, io_streams_t &streams, int argc, wchar
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'm': {
|
||||
max = fish_wcstol(w.woptarg);
|
||||
|
@ -888,7 +888,7 @@ static int string_split(parser_t &parser, io_streams_t &streams, int argc, wchar
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ static int string_repeat(parser_t &parser, io_streams_t &streams, int argc, wcha
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1068,7 +1068,7 @@ static int string_sub(parser_t &parser, io_streams_t &streams, int argc, wchar_t
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'l': {
|
||||
length = fish_wcstol(w.woptarg);
|
||||
|
@ -1107,7 +1107,7 @@ static int string_sub(parser_t &parser, io_streams_t &streams, int argc, wchar_t
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ static int string_trim(parser_t &parser, io_streams_t &streams, int argc, wchar_
|
|||
|
||||
int opt;
|
||||
wgetopter_t w;
|
||||
while ((opt = w.wgetopt_long_only(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'c': {
|
||||
chars_to_trim = w.woptarg;
|
||||
|
@ -1194,7 +1194,7 @@ static int string_trim(parser_t &parser, io_streams_t &streams, int argc, wchar_
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long_only");
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -444,7 +444,11 @@ int wgetopter_t::wgetopt_long(int argc, wchar_t **argv, const wchar_t *options,
|
|||
return _wgetopt_internal(argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// This function should never be used by fish. We keep the signature just in case we find a
|
||||
// need to use it in the future.
|
||||
int wgetopter_t::wgetopt_long_only(int argc, wchar_t **argv, const wchar_t *options,
|
||||
const struct woption *long_options, int *opt_index) {
|
||||
return _wgetopt_internal(argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -123,13 +123,17 @@ class wgetopter_t {
|
|||
ordering(),
|
||||
first_nonopt(0),
|
||||
last_nonopt(0) {}
|
||||
|
||||
int wgetopt_long(int argc, wchar_t **argv, const wchar_t *options,
|
||||
const struct woption *long_options, int *opt_index);
|
||||
#if 0
|
||||
// This function should never be used by fish. We keep the signature just in case we find a
|
||||
// need to use it in the future.
|
||||
int wgetopt_long_only(int argc, wchar_t **argv, const wchar_t *options,
|
||||
const struct woption *long_options, int *opt_index);
|
||||
const struct woption *long_options, int *opt_index);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/// Describe the long-named options requested by the application. The LONG_OPTIONS argument to
|
||||
/// getopt_long or getopt_long_only is a vector of `struct option' terminated by an element
|
||||
/// containing a name which is zero.
|
||||
|
|
Loading…
Reference in a new issue