mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 20:16:12 +08:00
Another formatting run
I really kinda hate how insistent clang-format is to have line breaks *IFF THE LINE IS TOO LONG*. Like... lemme just add a break if it looks better, will you? But it is the style at this time, so we shall tie an onion to our belt.
This commit is contained in:
parent
c21a3b9d71
commit
149a0b98af
|
@ -1,8 +1,8 @@
|
|||
# Completions for apk (Alpine Package Keeper)
|
||||
|
||||
# Package name
|
||||
complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(__fish_print_packages)" -d "Package"
|
||||
complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(__fish_print_packages --installed)" -d "Package"
|
||||
complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(__fish_print_packages)" -d Package
|
||||
complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(__fish_print_packages --installed)" -d Package
|
||||
|
||||
# Global options
|
||||
complete -f -c apk -s h -l help -d "Show help"
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
complete -c deno -n "__fish_use_subcommand" -s L -l log-level -d 'Set log level' -r -f -a "debug info"
|
||||
complete -c deno -n "__fish_use_subcommand" -s q -l quiet -d 'Suppress diagnostic output'
|
||||
complete -c deno -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
|
||||
complete -c deno -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "bundle" -d 'Bundle module and dependencies into single file'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "cache" -d 'Cache the dependencies'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "completions" -d 'Generate shell completions'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "doc" -d 'Show documentation for a module'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "eval" -d 'Eval script'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "fmt" -d 'Format source files'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "info" -d 'Show info about cache or info related to source file'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "install" -d 'Install script as an executable'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "lint" -d 'Lint source files'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "repl" -d 'Read Eval Print Loop'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "run" -d 'Run a program given a filename or url to the module. Use \'-\' as a filename to read from stdin.'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "test" -d 'Run tests'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "types" -d 'Print runtime TypeScript declarations'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "upgrade" -d 'Upgrade deno executable to given version'
|
||||
complete -c deno -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
|
||||
complete -c deno -n __fish_use_subcommand -s L -l log-level -d 'Set log level' -r -f -a "debug info"
|
||||
complete -c deno -n __fish_use_subcommand -s q -l quiet -d 'Suppress diagnostic output'
|
||||
complete -c deno -n __fish_use_subcommand -s h -l help -d 'Prints help information'
|
||||
complete -c deno -n __fish_use_subcommand -s V -l version -d 'Prints version information'
|
||||
complete -c deno -n __fish_use_subcommand -f -a bundle -d 'Bundle module and dependencies into single file'
|
||||
complete -c deno -n __fish_use_subcommand -f -a cache -d 'Cache the dependencies'
|
||||
complete -c deno -n __fish_use_subcommand -f -a completions -d 'Generate shell completions'
|
||||
complete -c deno -n __fish_use_subcommand -f -a doc -d 'Show documentation for a module'
|
||||
complete -c deno -n __fish_use_subcommand -f -a eval -d 'Eval script'
|
||||
complete -c deno -n __fish_use_subcommand -f -a fmt -d 'Format source files'
|
||||
complete -c deno -n __fish_use_subcommand -f -a info -d 'Show info about cache or info related to source file'
|
||||
complete -c deno -n __fish_use_subcommand -f -a install -d 'Install script as an executable'
|
||||
complete -c deno -n __fish_use_subcommand -f -a lint -d 'Lint source files'
|
||||
complete -c deno -n __fish_use_subcommand -f -a repl -d 'Read Eval Print Loop'
|
||||
complete -c deno -n __fish_use_subcommand -f -a run -d 'Run a program given a filename or url to the module. Use \'-\' as a filename to read from stdin.'
|
||||
complete -c deno -n __fish_use_subcommand -f -a test -d 'Run tests'
|
||||
complete -c deno -n __fish_use_subcommand -f -a types -d 'Print runtime TypeScript declarations'
|
||||
complete -c deno -n __fish_use_subcommand -f -a upgrade -d 'Upgrade deno executable to given version'
|
||||
complete -c deno -n __fish_use_subcommand -f -a help -d 'Prints this message or the help of the given subcommand(s)'
|
||||
complete -c deno -n "__fish_seen_subcommand_from bundle" -l cert -d 'Load certificate authority from PEM encoded file'
|
||||
complete -c deno -n "__fish_seen_subcommand_from bundle" -l importmap -d 'UNSTABLE: Load import map file'
|
||||
complete -c deno -n "__fish_seen_subcommand_from bundle" -s c -l config -d 'Load tsconfig.json configuration file'
|
||||
|
|
|
@ -14,13 +14,13 @@ function __fish_complete_variables
|
|||
end
|
||||
|
||||
function __fish_complete_function_event_handlers
|
||||
set -l handlers "fish_prompt" "When new prompt is about to be displayed" \
|
||||
"fish_command_not_found" "When command lookup fails" \
|
||||
"fish_preexec" "Before executing an interactive command" \
|
||||
"fish_postexec" "After executing an interactive command" \
|
||||
"fish_exit" "Right before fish exits" \
|
||||
"fish_cancel" "When commandline is cleared" \
|
||||
"fish_posterror" "After executing command with syntax errors"
|
||||
set -l handlers fish_prompt "When new prompt is about to be displayed" \
|
||||
fish_command_not_found "When command lookup fails" \
|
||||
fish_preexec "Before executing an interactive command" \
|
||||
fish_postexec "After executing an interactive command" \
|
||||
fish_exit "Right before fish exits" \
|
||||
fish_cancel "When commandline is cleared" \
|
||||
fish_posterror "After executing command with syntax errors"
|
||||
|
||||
printf "%s\t%s\n" $handlers
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
set PROG 'hikari'
|
||||
set PROG hikari
|
||||
|
||||
complete -c $PROG -f
|
||||
complete -c $PROG -s 'a' -F -d 'Specify autostart executable'
|
||||
complete -c $PROG -s 'c' -F -d 'Specify a configuration file'
|
||||
complete -c $PROG -f -s 'h' -d 'Show help message and quit'
|
||||
complete -c $PROG -f -s 'v' -d 'Show version and quit'
|
||||
complete -c $PROG -s a -F -d 'Specify autostart executable'
|
||||
complete -c $PROG -s c -F -d 'Specify a configuration file'
|
||||
complete -c $PROG -f -s h -d 'Show help message and quit'
|
||||
complete -c $PROG -f -s v -d 'Show version and quit'
|
||||
|
|
|
@ -265,7 +265,7 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
|
||||
# Notify terminals when $PWD changes (issue #906).
|
||||
# VTE based terminals, Terminal.app, iTerm.app (TODO), and foot support this.
|
||||
if test 0"$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = Apple_Terminal -a (string match -r '\d+' 0"$TERM_PROGRAM_VERSION") -ge 309 -o "$TERM" = "foot"
|
||||
if test 0"$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = Apple_Terminal -a (string match -r '\d+' 0"$TERM_PROGRAM_VERSION") -ge 309 -o "$TERM" = foot
|
||||
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
|
||||
if status --is-command-substitution || set -q INSIDE_EMACS
|
||||
return
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function funcsave --description "Save the current definition of all specified functions to file"
|
||||
set -l options 'h/help' 'd/directory='
|
||||
set -l options h/help 'd/directory='
|
||||
argparse -n funcsave $options -- $argv
|
||||
or return
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ except ImportError:
|
|||
try:
|
||||
from subprocess import DEVNULL
|
||||
except ImportError:
|
||||
DEVNULL = open(os.devnull, 'wb')
|
||||
DEVNULL = open(os.devnull, "wb")
|
||||
|
||||
# Whether we're Python 3
|
||||
IS_PY3 = sys.version_info[0] >= 3
|
||||
|
@ -999,7 +999,7 @@ def get_paths_from_man_locations():
|
|||
print(
|
||||
"Unable to get the manpath, falling back to %s." % ":".join(parent_paths),
|
||||
"Explictly set $MANPATH to fix this error.",
|
||||
file=sys.stderr
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
result = []
|
||||
|
|
|
@ -595,8 +595,7 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
|
|||
}
|
||||
const wcstring value = vals[i];
|
||||
const wcstring escaped_val = escape_string(value, ESCAPE_NO_QUOTED, STRING_STYLE_SCRIPT);
|
||||
streams.out.append_format(_(L"$%ls[%d]: |%ls|\n"), var_name, i + 1,
|
||||
escaped_val.c_str());
|
||||
streams.out.append_format(_(L"$%ls[%d]: |%ls|\n"), var_name, i + 1, escaped_val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
#include "color.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cwchar> // IWYU pragma: keep
|
||||
#include <cwctype>
|
||||
#include <algorithm>
|
||||
|
||||
#include "common.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
|
@ -172,28 +172,17 @@ struct named_color_t {
|
|||
|
||||
// Keep this sorted alphabetically
|
||||
static const std::vector<named_color_t> named_colors{
|
||||
{L"black", 0, {0x00, 0x00, 0x00}, false},
|
||||
{L"blue", 4, {0x00, 0x00, 0x80}, false},
|
||||
{L"brblack", 8, {0x80, 0x80, 0x80}, false},
|
||||
{L"brblue", 12, {0x00, 0x00, 0xFF}, false},
|
||||
{L"brbrown", 11, {0xFF, 0xFF, 0x00}, true},
|
||||
{L"brcyan", 14, {0x00, 0xFF, 0xFF}, false},
|
||||
{L"brgreen", 10, {0x00, 0xFF, 0x00}, false},
|
||||
{L"brgrey", 8, {0x55, 0x55, 0x55}, true},
|
||||
{L"brmagenta", 13, {0xFF, 0x00, 0xFF}, false},
|
||||
{L"brown", 3, {0x72, 0x50, 0x00}, true},
|
||||
{L"brpurple", 13, {0xFF, 0x00, 0xFF}, true},
|
||||
{L"brred", 9, {0xFF, 0x00, 0x00}, false},
|
||||
{L"brwhite", 15, {0xFF, 0xFF, 0xFF}, false},
|
||||
{L"bryellow", 11, {0xFF, 0xFF, 0x00}, false},
|
||||
{L"cyan", 6, {0x00, 0x80, 0x80}, false},
|
||||
{L"green", 2, {0x00, 0x80, 0x00}, false},
|
||||
{L"grey", 7, {0xE5, 0xE5, 0xE5}, true},
|
||||
{L"magenta", 5, {0x80, 0x00, 0x80}, false},
|
||||
{L"purple", 5, {0x80, 0x00, 0x80}, true},
|
||||
{L"red", 1, {0x80, 0x00, 0x00}, false},
|
||||
{L"white", 7, {0xC0, 0xC0, 0xC0}, false},
|
||||
{L"yellow", 3, {0x80, 0x80, 0x00}, false},
|
||||
{L"black", 0, {0x00, 0x00, 0x00}, false}, {L"blue", 4, {0x00, 0x00, 0x80}, false},
|
||||
{L"brblack", 8, {0x80, 0x80, 0x80}, false}, {L"brblue", 12, {0x00, 0x00, 0xFF}, false},
|
||||
{L"brbrown", 11, {0xFF, 0xFF, 0x00}, true}, {L"brcyan", 14, {0x00, 0xFF, 0xFF}, false},
|
||||
{L"brgreen", 10, {0x00, 0xFF, 0x00}, false}, {L"brgrey", 8, {0x55, 0x55, 0x55}, true},
|
||||
{L"brmagenta", 13, {0xFF, 0x00, 0xFF}, false}, {L"brown", 3, {0x72, 0x50, 0x00}, true},
|
||||
{L"brpurple", 13, {0xFF, 0x00, 0xFF}, true}, {L"brred", 9, {0xFF, 0x00, 0x00}, false},
|
||||
{L"brwhite", 15, {0xFF, 0xFF, 0xFF}, false}, {L"bryellow", 11, {0xFF, 0xFF, 0x00}, false},
|
||||
{L"cyan", 6, {0x00, 0x80, 0x80}, false}, {L"green", 2, {0x00, 0x80, 0x00}, false},
|
||||
{L"grey", 7, {0xE5, 0xE5, 0xE5}, true}, {L"magenta", 5, {0x80, 0x00, 0x80}, false},
|
||||
{L"purple", 5, {0x80, 0x00, 0x80}, true}, {L"red", 1, {0x80, 0x00, 0x00}, false},
|
||||
{L"white", 7, {0xC0, 0xC0, 0xC0}, false}, {L"yellow", 3, {0x80, 0x80, 0x00}, false},
|
||||
};
|
||||
|
||||
wcstring_list_t rgb_color_t::named_color_names() {
|
||||
|
@ -234,7 +223,8 @@ bool rgb_color_t::try_parse_named(const wcstring &str) {
|
|||
}
|
||||
if (c >= L'A' && c <= L'Z') {
|
||||
lowercase = str;
|
||||
std::transform(lowercase.value().begin(), lowercase.value().end(), lowercase.value().begin(), std::towlower);
|
||||
std::transform(lowercase.value().begin(), lowercase.value().end(),
|
||||
lowercase.value().begin(), std::towlower);
|
||||
search.name = lowercase.value().c_str();
|
||||
break;
|
||||
}
|
||||
|
@ -244,7 +234,8 @@ bool rgb_color_t::try_parse_named(const wcstring &str) {
|
|||
|
||||
auto result = std::lower_bound(named_colors_begin, named_colors_end, search,
|
||||
[&](const named_color_t &c1, const named_color_t &c2) {
|
||||
return wcscmp(c1.name, c2.name) < 0; });
|
||||
return wcscmp(c1.name, c2.name) < 0;
|
||||
});
|
||||
|
||||
if (result != named_colors_end && !(wcscmp(search.name, result->name) < 0)) {
|
||||
data.name_idx = result->idx;
|
||||
|
|
|
@ -648,7 +648,6 @@ bool unescape_string(const wchar_t *input, wcstring *output, unescape_flags_t es
|
|||
bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t escape_special,
|
||||
escape_string_style_t style = STRING_STYLE_SCRIPT);
|
||||
|
||||
|
||||
/// Write the given paragraph of output, redoing linebreaks to fit \p termsize.
|
||||
wcstring reformat_for_screen(const wcstring &msg, const termsize_t &termsize);
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ int fish_mkstemp_cloexec(char *);
|
|||
#error "No known thread local storage qualifier for this platform"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WCHAR_MAX
|
||||
/// This _should_ be defined by wchar.h, but e.g. OpenBSD doesn't.
|
||||
#define WCHAR_MAX INT_MAX
|
||||
|
|
|
@ -647,7 +647,8 @@ static void term_fix_modes(struct termios *modes) {
|
|||
modes->c_lflag &= ~ICANON; // turn off canonical mode
|
||||
modes->c_lflag &= ~ECHO; // turn off echo mode
|
||||
modes->c_lflag &= ~IEXTEN; // turn off handling of discard and lnext characters
|
||||
modes->c_oflag |= OPOST; // turn on "implementation-defined post processing" - this often changes how line breaks work.
|
||||
modes->c_oflag |= OPOST; // turn on "implementation-defined post processing" - this often
|
||||
// changes how line breaks work.
|
||||
|
||||
// Disable flow control in the shell. We don't want to be stopped.
|
||||
modes->c_iflag &= ~IXON;
|
||||
|
@ -697,8 +698,7 @@ static void term_steal() {
|
|||
// Copy the (potentially changed) terminal modes and use them from now on.
|
||||
struct termios modes;
|
||||
tcgetattr(STDIN_FILENO, &modes);
|
||||
std::memcpy(&tty_modes_for_external_cmds, &modes,
|
||||
sizeof tty_modes_for_external_cmds);
|
||||
std::memcpy(&tty_modes_for_external_cmds, &modes, sizeof tty_modes_for_external_cmds);
|
||||
// Turning off OPOST breaks output (staircase effect), we don't allow it.
|
||||
// See #7133.
|
||||
tty_modes_for_external_cmds.c_oflag |= OPOST;
|
||||
|
@ -709,7 +709,6 @@ static void term_steal() {
|
|||
tty_modes_for_external_cmds.c_iflag |= ICRNL;
|
||||
tty_modes_for_external_cmds.c_iflag |= INLCR;
|
||||
|
||||
|
||||
while (true) {
|
||||
if (tcsetattr(STDIN_FILENO, TCSANOW, &shell_modes) == -1) {
|
||||
if (errno == EIO) redirect_tty_output();
|
||||
|
|
|
@ -40,9 +40,7 @@ struct line_t {
|
|||
line_t() = default;
|
||||
|
||||
/// Clear the line's contents.
|
||||
void clear(void) {
|
||||
text.clear();
|
||||
}
|
||||
void clear(void) { text.clear(); }
|
||||
|
||||
/// Append a single character \p txt to the line with color \p c.
|
||||
void append(wchar_t c, highlight_spec_t color) { text.push_back({c, color}); }
|
||||
|
|
|
@ -19,9 +19,11 @@ default_histfile="../test/data/fish/fish_history"
|
|||
my_histfile = "../test/data/fish/my_history"
|
||||
env_histfile = "../test/data/fish/env_history"
|
||||
|
||||
|
||||
def grephistfile(line, file):
|
||||
sendline("grep '^" + line + "' " + file)
|
||||
|
||||
|
||||
# Verify that if we spawn fish with no fish_history env var it uses the
|
||||
# default file.
|
||||
expect_prompt
|
||||
|
@ -88,7 +90,7 @@ sendline("exit")
|
|||
sp.spawn.wait()
|
||||
|
||||
# Set the fish_history env var.
|
||||
os.environ["fish_history"] = 'env'
|
||||
os.environ["fish_history"] = "env"
|
||||
|
||||
# Spawn a new shell.
|
||||
sp = SpawnedProc()
|
||||
|
@ -116,4 +118,3 @@ expect_prompt()
|
|||
# block is inverted.
|
||||
grephistfile(hist_line, default_histfile)
|
||||
expect_prompt()
|
||||
|
||||
|
|
|
@ -65,7 +65,9 @@ expect_prompt("echo start2.*\r\necho start1")
|
|||
# ==========
|
||||
# Verify searching with a request for timestamps includes the timestamps.
|
||||
sendline("history search --show-time='# %F %T%n' --prefix 'echo start'")
|
||||
expect_prompt("# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start2; .*\r\n# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start1;")
|
||||
expect_prompt(
|
||||
"# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start2; .*\r\n# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start1;"
|
||||
)
|
||||
|
||||
# ==========
|
||||
# Verify explicit searching for an exact command returns just that command.
|
||||
|
@ -109,17 +111,23 @@ sendline("history delete -p 'echo hello'")
|
|||
expect_re("history delete -p 'echo hello'\r\n")
|
||||
expect_re("\[1\] echo hello AGAIN\r\n")
|
||||
expect_re("\[2\] echo hello again\r\n\r\n")
|
||||
expect_re('Enter nothing to cancel.*\r\nEnter "all" to delete all the matching entries\.\r\n')
|
||||
expect_re(
|
||||
'Enter nothing to cancel.*\r\nEnter "all" to delete all the matching entries\.\r\n'
|
||||
)
|
||||
expect_re("Delete which entries\? >")
|
||||
sendline("1")
|
||||
expect_re('Deleting history entry 1: "echo hello AGAIN"\r\n')
|
||||
|
||||
# Verify that the deleted history entry is gone and the other one that matched
|
||||
# the prefix search above is still there.
|
||||
sendline("echo count AGAIN (history search -e -C 'echo hello AGAIN' | wc -l | string trim)")
|
||||
sendline(
|
||||
"echo count AGAIN (history search -e -C 'echo hello AGAIN' | wc -l | string trim)"
|
||||
)
|
||||
expect_re("count AGAIN 0\r\n")
|
||||
|
||||
sendline("echo count again (history search -e -C 'echo hello again' | wc -l | string trim)")
|
||||
sendline(
|
||||
"echo count again (history search -e -C 'echo hello again' | wc -l | string trim)"
|
||||
)
|
||||
expect_re("count again 1\r\n")
|
||||
|
||||
# Verify that the $history var has the expected content.
|
||||
|
|
|
@ -38,7 +38,9 @@ expect_str("fish_postexec spotted")
|
|||
expect_prompt()
|
||||
|
||||
# Verify that the fish_kill_signal is set.
|
||||
sendline("functions -e postexec; function postexec --on-event fish_postexec; echo fish_kill_signal $fish_kill_signal; end")
|
||||
sendline(
|
||||
"functions -e postexec; function postexec --on-event fish_postexec; echo fish_kill_signal $fish_kill_signal; end"
|
||||
)
|
||||
expect_prompt()
|
||||
sendline("sleep 5")
|
||||
sleep(0.100)
|
||||
|
|
Loading…
Reference in New Issue
Block a user