refactor: updated install format

This commit is contained in:
robcholz
2026-02-07 21:44:29 -05:00
parent 2ef37c15c3
commit 7205930333

64
install
View File

@@ -2,7 +2,7 @@
set -euo pipefail
APP=vibebox
REPO_URL="https://github.com/opencode-ai/vibebox"
REPO_URL="https://github.com/robcholz/vibebox"
REQUESTED_VERSION=${VERSION:-}
RED='\033[0;31m'
@@ -113,66 +113,10 @@ print_message info "Using cargo install from ${ORANGE}${REPO_URL}${GREEN}..."
cargo "${install_args[@]}"
add_to_path() {
local config_file=$1
local command=$2
if [[ -w $config_file ]]; then
echo -e "\n# vibebox" >> "$config_file"
echo "$command" >> "$config_file"
print_message info "Added ${ORANGE}${APP}${GREEN} to \$PATH in $config_file"
else
print_message warning "Manually add the directory to $config_file (or similar):"
print_message info " $command"
fi
}
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
current_shell=$(basename "$SHELL")
case $current_shell in
fish)
config_files="$HOME/.config/fish/config.fish"
;;
zsh)
config_files="$HOME/.zshrc $HOME/.zshenv $XDG_CONFIG_HOME/zsh/.zshrc $XDG_CONFIG_HOME/zsh/.zshenv"
;;
bash)
config_files="$HOME/.bashrc $HOME/.bash_profile $HOME/.profile $XDG_CONFIG_HOME/bash/.bashrc $XDG_CONFIG_HOME/bash/.bash_profile"
;;
ash)
config_files="$HOME/.ashrc $HOME/.profile /etc/profile"
;;
sh)
config_files="$HOME/.ashrc $HOME/.profile /etc/profile"
;;
*)
config_files="$HOME/.bashrc $HOME/.bash_profile $XDG_CONFIG_HOME/bash/.bashrc $XDG_CONFIG_HOME/bash/.bash_profile"
;;
esac
config_file=""
for file in $config_files; do
if [[ -f $file ]]; then
config_file=$file
break
fi
done
if [[ -z $config_file ]]; then
print_message error "No config file found for $current_shell. Checked files: ${config_files[@]}"
exit 1
fi
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
case $current_shell in
fish)
add_to_path "$config_file" "fish_add_path $INSTALL_DIR"
;;
*)
add_to_path "$config_file" "export PATH=$INSTALL_DIR:\$PATH"
;;
esac
print_message warning "Cargo bin directory is not on PATH."
print_message info "Add this to your shell profile if you can't run ${APP}:"
print_message info " export PATH=$INSTALL_DIR:\$PATH"
fi
if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then