diff --git a/build_tools/pexpect_helper.py b/build_tools/pexpect_helper.py index 9be52772b..d7350fc43 100644 --- a/build_tools/pexpect_helper.py +++ b/build_tools/pexpect_helper.py @@ -34,7 +34,7 @@ def get_prompt_re(counter): (?:\x1b[\d\[KB(m]*)* # optional colors (?:\[.\]\ )? # optional vi mode prompt """ - + (r"prompt\ %d>" % counter) # prompt with counter + + (r"prompt\ %d>" % counter) # prompt with counter + r""" (?:\x1b[\d\[KB(m]*)* # optional colors """, diff --git a/share/completions/apk.fish b/share/completions/apk.fish index ebf269f97..5208fb8e7 100644 --- a/share/completions/apk.fish +++ b/share/completions/apk.fish @@ -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" diff --git a/share/completions/create_ap.fish b/share/completions/create_ap.fish index f8f858ea9..7b61b2468 100644 --- a/share/completions/create_ap.fish +++ b/share/completions/create_ap.fish @@ -32,7 +32,7 @@ complete -c create_ap -l stop -x -d 'Send stop command to an already running cre complete -c create_ap -l list-running -d 'Show already running create_ap processes' complete -c create_ap -l list-clients -x -d 'List clients connected to create_ap instance with given pid' complete -c create_ap -l mkconfig -F -d 'Store configs in file' -complete -c create_ap -l config -F -d 'Load configs from file' +complete -c create_ap -l config -F -d 'Load configs from file' complete -c create_ap -l no-dns -d 'Disable dnsmasq DNS server' complete -c create_ap -l no-dnsmasq -d 'Disable dnsmasq server completely' complete -c create_ap -s g -x -d 'IPv4 Gateway for the Access Point' diff --git a/share/completions/deno.fish b/share/completions/deno.fish index 68c195d8f..980563564 100644 --- a/share/completions/deno.fish +++ b/share/completions/deno.fish @@ -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' diff --git a/share/completions/function.fish b/share/completions/function.fish index 78fe8d171..18d648e3c 100644 --- a/share/completions/function.fish +++ b/share/completions/function.fish @@ -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 diff --git a/share/completions/hikari.fish b/share/completions/hikari.fish index a8dd5ff1c..71cc3affd 100644 --- a/share/completions/hikari.fish +++ b/share/completions/hikari.fish @@ -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' diff --git a/share/completions/xrandr.fish b/share/completions/xrandr.fish index 238941ae4..d2c5b7a69 100644 --- a/share/completions/xrandr.fish +++ b/share/completions/xrandr.fish @@ -35,7 +35,7 @@ complete -c xrandr -l setmonitor -d 'Define new monitor' -x complete -c xrandr -l delmonitor -d 'Delete monitor' -x complete -c xrandr -l listproviders -d 'Print all available providers' complete -c xrandr -l setprovideroutputsource -d 'Set source for a given provider' -complete -c xrandr -l setprovideroffloadsink -d 'Set provider for a given sink' +complete -c xrandr -l setprovideroffloadsink -d 'Set provider for a given sink' complete -c xrandr -l noprimary -d "Don't define a primary output" complete -c xrandr -l current -d 'Print current screen configuration' complete -c xrandr -l panning -d 'Set panning parameters' -x diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 78a9aa48c..d0d11c816 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -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 diff --git a/share/functions/funcsave.fish b/share/functions/funcsave.fish index 96f72df99..d81bcc118 100644 --- a/share/functions/funcsave.fish +++ b/share/functions/funcsave.fish @@ -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 @@ -8,11 +8,11 @@ function funcsave --description "Save the current definition of all specified fu return 0 end - if set -q _flag_directory - set funcdir $_flag_directory - else - set funcdir $__fish_config_dir/functions - end + if set -q _flag_directory + set funcdir $_flag_directory + else + set funcdir $__fish_config_dir/functions + end if not set -q argv[1] printf (_ "%ls: Expected at least %d args, got only %d\n") funcsave 1 0 diff --git a/share/functions/help.fish b/share/functions/help.fish index 2e027541d..c47619424 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -181,7 +181,7 @@ function help --description 'Show help for the fish shell' if string match -qr 'cmd\.exe$' -- $fish_browser[1] # The space before the /c is to prevent msys2 from expanding it to a path $fish_browser " /c" start $page_url - # If browser is known to be graphical, put into background + # If browser is known to be graphical, put into background else if contains -- $fish_browser[1] $graphical_browsers switch $fish_browser[1] case htmlview x-www-browser diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index 2393ebc24..a78da1f27 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -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 = [] diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index 43e900a1f..5b30cc43a 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -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()); } } diff --git a/src/builtin_test.cpp b/src/builtin_test.cpp index c8ce41671..a9b640e9f 100644 --- a/src/builtin_test.cpp +++ b/src/builtin_test.cpp @@ -559,7 +559,7 @@ unique_ptr test_parser::parse_args(const wcstring_list_t &args, wcst int narg = 0; int len_to_err = 0; wcstring commandline; - for (auto arg: args) { + for (auto arg : args) { if (narg > 0) { commandline.append(L" "); } diff --git a/src/color.cpp b/src/color.cpp index d111ad104..3b2ec95ca 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -3,12 +3,12 @@ #include "color.h" +#include #include #include #include #include // IWYU pragma: keep #include -#include #include "common.h" #include "fallback.h" // IWYU pragma: keep @@ -171,29 +171,18 @@ struct named_color_t { }; // Keep this sorted alphabetically -static const std::vector 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}, +static const std::vector 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}, }; 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; } @@ -243,8 +233,9 @@ 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; }); + [&](const named_color_t &c1, const named_color_t &c2) { + return wcscmp(c1.name, c2.name) < 0; + }); if (result != named_colors_end && !(wcscmp(search.name, result->name) < 0)) { data.name_idx = result->idx; diff --git a/src/common.h b/src/common.h index ed842a576..f2fce1b79 100644 --- a/src/common.h +++ b/src/common.h @@ -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); diff --git a/src/fallback.h b/src/fallback.h index 6bda9f6c7..7b845e1f6 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -36,16 +36,15 @@ int fish_mkstemp_cloexec(char *); /// thread_local support. #if HAVE_CX11_THREAD_LOCAL -# define FISH_THREAD_LOCAL thread_local -#elif defined (__GNUC__) -# define FISH_THREAD_LOCAL __thread -#elif defined (_MSC_VER) -# define FISH_THREAD_LOCAL __declspec(thread) -#else // !C++11 && !__GNUC__ && !_MSC_VER -# error "No known thread local storage qualifier for this platform" +#define FISH_THREAD_LOCAL thread_local +#elif defined(__GNUC__) +#define FISH_THREAD_LOCAL __thread +#elif defined(_MSC_VER) +#define FISH_THREAD_LOCAL __declspec(thread) +#else // !C++11 && !__GNUC__ && !_MSC_VER +#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 diff --git a/src/reader.cpp b/src/reader.cpp index 710a5cd90..9d10e88f6 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -642,12 +642,13 @@ static struct termios tty_modes_for_external_cmds; /// Restore terminal settings we care about, to prevent a broken shell. static void term_fix_modes(struct termios *modes) { - modes->c_iflag &= ~ICRNL; // disable mapping CR (\cM) to NL (\cJ) - modes->c_iflag &= ~INLCR; // disable mapping NL (\cJ) to CR (\cM) + modes->c_iflag &= ~ICRNL; // disable mapping CR (\cM) to NL (\cJ) + modes->c_iflag &= ~INLCR; // disable mapping NL (\cJ) to CR (\cM) 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(); diff --git a/src/screen.h b/src/screen.h index 04d1b721a..635d6717e 100644 --- a/src/screen.h +++ b/src/screen.h @@ -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}); } diff --git a/tests/pexpects/histfile.py b/tests/pexpects/histfile.py index 02a58dbb6..f6603ebf2 100644 --- a/tests/pexpects/histfile.py +++ b/tests/pexpects/histfile.py @@ -15,20 +15,22 @@ expect_prompt() # We're going to use three history files, including the default, to verify # that the fish_history variable works as expected. -default_histfile="../test/data/fish/fish_history" -my_histfile="../test/data/fish/my_history" -env_histfile="../test/data/fish/env_history" +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 # Verify that a command is recorded in the default history file. -cmd1="echo $fish_pid default histfile" -hist_line="- cmd: " + cmd1 +cmd1 = "echo $fish_pid default histfile" +hist_line = "- cmd: " + cmd1 sendline(cmd1) expect_prompt() @@ -43,8 +45,8 @@ expect_prompt() # Switch to a new history file and verify it is written to and the default # history file is not written to. -cmd2="echo $fish_pid my histfile" -hist_line="- cmd: " + cmd2 +cmd2 = "echo $fish_pid my histfile" +hist_line = "- cmd: " + cmd2 sendline("set fish_history my") expect_prompt() sendline(cmd2) @@ -60,8 +62,8 @@ grephistfile(hist_line, default_histfile) expect_prompt() # Switch back to the default history file. -cmd3="echo $fish_pid default histfile again" -hist_line="- cmd: " + cmd3 +cmd3 = "echo $fish_pid default histfile again" +hist_line = "- cmd: " + cmd3 sendline("set fish_history default") expect_prompt() sendline(cmd3) @@ -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() @@ -103,8 +105,8 @@ send, sendline, sleep, expect_prompt, expect_re, expect_str = ( expect_prompt() # Verify that the new fish shell is using the fish_history value for history. -cmd4="echo $fish_pid env histfile" -hist_line="- cmd: " + cmd4 +cmd4 = "echo $fish_pid env histfile" +hist_line = "- cmd: " + cmd4 sendline(cmd4) expect_prompt() @@ -116,4 +118,3 @@ expect_prompt() # block is inverted. grephistfile(hist_line, default_histfile) expect_prompt() - diff --git a/tests/pexpects/history.py b/tests/pexpects/history.py index 196be9850..c9bb5b47f 100644 --- a/tests/pexpects/history.py +++ b/tests/pexpects/history.py @@ -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. diff --git a/tests/pexpects/signals.py b/tests/pexpects/signals.py index 6919b6265..51e8acb32 100644 --- a/tests/pexpects/signals.py +++ b/tests/pexpects/signals.py @@ -26,7 +26,7 @@ sleep(0.010) sendline("jobs") expect_prompt("sleep.10") sendline("kill %1") -expect_prompt () +expect_prompt() # Verify that the fish_postexec handler is called after SIGINT. sendline("function postexec --on-event fish_postexec; echo fish_postexec spotted; end") @@ -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)