mirror of
https://github.com/robcholz/vibebox.git
synced 2026-08-17 18:17:12 +02:00
refactor: updated install format
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
APP=vibebox
|
APP=vibebox
|
||||||
REPO_URL="https://github.com/opencode-ai/vibebox"
|
REPO_URL="https://github.com/robcholz/vibebox"
|
||||||
REQUESTED_VERSION=${VERSION:-}
|
REQUESTED_VERSION=${VERSION:-}
|
||||||
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -113,66 +113,10 @@ print_message info "Using cargo install from ${ORANGE}${REPO_URL}${GREEN}..."
|
|||||||
|
|
||||||
cargo "${install_args[@]}"
|
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
|
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
|
||||||
case $current_shell in
|
print_message warning "Cargo bin directory is not on PATH."
|
||||||
fish)
|
print_message info "Add this to your shell profile if you can't run ${APP}:"
|
||||||
add_to_path "$config_file" "fish_add_path $INSTALL_DIR"
|
print_message info " export PATH=$INSTALL_DIR:\$PATH"
|
||||||
;;
|
|
||||||
*)
|
|
||||||
add_to_path "$config_file" "export PATH=$INSTALL_DIR:\$PATH"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then
|
if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user