mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 09:21:16 -03:00
fix echo -h
In addition to fixing `echo -h` this includes some debugging related cleanups I made while investigating the issue. Fixes #4120
This commit is contained in:
@@ -754,13 +754,8 @@ static int parser_is_pipe_forbidden(const wcstring &word) {
|
||||
return contains(forbidden_pipe_commands, word);
|
||||
}
|
||||
|
||||
bool parse_util_argument_is_help(const wchar_t *s, int min_match) {
|
||||
CHECK(s, 0);
|
||||
size_t len = wcslen(s);
|
||||
|
||||
min_match = maxi(min_match, 3); //!OCLINT(parameter reassignment)
|
||||
|
||||
return wcscmp(L"-h", s) == 0 || (len >= (size_t)min_match && (wcsncmp(L"--help", s, len) == 0));
|
||||
bool parse_util_argument_is_help(const wchar_t *s) {
|
||||
return wcscmp(L"-h", s) == 0 || wcscmp(L"--help", s) == 0;
|
||||
}
|
||||
|
||||
/// Check if the first argument under the given node is --help.
|
||||
@@ -773,7 +768,7 @@ static bool first_argument_is_help(const parse_node_tree_t &node_tree, const par
|
||||
// Check the first argument only.
|
||||
const parse_node_t &arg = *arg_nodes.at(0);
|
||||
const wcstring first_arg_src = arg.get_source(src);
|
||||
is_help = parse_util_argument_is_help(first_arg_src.c_str(), 3);
|
||||
is_help = parse_util_argument_is_help(first_arg_src.c_str());
|
||||
}
|
||||
return is_help;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user