aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions/funclnk.fish38
1 files changed, 26 insertions, 12 deletions
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