Add back prompt_pwd to solve empty output problem

..by not manipulating path at all if we do not have
the tools to do so.

Tag changes with better comments.
This commit is contained in:
Aaron Gyes 2016-06-26 19:49:57 -07:00
parent a47b4b0e95
commit 81dee16d69
4 changed files with 31 additions and 18 deletions

View file

@ -21,9 +21,15 @@ if status --is-interactive
# Existance of string is a good pre-2.3.0 check. Could also check $FISH_VERSION in the future.
# This is a "launch", not an issue caused by autoloading during upgrades.
if not contains "string" (builtin -n)
# the string.fish message to `exec` will probably not help here, so this will that.
set -g __is_launched_without_string 1
# XXX nostring - fix old fish binaries with no string builtin.
# With fish 2.2.0, these newer scritps are going to later force on 24-bit color due
# to changes to in behavior with conditionals. Let's show a public serivec announcement
# before skipping the 24bit opportunity. The user has seemingly explicitly launched an old
# fish with too-new scripts installed.
# Remove this when it's safe to upgrade fish and we've solved fish-script conflicts.
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"

View file

@ -167,7 +167,6 @@ function __fish_config_interactive -d "Initializations that should be performed
commandline -f repaint
end
# Notify vte-based terminals when $PWD changes (issue #906)
if test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
function __update_vte_cwd --on-variable PWD --description 'Notify VTE of change to $PWD'

View file

@ -1,12 +1,19 @@
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
set -q argv[1]; and switch $argv[1]
set -q argv[1]
and switch $argv[1]
case -h --help
__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; or set -l fish_prompt_pwd_dir_length 1
set -q fish_prompt_pwd_dir_length
or set -l fish_prompt_pwd_dir_length 1
# Replace $HOME with "~"
set realhome ~

View file

@ -1,4 +1,5 @@
if not contains string (builtin -n)
# XXX nostring
function string
if not set -q __is_launched_without_string
if status --is-interactive