From cd3f5e493ea8a9c88d82e459d8bbd21dd186a8af Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Mon, 16 Feb 2026 05:48:40 +0100 Subject: Enhance funclnk Also offer to link scripts for conf.d. modified: functions/funclnk.fish --- functions/funclnk.fish | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'functions/funclnk.fish') diff --git a/functions/funclnk.fish b/functions/funclnk.fish index 2e83b1b..10eadb0 100644 --- a/functions/funclnk.fish +++ b/functions/funclnk.fish @@ -1,20 +1,34 @@ -function funclnk --description "Synchronise fish functions symlinks" +function funclnk --description "Synchronise fish script symlinks" -set configdir "$HOME/Config" -set fishfuncdir "$__fish_config_dir/functions" +function _link_fish_scripts -a scriptpath -for script in (find $configdir -type f -path "*/.config/fish/functions/*" -name "*.fish") - set -l basescriptname (path basename $script) - - if test -e "$fishfuncdir/$basescriptname" - continue + if test (count $argv) -lt 1 + return 1 end - if ask "Add a symlink to $basescriptname to fish profile?" - pushd $fishfuncdir - ln -s (realpath --relative-to=. $script) - popd + set -f configdir "$HOME/Config" + set -f fishfuncdir "$__fish_config_dir/functions" + + for script in (find $configdir -type f -path $scriptpath -name "*.fish") + set -l basescriptname (path basename $script) + + if test -e "$fishfuncdir/$basescriptname" + continue + end + + if ask "Add a symlink to $basescriptname to fish profile?" + pushd $fishfuncdir + ln -s (realpath --relative-to=. $script) + popd + end end + + return 0 end +_link_fish_scripts '*/.config/fish/conf.d/*' +_link_fish_scripts '*/.config/fish/functions/*' + +functions -e _link_fish_scripts + end -- cgit v1.3.1