Clean up $__fish_*dir variable names

Closes #4429
This commit is contained in:
Mahmoud Al-Qudsi 2018-03-12 08:34:20 -05:00
parent b42b562d06
commit c51abd04ff
12 changed files with 35 additions and 35 deletions

View File

@ -1235,12 +1235,12 @@ Note that functions cannot be started in the background. Functions that are stop
On startup, Fish evaluates a number of configuration files, which can be used to control the behavior of the shell. The location of these configuration variables is controlled by a number of environment variables, and their default or usual location is given below. On startup, Fish evaluates a number of configuration files, which can be used to control the behavior of the shell. The location of these configuration variables is controlled by a number of environment variables, and their default or usual location is given below.
Configuration files are evaluated in the following order: Configuration files are evaluated in the following order:
- Configuration shipped with fish, which should not be edited, in `$__fish_datadir/config.fish` (usually `/usr/share/fish/config.fish`). - Configuration shipped with fish, which should not be edited, in `$__fish_data_dir/config.fish` (usually `/usr/share/fish/config.fish`).
- System-wide configuration files, where administrators can include initialization that should be run for all users on the system - similar to `/etc/profile` for POSIX-style shells - in `$__fish_sysconfdir` (usually `/etc/fish/config.fish`); - System-wide configuration files, where administrators can include initialization that should be run for all users on the system - similar to `/etc/profile` for POSIX-style shells - in `$__fish_sysconf_dir` (usually `/etc/fish/config.fish`);
- Configuration snippets in files ending in `.fish`, in the directories: - Configuration snippets in files ending in `.fish`, in the directories:
- `$XDG_CONFIG_HOME/fish/conf.d` (by default, `~/.config/fish/conf.d/`) - `$XDG_CONFIG_HOME/fish/conf.d` (by default, `~/.config/fish/conf.d/`)
- `$__fish_sysconfdir/conf.d` (by default, `/etc/fish/conf.d`) - `$__fish_sysconf_dir/conf.d` (by default, `/etc/fish/conf.d`)
- `/usr/share/fish/vendor_conf.d` (set at compile time; by default, `$__fish_datadir/conf.d`) - `/usr/share/fish/vendor_conf.d` (set at compile time; by default, `$__fish_data_dir/conf.d`)
If there are multiple files with the same name in these directories, only the first will be executed. If there are multiple files with the same name in these directories, only the first will be executed.
They are executed in order of their filename, sorted (like globs) in a natural order (i.e. "01" sorts before "2"). They are executed in order of their filename, sorted (like globs) in a natural order (i.e. "01" sorts before "2").

View File

@ -1,4 +1,4 @@
if test -d "$__fish_datadir/man/man1/" if test -d "$__fish_data_dir/man/man1/"
complete -c help -x -a '(__fish_print_commands)' -d 'Help for this command' complete -c help -x -a '(__fish_print_commands)' -d 'Help for this command'
end end

View File

@ -25,7 +25,7 @@ if status --is-interactive
# These "XXX nostring" hacks were added for 2.3.1 # These "XXX nostring" hacks were added for 2.3.1
set_color --bold set_color --bold
echo "You appear to be trying to launch an old fish binary with newer scripts " echo "You appear to be trying to launch an old fish binary with newer scripts "
echo "installed into" (set_color --underline)"$__fish_datadir" echo "installed into" (set_color --underline)"$__fish_data_dir"
set_color normal set_color normal
echo -e "\nThis is an unsupported configuration.\n" echo -e "\nThis is an unsupported configuration.\n"
set_color yellow set_color yellow
@ -74,7 +74,7 @@ if set -q XDG_DATA_HOME
set userdatadir $XDG_DATA_HOME set userdatadir $XDG_DATA_HOME
end end
# __fish_datadir, __fish_sysconfdir, __fish_help_dir, __fish_bin_dir # __fish_data_dir, __fish_sysconf_dir, __fish_help_dir, __fish_bin_dir
# are expected to have been set up by read_init from fish.cpp # are expected to have been set up by read_init from fish.cpp
# Grab extra directories (as specified by the build process, usually for # Grab extra directories (as specified by the build process, usually for
@ -82,27 +82,27 @@ end
set -l __extra_completionsdir set -l __extra_completionsdir
set -l __extra_functionsdir set -l __extra_functionsdir
set -l __extra_confdir set -l __extra_confdir
if test -f $__fish_datadir/__fish_build_paths.fish if test -f $__fish_data_dir/__fish_build_paths.fish
source $__fish_datadir/__fish_build_paths.fish source $__fish_data_dir/__fish_build_paths.fish
end end
# Set up function and completion paths. Make sure that the fish # Set up function and completion paths. Make sure that the fish
# default functions/completions are included in the respective path. # default functions/completions are included in the respective path.
if not set -q fish_function_path if not set -q fish_function_path
set fish_function_path $configdir/fish/functions $__fish_sysconfdir/functions $__extra_functionsdir $__fish_datadir/functions set fish_function_path $configdir/fish/functions $__fish_sysconf_dir/functions $__extra_functionsdir $__fish_data_dir/functions
end end
if not contains -- $__fish_datadir/functions $fish_function_path if not contains -- $__fish_data_dir/functions $fish_function_path
set fish_function_path $fish_function_path $__fish_datadir/functions set fish_function_path $fish_function_path $__fish_data_dir/functions
end end
if not set -q fish_complete_path if not set -q fish_complete_path
set fish_complete_path $configdir/fish/completions $__fish_sysconfdir/completions $__extra_completionsdir $__fish_datadir/completions $userdatadir/fish/generated_completions set fish_complete_path $configdir/fish/completions $__fish_sysconf_dir/completions $__extra_completionsdir $__fish_data_dir/completions $userdatadir/fish/generated_completions
end end
if not contains -- $__fish_datadir/completions $fish_complete_path if not contains -- $__fish_data_dir/completions $fish_complete_path
set fish_complete_path $fish_complete_path $__fish_datadir/completions set fish_complete_path $fish_complete_path $__fish_data_dir/completions
end end
# #
@ -222,7 +222,7 @@ __fish_set_locale
# As last part of initialization, source the conf directories. # As last part of initialization, source the conf directories.
# Implement precedence (User > Admin > Extra (e.g. vendors) > Fish) by basically doing "basename". # Implement precedence (User > Admin > Extra (e.g. vendors) > Fish) by basically doing "basename".
set -l sourcelist set -l sourcelist
for file in $configdir/fish/conf.d/*.fish $__fish_sysconfdir/conf.d/*.fish $__extra_confdir/*.fish for file in $configdir/fish/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $__extra_confdir/*.fish
set -l basename (string replace -r '^.*/' '' -- $file) set -l basename (string replace -r '^.*/' '' -- $file)
contains -- $basename $sourcelist contains -- $basename $sourcelist
and continue and continue

View File

@ -70,7 +70,7 @@ function __fish_complete_man
# Fish commands are not given by apropos # Fish commands are not given by apropos
if not set -ql exclude_fish_commands if not set -ql exclude_fish_commands
set -l files $__fish_datadir/man/man1/*.1 set -l files $__fish_data_dir/man/man1/*.1
string replace -r '.*/([^/]+)\.1$' '$1\t1: fish command' -- $files string replace -r '.*/([^/]+)\.1$' '$1\t1: fish command' -- $files
end end
else else

View File

@ -131,7 +131,7 @@ function __fish_config_interactive -d "Initializations that should be performed
# We don't want to call `fish -c` since that is unnecessary and sources config.fish again. # We don't want to call `fish -c` since that is unnecessary and sources config.fish again.
# Hence we'll call python directly. # Hence we'll call python directly.
# c_m_p.py should work with any python version. # c_m_p.py should work with any python version.
set -l update_args -B $__fish_datadir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions' set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
if command -qs python3 if command -qs python3
python3 $update_args >/dev/null ^/dev/null & python3 $update_args >/dev/null ^/dev/null &
else if command -qs python2 else if command -qs python2

View File

@ -1,6 +1,6 @@
function __fish_print_commands --description "Print a list of documented fish commands" function __fish_print_commands --description "Print a list of documented fish commands"
if test -d $__fish_datadir/man/man1/ if test -d $__fish_data_dir/man/man1/
for file in $__fish_datadir/man/man1/**.1* for file in $__fish_data_dir/man/man1/**.1*
string replace -r '.*/' '' -- $file | string replace -r '.1(.gz)?$' '' string replace -r '.*/' '' -- $file | string replace -r '.1(.gz)?$' ''
end end
end end

View File

@ -11,7 +11,7 @@ function __fish_print_help --description "Print help message for the specified f
end end
# Do nothing if the file does not exist # Do nothing if the file does not exist
if not test -e "$__fish_datadir/man/man1/$item.1" -o -e "$__fish_datadir/man/man1/$item.1.gz" if not test -e "$__fish_data_dir/man/man1/$item.1" -o -e "$__fish_data_dir/man/man1/$item.1.gz"
return return
end end
@ -37,15 +37,15 @@ function __fish_print_help --description "Print help message for the specified f
set cols (math $cols - 4) # leave a bit of space on the right set cols (math $cols - 4) # leave a bit of space on the right
set rLL -rLL=$cols[1]n set rLL -rLL=$cols[1]n
end end
set -lx GROFF_TMAC_PATH $__fish_datadir/groff set -lx GROFF_TMAC_PATH $__fish_data_dir/groff
set -l mfish set -l mfish
if test -e $GROFF_TMAC_PATH/fish.tmac if test -e $GROFF_TMAC_PATH/fish.tmac
set mfish -mfish set mfish -mfish
end end
if test -e "$__fish_datadir/man/man1/$item.1" if test -e "$__fish_data_dir/man/man1/$item.1"
set help (nroff -c -man $mfish -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null) set help (nroff -c -man $mfish -t $rLL "$__fish_data_dir/man/man1/$item.1" ^/dev/null)
else if test -e "$__fish_datadir/man/man1/$item.1.gz" else if test -e "$__fish_data_dir/man/man1/$item.1.gz"
set help (gunzip -c "$__fish_datadir/man/man1/$item.1.gz" ^/dev/null | nroff -c -man $mfish -t $rLL ^/dev/null) set help (gunzip -c "$__fish_data_dir/man/man1/$item.1.gz" ^/dev/null | nroff -c -man $mfish -t $rLL ^/dev/null)
end end
# The original implementation trimmed off the top 5 lines and bottom 3 lines # The original implementation trimmed off the top 5 lines and bottom 3 lines

View File

@ -1,10 +1,10 @@
function fish_config --description "Launch fish's web based configuration" function fish_config --description "Launch fish's web based configuration"
set -lx __fish_bin_dir $__fish_bin_dir set -lx __fish_bin_dir $__fish_bin_dir
if command -sq python3 if command -sq python3
python3 "$__fish_datadir/tools/web_config/webconfig.py" $argv python3 "$__fish_data_dir/tools/web_config/webconfig.py" $argv
else if command -sq python2 else if command -sq python2
python2 "$__fish_datadir/tools/web_config/webconfig.py" $argv python2 "$__fish_data_dir/tools/web_config/webconfig.py" $argv
else if command -sq python else if command -sq python
python "$__fish_datadir/tools/web_config/webconfig.py" $argv python "$__fish_data_dir/tools/web_config/webconfig.py" $argv
end end
end end

View File

@ -9,7 +9,7 @@ function fish_update_completions --description "Update man-page based completion
end end
# Clean up old paths # Clean up old paths
set -l update_args -B $__fish_datadir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions' --progress set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions' --progress
if command -qs python3 if command -qs python3
python3 $update_args python3 $update_args
else if command -qs python2 else if command -qs python2

View File

@ -110,7 +110,7 @@ function help --description 'Show help for the fish shell'
# Prefer to use fish's man pages, to avoid # Prefer to use fish's man pages, to avoid
# the annoying useless "builtin" man page bash # the annoying useless "builtin" man page bash
# installs on OS X # installs on OS X
set -l man_arg "$__fish_datadir/man/man1/$fish_help_item.1" set -l man_arg "$__fish_data_dir/man/man1/$fish_help_item.1"
if test -f "$man_arg" if test -f "$man_arg"
man $man_arg man $man_arg
return return
@ -164,7 +164,7 @@ function help --description 'Show help for the fish shell'
# by using a custom style sheet. See https://github.com/fish-shell/fish-shell/issues/4170 # by using a custom style sheet. See https://github.com/fish-shell/fish-shell/issues/4170
set -l local_file 0 set -l local_file 0
if eval $fish_browser --version 2>/dev/null | string match -qr Lynx if eval $fish_browser --version 2>/dev/null | string match -qr Lynx
set fish_browser $fish_browser -lss={$__fish_datadir}/lynx.lss set fish_browser $fish_browser -lss={$__fish_data_dir}/lynx.lss
end end
eval $fish_browser $page_url eval $fish_browser $page_url
end end

View File

@ -12,7 +12,7 @@ function man --description "Format and display the on-line manual pages"
# Notice local exported copy of the variable. # Notice local exported copy of the variable.
set -lx MANPATH $manpath set -lx MANPATH $manpath
set -l fish_manpath (dirname $__fish_datadir)/fish/man set -l fish_manpath (dirname $__fish_data_dir)/fish/man
if test -d "$fish_manpath" -a -n "$MANPATH" if test -d "$fish_manpath" -a -n "$MANPATH"
set MANPATH $fish_manpath:$MANPATH set MANPATH $fish_manpath:$MANPATH
# Invoke man with this manpath, and we're done. # Invoke man with this manpath, and we're done.

View File

@ -63,8 +63,8 @@
#define DEFAULT_TERM2 "dumb" #define DEFAULT_TERM2 "dumb"
/// Some configuration path environment variables. /// Some configuration path environment variables.
#define FISH_DATADIR_VAR L"__fish_datadir" #define FISH_DATADIR_VAR L"__fish_data_dir"
#define FISH_SYSCONFDIR_VAR L"__fish_sysconfdir" #define FISH_SYSCONFDIR_VAR L"__fish_sysconf_dir"
#define FISH_HELPDIR_VAR L"__fish_help_dir" #define FISH_HELPDIR_VAR L"__fish_help_dir"
#define FISH_BIN_DIR L"__fish_bin_dir" #define FISH_BIN_DIR L"__fish_bin_dir"