mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 22:14:53 +00:00
Store the vendor directories in global variables
This lets us query them later, which helps with fish_delta
This commit is contained in:
parent
99bc112de0
commit
3ba1170ca5
1 changed files with 15 additions and 15 deletions
|
@ -50,24 +50,24 @@ else
|
||||||
set xdg_data_dirs $__fish_data_dir
|
set xdg_data_dirs $__fish_data_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l vendor_completionsdirs
|
set -g __fish_vendor_completionsdirs
|
||||||
set -l vendor_functionsdirs
|
set -g __fish_vendor_functionsdirs
|
||||||
set -l vendor_confdirs
|
set -g __fish_vendor_confdirs
|
||||||
# Don't load vendor directories when running unit tests
|
# Don't load vendor directories when running unit tests
|
||||||
if not set -q FISH_UNIT_TESTS_RUNNING
|
if not set -q FISH_UNIT_TESTS_RUNNING
|
||||||
set vendor_completionsdirs $__fish_user_data_dir/vendor_completions.d $xdg_data_dirs/vendor_completions.d
|
set __fish_vendor_completionsdirs $__fish_user_data_dir/vendor_completions.d $xdg_data_dirs/vendor_completions.d
|
||||||
set vendor_functionsdirs $__fish_user_data_dir/vendor_functions.d $xdg_data_dirs/vendor_functions.d
|
set __fish_vendor_functionsdirs $__fish_user_data_dir/vendor_functions.d $xdg_data_dirs/vendor_functions.d
|
||||||
set vendor_confdirs $__fish_user_data_dir/vendor_conf.d $xdg_data_dirs/vendor_conf.d
|
set __fish_vendor_confdirs $__fish_user_data_dir/vendor_conf.d $xdg_data_dirs/vendor_conf.d
|
||||||
|
|
||||||
# Ensure that extra directories are always included.
|
# Ensure that extra directories are always included.
|
||||||
if not contains -- $__extra_completionsdir $vendor_completionsdirs
|
if not contains -- $__extra_completionsdir $__fish_vendor_completionsdirs
|
||||||
set -a vendor_completionsdirs $__extra_completionsdir
|
set -a __fish_vendor_completionsdirs $__extra_completionsdir
|
||||||
end
|
end
|
||||||
if not contains -- $__extra_functionsdir $vendor_functionsdirs
|
if not contains -- $__extra_functionsdir $__fish_vendor_functionsdirs
|
||||||
set -a vendor_functionsdirs $__extra_functionsdir
|
set -a __fish_vendor_functionsdirs $__extra_functionsdir
|
||||||
end
|
end
|
||||||
if not contains -- $__extra_confdir $vendor_confdirs
|
if not contains -- $__extra_confdir $__fish_vendor_confdirs
|
||||||
set -a vendor_confdirs $__extra_confdir
|
set -a __fish_vendor_confdirs $__extra_confdir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ end
|
||||||
# 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 $__fish_config_dir/functions $__fish_sysconf_dir/functions $vendor_functionsdirs $__fish_data_dir/functions
|
set fish_function_path $__fish_config_dir/functions $__fish_sysconf_dir/functions $__fish_vendor_functionsdirs $__fish_data_dir/functions
|
||||||
else if not contains -- $__fish_data_dir/functions $fish_function_path
|
else if not contains -- $__fish_data_dir/functions $fish_function_path
|
||||||
set -a fish_function_path $__fish_data_dir/functions
|
set -a 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 $__fish_config_dir/completions $__fish_sysconf_dir/completions $vendor_completionsdirs $__fish_data_dir/completions $__fish_user_data_dir/generated_completions
|
set fish_complete_path $__fish_config_dir/completions $__fish_sysconf_dir/completions $__fish_vendor_completionsdirs $__fish_data_dir/completions $__fish_user_data_dir/generated_completions
|
||||||
else if not contains -- $__fish_data_dir/completions $fish_complete_path
|
else if not contains -- $__fish_data_dir/completions $fish_complete_path
|
||||||
set -a fish_complete_path $__fish_data_dir/completions
|
set -a fish_complete_path $__fish_data_dir/completions
|
||||||
end
|
end
|
||||||
|
@ -235,7 +235,7 @@ end
|
||||||
# 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 $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $vendor_confdirs/*.fish
|
for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $__fish_vendor_confdirs/*.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
|
||||||
|
|
Loading…
Reference in a new issue