#!/usr/bin/env fish # Install the J621 fish greeting: # * copies fish_greeting.fish into ~/.config/fish/functions/ # * creates ~/.config/j621Greeting/config.fish from the example (once) # * checks the tools it needs # # Usage: fish install.fish set -l here (path resolve (dirname (status --current-filename))) set -l functions_dir ~/.config/fish/functions set -l config_dir ~/.config/j621Greeting set -l problems 0 mkdir -p $functions_dir cp "$here/fish_greeting.fish" "$functions_dir/fish_greeting.fish" echo "Installed $functions_dir/fish_greeting.fish" mkdir -p $config_dir if test -f "$config_dir/config.fish" echo "Keeping existing $config_dir/config.fish" else cp "$here/config.example.fish" "$config_dir/config.fish" echo "Created $config_dir/config.fish — edit J621_BASE (and J621_TOKEN) there" end for tool in curl fastfetch file if not command -v $tool >/dev/null 2>&1 set problems 1 echo "Missing required tool: $tool" end end if not command -v curl >/dev/null 2>&1; and not command -v wget >/dev/null 2>&1 set problems 1 echo "Missing required tool: curl (or wget)" end for tool in gifsicle jq python3 if not command -v $tool >/dev/null 2>&1 echo "Optional tool not found: $tool (the greeting still works)" end end if test $problems -eq 0 echo echo "Done. Test it now with: fish_greeting" echo "Rating mode lives in ~/.config/fish/greeting_mode (0=NSFW, 1=SFW, 2=Questionable)." echo "The old gm-switch tool / .desktop launchers keep working — same file." else echo echo "Install the missing tools, then run: fish_greeting" end