mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
clang-format C++ files
Forgot to run this after the wcstring_list_t -> std::vector<wcstring> rename.
This commit is contained in:
parent
564039093b
commit
e4f6169a01
18 changed files with 37 additions and 24 deletions
|
@ -189,7 +189,8 @@ maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd, const environ
|
|||
}
|
||||
}
|
||||
|
||||
maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd, const std::vector<wcstring> &paths) {
|
||||
maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd,
|
||||
const std::vector<wcstring> &paths) {
|
||||
// Are we currently in the process of autoloading this?
|
||||
if (current_autoloading_.count(cmd) > 0) return none();
|
||||
|
||||
|
|
|
@ -433,7 +433,8 @@ static const wchar_t *const help_builtins[] = {L"for", L"while", L"function", L
|
|||
static bool cmd_needs_help(const wcstring &cmd) { return contains(help_builtins, cmd); }
|
||||
|
||||
/// Execute a builtin command
|
||||
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv, io_streams_t &streams) {
|
||||
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv,
|
||||
io_streams_t &streams) {
|
||||
if (argv.empty()) return proc_status_t::from_exit_code(STATUS_INVALID_ARGS);
|
||||
const wcstring &cmdname = argv.front();
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ struct builtin_data_t {
|
|||
|
||||
bool builtin_exists(const wcstring &cmd);
|
||||
|
||||
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv, io_streams_t &streams);
|
||||
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv,
|
||||
io_streams_t &streams);
|
||||
|
||||
std::vector<wcstring> builtin_get_names();
|
||||
wcstring_list_ffi_t builtin_get_names_ffi();
|
||||
|
|
|
@ -172,7 +172,8 @@ bool is_windows_subsystem_for_linux() {
|
|||
#ifdef HAVE_BACKTRACE_SYMBOLS
|
||||
// This function produces a stack backtrace with demangled function & method names. It is based on
|
||||
// https://gist.github.com/fmela/591333 but adapted to the style of the fish project.
|
||||
[[gnu::noinline]] static std::vector<wcstring> demangled_backtrace(int max_frames, int skip_levels) {
|
||||
[[gnu::noinline]] static std::vector<wcstring> demangled_backtrace(int max_frames,
|
||||
int skip_levels) {
|
||||
void *callstack[128];
|
||||
const int n_max_frames = sizeof(callstack) / sizeof(callstack[0]);
|
||||
int n_frames = backtrace(callstack, n_max_frames);
|
||||
|
|
|
@ -380,7 +380,9 @@ class completer_t {
|
|||
// Bag of data to support expanding a command's arguments using custom completions, including
|
||||
// the wrap chain.
|
||||
struct custom_arg_data_t {
|
||||
explicit custom_arg_data_t(std::vector<wcstring> *vars) : var_assignments(vars) { assert(vars); }
|
||||
explicit custom_arg_data_t(std::vector<wcstring> *vars) : var_assignments(vars) {
|
||||
assert(vars);
|
||||
}
|
||||
|
||||
// The unescaped argument before the argument which is being completed, or empty if none.
|
||||
wcstring previous_argument{};
|
||||
|
|
|
@ -1018,7 +1018,8 @@ class env_stack_impl_t final : public env_scoped_impl_t {
|
|||
/// Try setting\p key as an electric or readonly variable.
|
||||
/// \return an error code, or none() if not an electric or readonly variable.
|
||||
/// \p val will not be modified upon a none() return.
|
||||
maybe_t<int> try_set_electric(const wcstring &key, const query_t &query, std::vector<wcstring> &val);
|
||||
maybe_t<int> try_set_electric(const wcstring &key, const query_t &query,
|
||||
std::vector<wcstring> &val);
|
||||
|
||||
/// Set a universal value.
|
||||
void set_universal(const wcstring &key, std::vector<wcstring> val, const query_t &query);
|
||||
|
|
|
@ -172,9 +172,7 @@ wcstring function_get_definition_file(const function_properties_t &props) {
|
|||
wcstring function_get_copy_definition_file(const function_properties_t &props) {
|
||||
return props.copy_definition_file ? *props.copy_definition_file : L"";
|
||||
}
|
||||
bool function_is_copy(const function_properties_t &props) {
|
||||
return props.is_copy;
|
||||
}
|
||||
bool function_is_copy(const function_properties_t &props) { return props.is_copy; }
|
||||
int function_get_definition_lineno(const function_properties_t &props) {
|
||||
return props.definition_lineno();
|
||||
}
|
||||
|
@ -182,7 +180,8 @@ int function_get_copy_definition_lineno(const function_properties_t &props) {
|
|||
return props.copy_definition_lineno;
|
||||
}
|
||||
|
||||
wcstring function_get_annotated_definition(const function_properties_t &props, const wcstring &name) {
|
||||
wcstring function_get_annotated_definition(const function_properties_t &props,
|
||||
const wcstring &name) {
|
||||
return props.annotated_definition(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ wcstring function_get_copy_definition_file(const function_properties_t &props);
|
|||
bool function_is_copy(const function_properties_t &props);
|
||||
int function_get_definition_lineno(const function_properties_t &props);
|
||||
int function_get_copy_definition_lineno(const function_properties_t &props);
|
||||
wcstring function_get_annotated_definition(const function_properties_t &props, const wcstring &name);
|
||||
wcstring function_get_annotated_definition(const function_properties_t &props,
|
||||
const wcstring &name);
|
||||
|
||||
/// \return the properties for a function, or nullptr if none, perhaps triggering autoloading.
|
||||
function_properties_ref_t function_get_props_autoload(const wcstring &name, parser_t &parser);
|
||||
|
|
|
@ -115,7 +115,6 @@ void highlight_shell(const wcstring &buffstr, std::vector<highlight_spec_t> &col
|
|||
const operation_context_t &ctx, bool io_ok = false,
|
||||
maybe_t<size_t> cursor = {});
|
||||
|
||||
|
||||
class parser_t;
|
||||
/// Wrapper around colorize(highlight_shell)
|
||||
wcstring colorize_shell(const wcstring &text, parser_t &parser);
|
||||
|
|
|
@ -825,7 +825,8 @@ bool input_mapping_set_t::erase(const wcstring &sequence, const wcstring &mode,
|
|||
}
|
||||
|
||||
bool input_mapping_set_t::get(const wcstring &sequence, const wcstring &mode,
|
||||
std::vector<wcstring> *out_cmds, bool user, wcstring *out_sets_mode) const {
|
||||
std::vector<wcstring> *out_cmds, bool user,
|
||||
wcstring *out_sets_mode) const {
|
||||
bool result = false;
|
||||
const auto &ml = user ? mapping_list_ : preset_mapping_list_;
|
||||
for (const input_mapping_t &m : ml) {
|
||||
|
|
|
@ -114,8 +114,8 @@ class input_mapping_set_t {
|
|||
|
||||
/// Gets the command bound to the specified key sequence in the specified mode. Returns true if
|
||||
/// it exists, false if not.
|
||||
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds, bool user,
|
||||
wcstring *out_sets_mode) const;
|
||||
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds,
|
||||
bool user, wcstring *out_sets_mode) const;
|
||||
|
||||
/// Returns all mapping names and modes.
|
||||
std::vector<input_mapping_name_t> get_names(bool user = true) const;
|
||||
|
|
|
@ -465,7 +465,8 @@ end_execution_reason_t parse_execution_context_t::run_for_statement(
|
|||
|
||||
auto &vars = parser->vars();
|
||||
int retval;
|
||||
retval = vars.set(for_var_name, ENV_LOCAL | ENV_USER, var ? var->as_list() : std::vector<wcstring>{});
|
||||
retval = vars.set(for_var_name, ENV_LOCAL | ENV_USER,
|
||||
var ? var->as_list() : std::vector<wcstring>{});
|
||||
assert(retval == ENV_OK);
|
||||
|
||||
trace_if_enabled(*parser, L"for", arguments);
|
||||
|
|
|
@ -70,7 +70,8 @@ rust::Box<WaitHandleStoreFFI> &parser_t::get_wait_handles_ffi() { return wait_ha
|
|||
|
||||
const rust::Box<WaitHandleStoreFFI> &parser_t::get_wait_handles_ffi() const { return wait_handles; }
|
||||
|
||||
int parser_t::set_var_and_fire(const wcstring &key, env_mode_flags_t mode, std::vector<wcstring> vals) {
|
||||
int parser_t::set_var_and_fire(const wcstring &key, env_mode_flags_t mode,
|
||||
std::vector<wcstring> vals) {
|
||||
int res = vars().set(key, mode, std::move(vals));
|
||||
if (res == ENV_OK) {
|
||||
event_fire(*this, *new_event_variable_set(key));
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
// PREFIX is defined at build time.
|
||||
static const std::vector<wcstring> kDefaultPath({L"/bin", L"/usr/bin", PREFIX L"/bin"});
|
||||
|
||||
static get_path_result_t path_get_path_core(const wcstring &cmd, const std::vector<wcstring> &pathsv) {
|
||||
static get_path_result_t path_get_path_core(const wcstring &cmd,
|
||||
const std::vector<wcstring> &pathsv) {
|
||||
const get_path_result_t noent_res{ENOENT, wcstring{}};
|
||||
get_path_result_t result{};
|
||||
|
||||
|
@ -173,7 +174,7 @@ wcstring_list_ffi_t path_get_paths_ffi(const wcstring &cmd, const parser_t &pars
|
|||
}
|
||||
|
||||
std::vector<wcstring> path_apply_cdpath(const wcstring &dir, const wcstring &wd,
|
||||
const environment_t &env_vars) {
|
||||
const environment_t &env_vars) {
|
||||
std::vector<wcstring> paths;
|
||||
if (dir.at(0) == L'/') {
|
||||
// Absolute path.
|
||||
|
|
|
@ -85,7 +85,7 @@ maybe_t<wcstring> path_get_cdpath(const wcstring &dir, const wcstring &wd,
|
|||
|
||||
/// Returns the given directory with all CDPATH components applied.
|
||||
std::vector<wcstring> path_apply_cdpath(const wcstring &dir, const wcstring &wd,
|
||||
const environment_t &env_vars);
|
||||
const environment_t &env_vars);
|
||||
|
||||
/// Returns the path resolved as an implicit cd command, or none() if none. This requires it to
|
||||
/// start with one of the allowed prefixes (., .., ~) and resolve to a directory.
|
||||
|
|
|
@ -1214,7 +1214,8 @@ void reader_data_t::paint_layout(const wchar_t *reason) {
|
|||
|
||||
// Apply any selection.
|
||||
if (data.selection.has_value()) {
|
||||
highlight_spec_t selection_color = {highlight_role_t::selection, highlight_role_t::selection};
|
||||
highlight_spec_t selection_color = {highlight_role_t::selection,
|
||||
highlight_role_t::selection};
|
||||
auto end = std::min(selection->stop, colors.size());
|
||||
for (size_t i = data.selection->start; i < end; i++) {
|
||||
colors.at(i) = selection_color;
|
||||
|
|
|
@ -259,7 +259,8 @@ std::vector<wcstring> split_string(const wcstring &val, wchar_t sep) {
|
|||
return out;
|
||||
}
|
||||
|
||||
std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps, size_t max_results) {
|
||||
std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps,
|
||||
size_t max_results) {
|
||||
std::vector<wcstring> out;
|
||||
size_t end = val.size();
|
||||
size_t pos = 0;
|
||||
|
@ -286,7 +287,8 @@ std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps
|
|||
return out;
|
||||
}
|
||||
|
||||
static wcstring join_strings_impl(const std::vector<wcstring> &vals, const wchar_t *sep, size_t seplen) {
|
||||
static wcstring join_strings_impl(const std::vector<wcstring> &vals, const wchar_t *sep,
|
||||
size_t seplen) {
|
||||
if (vals.empty()) return wcstring{};
|
||||
|
||||
// Reserve the size we will need.
|
||||
|
|
|
@ -138,7 +138,7 @@ std::vector<wcstring> split_string(const wcstring &val, wchar_t sep);
|
|||
/// except for the first. This is historical behavior.
|
||||
/// Example: split_string_tok(" a b c ", " ", 3) -> {"a", "b", " c "}
|
||||
std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps,
|
||||
size_t max_results = std::numeric_limits<size_t>::max());
|
||||
size_t max_results = std::numeric_limits<size_t>::max());
|
||||
|
||||
/// Join a list of strings by a separator character or string.
|
||||
wcstring join_strings(const std::vector<wcstring> &vals, wchar_t sep);
|
||||
|
|
Loading…
Reference in a new issue