From fb8ae04f80c3a129f789e7b718464d014508315f Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 14 Oct 2017 08:29:16 -0700 Subject: [PATCH] Rename $FISH_VERSION back to the original $version. Order is restored in the universe. Fixes #4414 --- doc_src/index.hdr.in | 2 +- share/config.fish | 2 -- share/functions/fish_indent.fish | 2 +- share/functions/fish_key_reader.fish | 2 +- share/functions/help.fish | 2 +- src/env.cpp | 4 ++-- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in index 433b1005e..9c9515102 100644 --- a/doc_src/index.hdr.in +++ b/doc_src/index.hdr.in @@ -866,7 +866,7 @@ The user can change the settings of `fish` by changing the values of certain var - `cmd_duration`, the runtime of the last command in milliseconds. -- `FISH_VERSION`, the version of the currently running fish +- `version`, the version of the currently running fish - `SHLVL`, the level of nesting of shells diff --git a/share/config.fish b/share/config.fish index d3d5318dd..c24039d7b 100644 --- a/share/config.fish +++ b/share/config.fish @@ -15,8 +15,6 @@ function __fish_default_command_not_found_handler echo "fish: Unknown command '$argv'" >&2 end -set -g version $FISH_VERSION - if status --is-interactive # The user has seemingly explicitly launched an old fish with too-new scripts installed. if not contains -- "string" (builtin -n) diff --git a/share/functions/fish_indent.fish b/share/functions/fish_indent.fish index 0af0d726d..403d598fb 100644 --- a/share/functions/fish_indent.fish +++ b/share/functions/fish_indent.fish @@ -1,7 +1,7 @@ # check if command fish_indent works and is the same version that # came with this fish. This will happen one time. command -sq fish_indent -and command fish_indent --version 2>&1 | string match -rq $FISH_VERSION +and command fish_indent --version 2>&1 | string match -rq $version # if alias doesn't define the function here, this is an autoloaded "nothing". # the command (if there is one) will be used by default. or alias fish_indent=(string escape $__fish_bin_dir/fish_indent) diff --git a/share/functions/fish_key_reader.fish b/share/functions/fish_key_reader.fish index c47baf183..04be1eb9a 100644 --- a/share/functions/fish_key_reader.fish +++ b/share/functions/fish_key_reader.fish @@ -1,7 +1,7 @@ # check if command fish_key_reader works and is the same version that # came with this fish. This will happen one time. command -sq fish_key_reader -and command fish_key_reader --version 2>&1 | string match -q -- $FISH_VERSION +and command fish_key_reader --version 2>&1 | string match -q -- $version # if alias doesn't define the function here, this is an autoloaded "nothing". # the command (if there is one) will be used by default. or alias fish_key_reader=(string escape $__fish_bin_dir/fish_key_reader) diff --git a/share/functions/help.fish b/share/functions/help.fish index 6734c7a1d..d49ed87a4 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -125,7 +125,7 @@ function help --description 'Show help for the fish shell' end else # Go to the web. Only include one dot in the version string - set -l version_string (echo $FISH_VERSION| cut -d . -f 1,2) + set -l version_string (echo $version| cut -d . -f 1,2) set page_url https://fishshell.com/docs/$version_string/$fish_help_page end diff --git a/src/env.cpp b/src/env.cpp index 50157cd2c..e84e13750 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -860,7 +860,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */) { wcstring(L"history"), wcstring(L"_"), wcstring(L"PWD"), - wcstring(L"FISH_VERSION") }) { + wcstring(L"version") }) { env_read_only.emplace(std::move(k)); // L"SHLVL" is readonly but will be inserted below after we increment it. }; @@ -926,7 +926,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */) { // Set up the version variable. wcstring version = str2wcstring(get_fish_version()); - env_set_one(L"FISH_VERSION", ENV_GLOBAL, version); + env_set_one(L"version", ENV_GLOBAL, version); // Set up SHLVL variable. const auto shlvl_var = env_get(L"SHLVL");