From 5dfaff42814f0d8d1231c1a8133247625bba528e Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 28 Mar 2020 09:39:12 +0100 Subject: [PATCH] Make "." a builtin as well Yeah, it's not going anywhere. This is one line in builtin.cpp vs 9 lines of script, most of which used to print an error that is never triggered. --- share/config.fish | 10 ---------- src/builtin.cpp | 1 + tests/checks/complete.fish | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/share/config.fish b/share/config.fish index 7340b5892..137d5c37e 100644 --- a/share/config.fish +++ b/share/config.fish @@ -154,16 +154,6 @@ end # in UTF-8 (with non-ASCII characters). __fish_set_locale -# "." alias for source; deprecated -function . -d 'Evaluate a file (deprecated, use "source")' --no-scope-shadowing --wraps source - if [ (count $argv) -eq 0 ] && isatty 0 - echo "source: using source via '.' is deprecated, and stdin doesn't work."\n"Did you mean 'source' or './'?" >&2 - return 1 - else - source $argv - end -end - # Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax. # This needs to be in share/config.fish because __fish_config_interactive is called after sourcing # config.fish, which might contain abbr calls. diff --git a/src/builtin.cpp b/src/builtin.cpp index 0e498f938..46670cd93 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -342,6 +342,7 @@ int builtin_false(parser_t &parser, io_streams_t &streams, wchar_t **argv) { // Functions that are bound to builtin_generic are handled directly by the parser. // NOTE: These must be kept in sorted order! static const builtin_data_t builtin_datas[] = { + {L".", &builtin_source, N_(L"Evaluate contents of file")}, {L":", &builtin_true, N_(L"Return a successful result")}, {L"[", &builtin_test, N_(L"Test a condition")}, {L"and", &builtin_generic, N_(L"Execute command if previous command succeeded")}, diff --git a/tests/checks/complete.fish b/tests/checks/complete.fish index f07d062a4..1d9b17bbe 100644 --- a/tests/checks/complete.fish +++ b/tests/checks/complete.fish @@ -62,7 +62,6 @@ complete # CHECK: complete {{.*}} # CHECK: complete {{.*}} # CHECK: complete {{.*}} -# CHECK: complete {{.*}} # Recursive calls to complete (see #3474) complete -c complete_test_recurse1 -xa '(echo recursing 1>&2; complete -C"complete_test_recurse1 ")'