mirror of
https://github.com/jorgebucaran/fisher
synced 2024-07-02 23:11:48 +02:00
feat: copy non fish files to $fisher_path; close #456
This commit is contained in:
parent
2ead99f732
commit
7850f78e8a
27
fisher.fish
27
fisher.fish
|
@ -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,36 +306,46 @@ 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
|
||||||
|
switch $target
|
||||||
|
case \*.fish
|
||||||
source $target >/dev/null 2>/dev/null
|
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
|
end
|
||||||
command rm -f $target
|
if functions -q "$filename"
|
||||||
functions -e $filename
|
functions -e $filename
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
command rm -f $fisher_path/$target
|
||||||
|
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"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue