Change fish_plugins to use ~ instead of $HOME for better portability (#792)

The fish_plugins file previously used absolute `$HOME` paths, making it non-portable across different machines. This change updates the file to use the ~ character for the home directory, improving compatibility and portability by avoiding hard-coded paths.
This commit is contained in:
mattmc3 2024-09-10 11:43:01 -04:00 committed by GitHub
parent 2efd33ccd0
commit 63c18183b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,7 +29,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
set --local old_plugins $_fisher_plugins
set --local new_plugins
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~)
if ! set --query argv[2]
if test "$cmd" != update
@ -206,7 +206,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
end
printf "%s\n" $commit_plugins >$fish_plugins
string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins
else
set --erase _fisher_plugins
command rm -f $fish_plugins