Remove, then install during `fisher update`, fix #600

Prompts' `fish_*.fish` files get removed during a
full update when you try to replace your existing
prompt with a new one.

For example, during a `fisher update`, if we install
`foo/new_prompt` first, and remove `foo/old_prompt`
afterm we could end up without a fish_prompt file.
pull/627/head
Jorge Bucaran 4 years ago
parent fa598b1ed6
commit 07b7fc79d7
No known key found for this signature in database
GPG Key ID: E54BA3C0E646DB30

@ -109,6 +109,25 @@ function fisher -a cmd -d "fish plugin manager"
command mkdir -p $fisher_path/{functions,completions,conf.d}
for plugin in $remove_plugins
set -l data $fisher_data/$plugin
test -e $plugin && set data $fisher_data/@$USER/(string replace --all --regex '^.*/' "" $plugin)
set -l funcs $data/*.fish
set -l files $data/{conf.d,functions,completions}/*
set -q files[1] && set files (string replace --all $data $fisher_path $files)
set -q funcs[1] && set files (string replace --all $data $fisher_path/functions $funcs) $files
for file in $data/conf.d/*.fish
emit (string replace --all --regex '^.*/|\.fish$' "" $file)_uninstall
end
printf "removing %s\n" $files >&2
command rm -rf $files $data
command rm -df (string split --right --max=1 / $data)[1] 2>/dev/null
functions -e (string replace --all --regex '^.*/|\.fish$' "" $files)
end
for plugin in $install_plugins $update_plugins
set -l data $fisher_data/$plugin
test -e $plugin && set data $fisher_data/@$USER/(string replace --all --regex '^.*/' "" $plugin)
@ -133,25 +152,6 @@ function fisher -a cmd -d "fish plugin manager"
end
end
for plugin in $remove_plugins
set -l data $fisher_data/$plugin
test -e $plugin && set data $fisher_data/@$USER/(string replace --all --regex '^.*/' "" $plugin)
set -l funcs $data/*.fish
set -l files $data/{conf.d,functions,completions}/*
set -q files[1] && set files (string replace --all $data $fisher_path $files)
set -q funcs[1] && set files (string replace --all $data $fisher_path/functions $funcs) $files
for file in $data/conf.d/*.fish
emit (string replace --all --regex '^.*/|\.fish$' "" $file)_uninstall
end
printf "removing %s\n" $files >&2
command rm -rf $files $data
command rm -df (string split --right --max=1 / $data)[1] 2>/dev/null
functions -e (string replace --all --regex '^.*/|\.fish$' "" $files)
end
functions -q fish_prompt || source $__fish_data_dir/functions/fish_prompt.fish
source $fisher_path/completions/fisher.fish 2>/dev/null

Loading…
Cancel
Save