added fisher as option to install.sh

This commit is contained in:
Hannes
2026-07-05 19:40:42 +02:00
parent dd8cb18988
commit 86ee065654
+68 -3
View File
@@ -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