mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +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?
|
// Are we currently in the process of autoloading this?
|
||||||
if (current_autoloading_.count(cmd) > 0) return none();
|
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); }
|
static bool cmd_needs_help(const wcstring &cmd) { return contains(help_builtins, cmd); }
|
||||||
|
|
||||||
/// Execute a builtin command
|
/// 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);
|
if (argv.empty()) return proc_status_t::from_exit_code(STATUS_INVALID_ARGS);
|
||||||
const wcstring &cmdname = argv.front();
|
const wcstring &cmdname = argv.front();
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ struct builtin_data_t {
|
||||||
|
|
||||||
bool builtin_exists(const wcstring &cmd);
|
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();
|
std::vector<wcstring> builtin_get_names();
|
||||||
wcstring_list_ffi_t builtin_get_names_ffi();
|
wcstring_list_ffi_t builtin_get_names_ffi();
|
||||||
|
|
|
@ -172,7 +172,8 @@ bool is_windows_subsystem_for_linux() {
|
||||||
#ifdef HAVE_BACKTRACE_SYMBOLS
|
#ifdef HAVE_BACKTRACE_SYMBOLS
|
||||||
// This function produces a stack backtrace with demangled function & method names. It is based on
|
// 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.
|
// 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];
|
void *callstack[128];
|
||||||
const int n_max_frames = sizeof(callstack) / sizeof(callstack[0]);
|
const int n_max_frames = sizeof(callstack) / sizeof(callstack[0]);
|
||||||
int n_frames = backtrace(callstack, n_max_frames);
|
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
|
// Bag of data to support expanding a command's arguments using custom completions, including
|
||||||
// the wrap chain.
|
// the wrap chain.
|
||||||
struct custom_arg_data_t {
|
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.
|
// The unescaped argument before the argument which is being completed, or empty if none.
|
||||||
wcstring previous_argument{};
|
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.
|
/// Try setting\p key as an electric or readonly variable.
|
||||||
/// \return an error code, or none() if not 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.
|
/// \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.
|
/// Set a universal value.
|
||||||
void set_universal(const wcstring &key, std::vector<wcstring> val, const query_t &query);
|
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) {
|
wcstring function_get_copy_definition_file(const function_properties_t &props) {
|
||||||
return props.copy_definition_file ? *props.copy_definition_file : L"";
|
return props.copy_definition_file ? *props.copy_definition_file : L"";
|
||||||
}
|
}
|
||||||
bool function_is_copy(const function_properties_t &props) {
|
bool function_is_copy(const function_properties_t &props) { return props.is_copy; }
|
||||||
return props.is_copy;
|
|
||||||
}
|
|
||||||
int function_get_definition_lineno(const function_properties_t &props) {
|
int function_get_definition_lineno(const function_properties_t &props) {
|
||||||
return props.definition_lineno();
|
return props.definition_lineno();
|
||||||
}
|
}
|
||||||
|
@ -182,7 +180,8 @@ int function_get_copy_definition_lineno(const function_properties_t &props) {
|
||||||
return props.copy_definition_lineno;
|
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);
|
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);
|
bool function_is_copy(const function_properties_t &props);
|
||||||
int function_get_definition_lineno(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);
|
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.
|
/// \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);
|
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,
|
const operation_context_t &ctx, bool io_ok = false,
|
||||||
maybe_t<size_t> cursor = {});
|
maybe_t<size_t> cursor = {});
|
||||||
|
|
||||||
|
|
||||||
class parser_t;
|
class parser_t;
|
||||||
/// Wrapper around colorize(highlight_shell)
|
/// Wrapper around colorize(highlight_shell)
|
||||||
wcstring colorize_shell(const wcstring &text, parser_t &parser);
|
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,
|
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;
|
bool result = false;
|
||||||
const auto &ml = user ? mapping_list_ : preset_mapping_list_;
|
const auto &ml = user ? mapping_list_ : preset_mapping_list_;
|
||||||
for (const input_mapping_t &m : ml) {
|
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
|
/// Gets the command bound to the specified key sequence in the specified mode. Returns true if
|
||||||
/// it exists, false if not.
|
/// it exists, false if not.
|
||||||
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds, bool user,
|
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds,
|
||||||
wcstring *out_sets_mode) const;
|
bool user, wcstring *out_sets_mode) const;
|
||||||
|
|
||||||
/// Returns all mapping names and modes.
|
/// Returns all mapping names and modes.
|
||||||
std::vector<input_mapping_name_t> get_names(bool user = true) const;
|
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();
|
auto &vars = parser->vars();
|
||||||
int retval;
|
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);
|
assert(retval == ENV_OK);
|
||||||
|
|
||||||
trace_if_enabled(*parser, L"for", arguments);
|
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; }
|
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));
|
int res = vars().set(key, mode, std::move(vals));
|
||||||
if (res == ENV_OK) {
|
if (res == ENV_OK) {
|
||||||
event_fire(*this, *new_event_variable_set(key));
|
event_fire(*this, *new_event_variable_set(key));
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
// PREFIX is defined at build time.
|
// PREFIX is defined at build time.
|
||||||
static const std::vector<wcstring> kDefaultPath({L"/bin", L"/usr/bin", PREFIX L"/bin"});
|
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{}};
|
const get_path_result_t noent_res{ENOENT, wcstring{}};
|
||||||
get_path_result_t result{};
|
get_path_result_t result{};
|
||||||
|
|
||||||
|
|
|
@ -1214,7 +1214,8 @@ void reader_data_t::paint_layout(const wchar_t *reason) {
|
||||||
|
|
||||||
// Apply any selection.
|
// Apply any selection.
|
||||||
if (data.selection.has_value()) {
|
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());
|
auto end = std::min(selection->stop, colors.size());
|
||||||
for (size_t i = data.selection->start; i < end; i++) {
|
for (size_t i = data.selection->start; i < end; i++) {
|
||||||
colors.at(i) = selection_color;
|
colors.at(i) = selection_color;
|
||||||
|
|
|
@ -259,7 +259,8 @@ std::vector<wcstring> split_string(const wcstring &val, wchar_t sep) {
|
||||||
return out;
|
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;
|
std::vector<wcstring> out;
|
||||||
size_t end = val.size();
|
size_t end = val.size();
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
@ -286,7 +287,8 @@ std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps
|
||||||
return out;
|
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{};
|
if (vals.empty()) return wcstring{};
|
||||||
|
|
||||||
// Reserve the size we will need.
|
// Reserve the size we will need.
|
||||||
|
|
Loading…
Reference in a new issue