style cleanups (make style-all)

This commit is contained in:
Kurtis Rader 2017-06-16 21:00:24 -07:00
parent d22743dad0
commit af22bf3501
8 changed files with 51 additions and 54 deletions

View file

@ -74,7 +74,8 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
end
end
if test -n "$new_paths";
if test -n "$new_paths"
_recursive $new_paths
end
end

View file

@ -241,8 +241,8 @@ static bool builtin_bind_insert(bind_cmd_opts_t &opts, int optind, int argc, wch
return true;
}
} else {
if (builtin_bind_add(argv[optind], argv + (optind + 1), argc - (optind + 1),
opts.bind_mode, opts.sets_bind_mode, opts.use_terminfo, streams)) {
if (builtin_bind_add(argv[optind], argv + (optind + 1), argc - (optind + 1), opts.bind_mode,
opts.sets_bind_mode, opts.use_terminfo, streams)) {
return true;
}
}

View file

@ -114,7 +114,7 @@ int builtin_block(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
}
case UNSET: {
while (block != NULL && block->type() != FUNCTION_CALL &&
block->type() != FUNCTION_CALL_NO_SHADOW) {
block->type() != FUNCTION_CALL_NO_SHADOW) {
// Set it in function scope
block = parser.block_at_index(++block_idx);
}

View file

@ -15,7 +15,7 @@
#include "proc.h"
#include "reader.h"
#include "tokenizer.h"
#include "wutil.h" // IWYU pragma: keep
#include "wutil.h" // IWYU pragma: keep
/// Builtin for putting a job in the foreground.
int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) {

View file

@ -37,19 +37,18 @@ struct function_cmd_opts_t {
// This command is atypical in using the "+" (REQUIRE_ORDER) option for flag parsing.
// This is needed due to the semantics of the -a/--argument-names flag.
static const wchar_t *short_options = L"+:a:d:e:hj:p:s:v:w:SV:";
static const struct woption long_options[] = {
{L"description", required_argument, NULL, 'd'},
{L"on-signal", required_argument, NULL, 's'},
{L"on-job-exit", required_argument, NULL, 'j'},
{L"on-process-exit", required_argument, NULL, 'p'},
{L"on-variable", required_argument, NULL, 'v'},
{L"on-event", required_argument, NULL, 'e'},
{L"wraps", required_argument, NULL, 'w'},
{L"help", no_argument, NULL, 'h'},
{L"argument-names", required_argument, NULL, 'a'},
{L"no-scope-shadowing", no_argument, NULL, 'S'},
{L"inherit-variable", required_argument, NULL, 'V'},
{NULL, 0, NULL, 0}};
static const struct woption long_options[] = {{L"description", required_argument, NULL, 'd'},
{L"on-signal", required_argument, NULL, 's'},
{L"on-job-exit", required_argument, NULL, 'j'},
{L"on-process-exit", required_argument, NULL, 'p'},
{L"on-variable", required_argument, NULL, 'v'},
{L"on-event", required_argument, NULL, 'e'},
{L"wraps", required_argument, NULL, 'w'},
{L"help", no_argument, NULL, 'h'},
{L"argument-names", required_argument, NULL, 'a'},
{L"no-scope-shadowing", no_argument, NULL, 'S'},
{L"inherit-variable", required_argument, NULL, 'V'},
{NULL, 0, NULL, 0}};
static int parse_cmd_opts(function_cmd_opts_t &opts, int *optind, //!OCLINT(high ncss method)
int argc, wchar_t **argv, parser_t &parser, io_streams_t &streams,
@ -250,7 +249,7 @@ int builtin_function(parser_t &parser, io_streams_t &streams, const wcstring_lis
function_data_t d;
d.name = function_name;
if (!opts.description.empty()) d.description = opts.description;
//d.description = opts.description;
// d.description = opts.description;
d.events.swap(opts.events);
d.shadow_scope = opts.shadow_scope;
d.named_arguments.swap(opts.named_arguments);

View file

@ -127,8 +127,7 @@ static int parse_cmd_opts(status_cmd_opts_t &opts, int *optind, //!OCLINT(high
break;
}
case 2: {
if (!set_status_cmd(cmd, opts, STATUS_IS_INTERACTIVE_JOB_CTRL,
streams)) {
if (!set_status_cmd(cmd, opts, STATUS_IS_INTERACTIVE_JOB_CTRL, streams)) {
return STATUS_CMD_ERROR;
}
break;

View file

@ -355,8 +355,7 @@ static std::map<char, decltype(*handle_flag_N)> flag_to_function = {
{'N', handle_flag_N}, {'a', handle_flag_a}, {'c', handle_flag_c}, {'e', handle_flag_e},
{'f', handle_flag_f}, {'i', handle_flag_i}, {'l', handle_flag_l}, {'m', handle_flag_m},
{'n', handle_flag_n}, {'q', handle_flag_q}, {'r', handle_flag_r}, {'s', handle_flag_s},
{'v', handle_flag_v}
};
{'v', handle_flag_v}};
/// Parse the arguments for flags recognized by a specific string subcommand.
static int parse_opts(options_t *opts, int *optind, int n_req_args, int argc, wchar_t **argv,
@ -514,38 +513,38 @@ class wildcard_matcher_t : public string_matcher_t {
if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING);
if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING);
}
}
virtual ~wildcard_matcher_t() {}
bool report_matches(const wchar_t *arg) {
// Note: --all is a no-op for glob matching since the pattern is always matched
// against the entire argument.
bool match;
if (opts.ignore_case) {
wcstring s = arg;
for (size_t i = 0; i < s.length(); i++) {
s[i] = towlower(s[i]);
}
virtual ~wildcard_matcher_t() {}
bool report_matches(const wchar_t *arg) {
// Note: --all is a no-op for glob matching since the pattern is always matched
// against the entire argument.
bool match;
if (opts.ignore_case) {
wcstring s = arg;
for (size_t i = 0; i < s.length(); i++) {
s[i] = towlower(s[i]);
}
match = wildcard_match(s, wcpattern, false);
} else {
match = wildcard_match(arg, wcpattern, false);
}
if (match ^ opts.invert_match) {
total_matched++;
if (!opts.quiet) {
if (opts.index) {
streams.out.append_format(L"1 %lu\n", wcslen(arg));
} else {
streams.out.append(arg);
streams.out.append(L'\n');
}
}
}
return true;
match = wildcard_match(s, wcpattern, false);
} else {
match = wildcard_match(arg, wcpattern, false);
}
if (match ^ opts.invert_match) {
total_matched++;
if (!opts.quiet) {
if (opts.index) {
streams.out.append_format(L"1 %lu\n", wcslen(arg));
} else {
streams.out.append(arg);
streams.out.append(L'\n');
}
}
}
return true;
}
};
static wcstring pcre2_strerror(int err_code) {

View file

@ -133,7 +133,6 @@ class wgetopter_t {
#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.