From 1ecc23f36620e625430e37bc12874d9a5e07c711 Mon Sep 17 00:00:00 2001 From: Pavel Egorov Date: Sat, 10 Jan 2026 04:10:43 +0300 Subject: [fish] add install_scripts function --- .config/fish/functions/install_scripts.fish | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .config/fish/functions/install_scripts.fish diff --git a/.config/fish/functions/install_scripts.fish b/.config/fish/functions/install_scripts.fish new file mode 100644 index 0000000..541b5bd --- /dev/null +++ b/.config/fish/functions/install_scripts.fish @@ -0,0 +1,31 @@ +#!/usr/bin/env fish + +function prepare_directories + if not test -d "$LOCAL_BIN" + mkdir "$LOCAL_BIN" + end + + if not test -d "$LOCAL_SCRIPTS" + echo "$LOCAL_SCRIPTS not found" + return 1 + end +end + +function install_scripts + prepare_directories + + for script in "$LOCAL_SCRIPTS"/* + if string match -q "#!*" (head -n1 "$script") + string match -rq '^(?.*)(?\.[^.]*)$' (basename "$script") + set symlink "$LOCAL_BIN/$filename" + + if test -L "$symlink" + echo "$filename" already exists + continue + end + + ln -s "$script" "$symlink" + echo "$filename symlinked" + end + end +end -- cgit v1.3