mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
Remove an overload in io, to prepare for Rust
This commit is contained in:
parent
85ae1861fa
commit
a848877e65
9 changed files with 20 additions and 23 deletions
|
@ -93,7 +93,7 @@ void builtin_wperror(const wchar_t *program_name, io_streams_t &streams) {
|
|||
if (err != nullptr) {
|
||||
const wcstring werr = str2wcstring(err);
|
||||
streams.err.append(werr);
|
||||
streams.err.push_back(L'\n');
|
||||
streams.err.push(L'\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,9 +501,7 @@ wcstring_list_t builtin_get_names() {
|
|||
return result;
|
||||
}
|
||||
|
||||
wcstring_list_ffi_t builtin_get_names_ffi() {
|
||||
return builtin_get_names();
|
||||
}
|
||||
wcstring_list_ffi_t builtin_get_names_ffi() { return builtin_get_names(); }
|
||||
|
||||
/// Insert all builtin names into list.
|
||||
void builtin_get_names(completion_list_t *list) {
|
||||
|
|
|
@ -490,7 +490,7 @@ static int validate_arg(parser_t &parser, const argparse_cmd_opts_t &opts, optio
|
|||
int retval = exec_subshell(opt_spec->validation_command, parser, cmd_output, false);
|
||||
for (const auto &output : cmd_output) {
|
||||
streams.err.append(output);
|
||||
streams.err.push_back(L'\n');
|
||||
streams.err.push(L'\n');
|
||||
}
|
||||
vars.pop();
|
||||
return retval;
|
||||
|
|
|
@ -164,7 +164,7 @@ void builtin_bind_t::key_names(bool all, io_streams_t &streams) {
|
|||
const wcstring_list_t names = input_terminfo_get_names(!all);
|
||||
for (const wcstring &name : names) {
|
||||
streams.out.append(name);
|
||||
streams.out.append(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ static void write_part(const wchar_t *begin, const wchar_t *end, int cut_at_curs
|
|||
} else {
|
||||
streams.out.append(begin, end - begin);
|
||||
}
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ maybe_t<int> builtin_complete(parser_t &parser, io_streams_t &streams, const wch
|
|||
wcstring prefix(wcstring(cmd) + L": -n '" + condition_string + L"': ");
|
||||
streams.err.append(*errors->at(i)->describe_with_prefix(
|
||||
condition_string, prefix, parser.is_interactive(), false));
|
||||
streams.err.push_back(L'\n');
|
||||
streams.err.push(L'\n');
|
||||
}
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ maybe_t<int> builtin_complete(parser_t &parser, io_streams_t &streams, const wch
|
|||
if (maybe_t<wcstring> err_text = parse_util_detect_errors_in_argument_list(comp, prefix)) {
|
||||
streams.err.append_format(L"%ls: %ls: contains a syntax error\n", cmd, comp);
|
||||
streams.err.append(*err_text);
|
||||
streams.err.push_back(L'\n');
|
||||
streams.err.push(L'\n');
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,14 +546,14 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
|
|||
if (env_var_t::flags_for(var_name) & env_var_t::flag_read_only) {
|
||||
streams.out.append(_(L" (read-only)\n"));
|
||||
} else
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
|
||||
for (size_t i = 0; i < vals.size(); i++) {
|
||||
if (vals.size() > 100) {
|
||||
if (i == 50) {
|
||||
// try to print a mid-line ellipsis because we are eliding lines not words
|
||||
streams.out.append(get_ellipsis_char() > 256 ? L"\u22EF" : get_ellipsis_str());
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
if (i >= 50 && i < vals.size() - 50) continue;
|
||||
}
|
||||
|
|
|
@ -454,10 +454,10 @@ maybe_t<int> builtin_status(parser_t &parser, io_streams_t &streams, const wchar
|
|||
const auto &var = parser.libdata().status_vars.command;
|
||||
if (!var.empty()) {
|
||||
streams.out.append(var);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
} else {
|
||||
streams.out.append(program_name);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ maybe_t<int> builtin_status(parser_t &parser, io_streams_t &streams, const wchar
|
|||
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
||||
const auto &var = parser.libdata().status_vars.commandline;
|
||||
streams.out.append(var);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
break;
|
||||
}
|
||||
case STATUS_FISH_PATH: {
|
||||
|
@ -482,19 +482,19 @@ maybe_t<int> builtin_status(parser_t &parser, io_streams_t &streams, const wchar
|
|||
auto real = wrealpath(path);
|
||||
if (real && waccess(*real, F_OK)) {
|
||||
streams.out.append(*real);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
} else {
|
||||
// realpath did not work, just append the path
|
||||
// - maybe this was obtained via $PATH?
|
||||
streams.out.append(path);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
} else {
|
||||
// This is a relative path, it depends on where fish's parent process
|
||||
// was when it started it and its idea of $PATH.
|
||||
// The best we can do is to print it directly and hope it works.
|
||||
streams.out.append(path);
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -775,9 +775,9 @@ static int string_join_maybe0(parser_t &parser, io_streams_t &streams, int argc,
|
|||
}
|
||||
if (nargs > 0 && !opts.quiet) {
|
||||
if (is_join0) {
|
||||
streams.out.push_back(L'\0');
|
||||
streams.out.push(L'\0');
|
||||
} else if (aiter.want_newline()) {
|
||||
streams.out.push_back(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1514,7 +1514,7 @@ static int string_repeat(parser_t &parser, io_streams_t &streams, int argc, cons
|
|||
}
|
||||
|
||||
if (!first && !opts.quiet) {
|
||||
streams.out.append(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
first = false;
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ static int string_repeat(parser_t &parser, io_streams_t &streams, int argc, cons
|
|||
|
||||
// Historical behavior is to never append a newline if all strings were empty.
|
||||
if (!opts.quiet && !opts.no_newline && !all_empty && aiter.want_newline()) {
|
||||
streams.out.append(L'\n');
|
||||
streams.out.push(L'\n');
|
||||
}
|
||||
|
||||
return all_empty ? STATUS_CMD_ERROR : STATUS_CMD_OK;
|
||||
|
|
3
src/io.h
3
src/io.h
|
@ -392,8 +392,7 @@ class output_stream_t : noncopyable_t, nonmovable_t {
|
|||
bool append(const wchar_t *s) { return append(s, std::wcslen(s)); }
|
||||
|
||||
/// Append a char.
|
||||
bool append(wchar_t s) { return append(&s, 1); }
|
||||
bool push_back(wchar_t c) { return append(c); }
|
||||
bool push(wchar_t s) { return append(&s, 1); }
|
||||
|
||||
// Append data from a narrow buffer, widening it.
|
||||
bool append_narrow_buffer(const separated_buffer_t &buffer);
|
||||
|
|
Loading…
Reference in a new issue