mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
Replace $HOME with ~ in plugin state (#611)
Now it should be easier to sync dotfiles across machines that have different $HOME locations. Close #611
This commit is contained in:
parent
604f8ff1ea
commit
1662b799eb
1 changed files with 17 additions and 12 deletions
|
@ -134,11 +134,12 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
emit {$name}_uninstall
|
emit {$name}_uninstall
|
||||||
end
|
end
|
||||||
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
|
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
set --erase _fisher_plugins[$index]
|
set --erase _fisher_plugins[$index]
|
||||||
end
|
end
|
||||||
|
|
||||||
command rm -rf $$plugin_files_var
|
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
||||||
|
|
||||||
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
|
||||||
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
@ -176,14 +177,15 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||||
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files)
|
|
||||||
|
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
|
||||||
|
|
||||||
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
||||||
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
||||||
|
|
||||||
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var
|
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
|
|
||||||
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var)
|
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
|
||||||
source $file
|
source $file
|
||||||
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
||||||
emit {$name}_$event
|
emit {$name}_$event
|
||||||
|
@ -221,14 +223,17 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
## Migrations ##
|
if ! set --query _fisher_upgraded_to_4_4
|
||||||
function _fisher_fish_postexec --on-event fish_postexec
|
set --universal _fisher_upgraded_to_4_4
|
||||||
if functions --query _fisher_list
|
if functions --query _fisher_list
|
||||||
|
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
||||||
|
command rm -rf $XDG_DATA_HOME/fisher
|
||||||
|
functions --erase _fisher_{list,plugin_parse}
|
||||||
fisher update >/dev/null 2>/dev/null
|
fisher update >/dev/null 2>/dev/null
|
||||||
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
else
|
||||||
test -e $XDG_DATA_HOME/fisher && command rm -rf $XDG_DATA_HOME/fisher
|
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
||||||
functions --erase _fisher_list _fisher_plugin_parse
|
set $var (string replace -- ~ \~ $$var)
|
||||||
set --erase fisher_data
|
|
||||||
end
|
end
|
||||||
functions --erase _fisher_fish_postexec
|
functions --erase _fisher_fish_postexec
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue