Use fish -c string ... as the string fallback.

We can again drop the prompt_pwd check.
This commit is contained in:
Aaron Gyes 2016-07-01 00:00:53 -07:00
parent 84b08a4fe3
commit 431589a16a
3 changed files with 7 additions and 10 deletions

View file

@ -26,8 +26,6 @@ if status --is-interactive
# When executed on fish 2.2.0, the `else' block after this would
# force on 24-bit mode due to changes to in test behavior.
# These "XXX nostring" hacks were added for 2.3.1
# Let's explain to the user what's going on.
set_color --bold
echo "You appear to be trying to launch an old fish binary with newer scripts "
echo "installed into" (set_color --underline)"$__fish_datadir"
@ -37,7 +35,7 @@ if status --is-interactive
echo "You may need to uninstall and reinstall fish!"
set_color normal
# Remove this code when we've made it safer to upgrade fish.
else
else
# Enable truecolor/24-bit support for select terminals
if not set -q NVIM_LISTEN_ADDRESS # (Neovim will swallow the 24bit sequences, rendering text white)
and begin

View file

@ -5,11 +5,6 @@ function prompt_pwd --description "Print the current working directory, shortene
__fish_print_help prompt_pwd
return 0
end
if set -q $__is_launched_without_string
# There is no `string' builtin - do something sensible. XXX nostring
echo $PWD
return 0
end
# This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it
set -q fish_prompt_pwd_dir_length

View file

@ -1,5 +1,5 @@
# XXX nostring
if not contains string (builtin -n)
# XXX nostring
function string
if not set -q __is_launched_without_string
if status --is-interactive
@ -14,6 +14,10 @@ if not contains string (builtin -n)
set -g __is_launched_without_string 1
end
end
return 127
# We hope that in $__fish_bin_path is a newer fish that can do `string` for us.
set fish_user_paths $__fish_bin_dir $fish_user_paths
set string_cmd string \'$argv\'
fish -c "$string_cmd"
end
end