From 86ee065654f7996cb60a0d95942fca7ce1449668 Mon Sep 17 00:00:00 2001 From: Hannes Date: Sun, 5 Jul 2026 19:40:42 +0200 Subject: [PATCH] added fisher as option to install.sh --- install.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 78f40e5..3c97ea2 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash set -euo pipefail +CHOICE="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --fisher) CHOICE="fisher"; shift ;; + --omf) CHOICE="omf"; shift ;; + *) echo "Usage: $0 [--fisher|--omf]"; exit 1 ;; + esac +done + detect_pkg_manager() { if command -v apt &>/dev/null; then echo "apt" @@ -38,6 +48,42 @@ install_fish() { esac } +get_plugins_file() { + local user_plugins="$HOME/.config/fish/fish_plugins" + local repo_plugins="$(dirname "$0")/fish_plugins" + if [ -f "$user_plugins" ]; then + echo "$user_plugins" + elif [ -f "$repo_plugins" ]; then + echo "$repo_plugins" + else + echo "" + fi +} + +install_fisher_and_plugins() { + local fisher_path="$HOME/.config/fisher" + local fish_config_dir="$HOME/.config/fish" + + echo "Creating Fisher directory structure..." + mkdir -p "$fisher_path"/{functions,completions,conf.d,themes} + + echo "Symlinking themes directory..." + mkdir -p "$fish_config_dir" + ln -sf "$fisher_path/themes" "$fish_config_dir/themes" + + echo "Installing Fisher plugin manager..." + fish -c 'curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher' + + local plugins_file + plugins_file=$(get_plugins_file) + if [ -n "$plugins_file" ]; then + echo "Installing plugins from $(basename "$plugins_file")..." + fish -c "fisher install < $plugins_file" + else + echo "No fish_plugins file found. Skipping plugin installation." + fi +} + install_omf() { if [ ! -d "$HOME/.local/share/omf" ]; then echo "Installing Oh My Fish..." @@ -71,9 +117,28 @@ set_default_shell() { } main() { + if [ -z "$CHOICE" ]; then + while true; do + read -p "Select fish plugin manager (fisher/omf): " CHOICE + case "$CHOICE" in + fisher|omf) break ;; + *) echo "Please enter 'fisher' or 'omf'" ;; + esac + done + fi + install_fish - install_omf # add way to choose fisher and add ln -s $fisher_path/themes $__fish_config_dir/themes - install_bobthefish + + case "$CHOICE" in + fisher) + install_fisher_and_plugins + ;; + omf) + install_omf + install_bobthefish + ;; + esac + set_default_shell echo @@ -81,4 +146,4 @@ main() { echo "Log out and back in, or run: exec fish" } -main +main \ No newline at end of file