#!/bin/sh set -eu #region logging setup if [ "${MISE_DEBUG-}" = "true" ] || [ "${MISE_DEBUG-}" = "1" ]; then debug() { echo "$@" >&2 } else debug() { : } fi if [ "${MISE_QUIET-}" = "1" ] || [ "${MISE_QUIET-}" = "true" ]; then info() { : } else info() { echo "$@" >&2 } fi error() { echo "$@" >&2 exit 1 } #endregion install_mise() { # Download and install mise using the main install script info "mise: downloading and installing mise..." if [ -x "$(command -v curl)" ]; then curl -fsSL https://mise.jdx.dev/install.sh | sh elif [ -x "$(command -v wget)" ]; then wget -qO- https://mise.jdx.dev/install.sh | sh else error "mise install requires curl or wget but neither is installed. Aborting." fi install_path="${MISE_INSTALL_PATH:-$HOME/.local/bin/mise}" if [ ! -f "$install_path" ]; then error "mise installation failed" fi info "mise: installed successfully to $install_path" } setup_fish_activation() { install_path="${MISE_INSTALL_PATH:-$HOME/.local/bin/mise}" fish_config_dir="$HOME/.config/fish" fish_config="$fish_config_dir/config.fish" # Check if activation is already set up if [ -f "$fish_config" ] && grep -qF "# added by https://mise.run/fish" "$fish_config"; then info "mise: fish activation already configured in $fish_config" return fi # Add activation to fish config info "mise: adding activation to $fish_config" if [ ! -d "$fish_config_dir" ]; then mkdir -p "$fish_config_dir" fi if [ ! -f "$fish_config" ]; then touch "$fish_config" fi # Add activation line echo "" >> "$fish_config" echo "$install_path activate fish | source # added by https://mise.run/fish" >> "$fish_config" info "mise: activation added to $fish_config" info "mise: restart your shell or run 'source ~/.config/fish/config.fish' to activate mise" info "mise: run 'mise doctor' to verify setup" } # Main execution install_mise setup_fish_activation info "" info "mise: setup complete! 🎉" info "mise: restart your fish shell or run 'source ~/.config/fish/config.fish' to start using mise"