feat: copy non fish files to $fisher_path; close #456

This commit is contained in:
Jorge Bucaran 2018-10-07 02:17:09 +09:00
parent 2ead99f732
commit 7850f78e8a
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30

View file

@ -286,7 +286,8 @@ end
function _fisher_pkg_install -a pkg function _fisher_pkg_install -a pkg
set -l name (echo $pkg | command sed "s|^.*/||") set -l name (echo $pkg | command sed "s|^.*/||")
for source in $pkg/{functions,completions,conf.d,}/*.fish set -l files $pkg/{functions,completions,conf.d}/* $pkg/*.fish
for source in $files
set -l target (echo "$source" | command sed 's|^.*/||') set -l target (echo "$source" | command sed 's|^.*/||')
switch $source switch $source
case $pkg/conf.d\* case $pkg/conf.d\*
@ -305,35 +306,45 @@ function _fisher_pkg_install -a pkg
end end
echo "linking $target" | command sed "s|$HOME|~|" >&2 echo "linking $target" | command sed "s|$HOME|~|" >&2
command ln -f $source $target command ln -f $source $target
source $target >/dev/null 2>/dev/null switch $target
case \*.fish
source $target >/dev/null 2>/dev/null
end
end end
end end
function _fisher_pkg_uninstall -a pkg function _fisher_pkg_uninstall -a pkg
set -l name (echo $pkg | command sed "s|^.*/||") set -l name (echo $pkg | command sed "s|^.*/||")
for source in $pkg/{conf.d,completions,functions,}/*.fish set -l files $pkg/{conf.d,completions,functions}/* $pkg/*.fish
for source in $files
set -l target (echo "$source" | command sed 's|^.*/||') set -l target (echo "$source" | command sed 's|^.*/||')
set -l filename (echo "$target" | command sed 's|.fish||') set -l filename (echo "$target" | command sed 's|.fish||')
switch $source switch $source
case $pkg/conf.d\* case $pkg/conf.d\*
emit {$filename}_uninstall if test "$filename.fish" = "$target"
command rm -f $fisher_path/conf.d/$target emit "$filename"_uninstall
end
set target conf.d/$target
case $pkg/completions\* case $pkg/completions\*
command rm -f $fisher_path/completions/$target if functions -q "$filename"
complete -ec $filename complete -ec $filename
end
set target completions/$target
case $pkg/{,functions}\* case $pkg/{,functions}\*
switch $target switch $target
case uninstall.fish case uninstall.fish
source $source source $source
continue continue
case init.fish key_bindings.fish case init.fish key_bindings.fish
set target $fisher_path/conf.d/$name\_$target set target conf.d/$name\_$target
case \* case \*
set target $fisher_path/functions/$target set target functions/$target
end
if functions -q "$filename"
functions -e $filename
end end
command rm -f $target
functions -e $filename
end end
command rm -f $fisher_path/$target
end end
if not functions -q fish_prompt if not functions -q fish_prompt
source "$__fish_datadir/functions/fish_prompt.fish" source "$__fish_datadir/functions/fish_prompt.fish"