This commit is contained in:
mike
2025-12-11 01:21:46 +01:00
parent ac343050a8
commit 43a408d962
10 changed files with 108 additions and 68 deletions

View File

@@ -1,12 +1,12 @@
#!/bin/sh
# finish.sh installer
# Usage: curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash
# Usage: curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash
set -e
ACSH_VERSION="v0.5.0"
BRANCH_OR_VERSION=${1:-main}
REPO_URL="https://git.appmodel.nl/Tour/finish/raw/branch"
REPO_URL="https://git.appmodel.nl/tour/finish/raw/branch"
# Colors
RED='\033[0;31m'
@@ -121,6 +121,11 @@ main() {
echo ""
# Determine installation location
# Prefer local user install at ~/.local/bin, create it if missing
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
fi
if [ -d "$HOME/.local/bin" ]; then
INSTALL_LOCATION="$HOME/.local/bin/finish"
# Add to PATH if not already there
@@ -134,8 +139,8 @@ main() {
elif [ -w "/usr/local/bin" ]; then
INSTALL_LOCATION="/usr/local/bin/finish"
else
echo_error "Cannot write to /usr/local/bin and $HOME/.local/bin doesn't exist"
echo "Please create $HOME/.local/bin or run with sudo"
echo_error "Cannot determine installation location"
echo "Please ensure either $HOME/.local/bin exists and is writable, or run with sudo for /usr/local/bin"
exit 1
fi
@@ -154,6 +159,13 @@ main() {
echo_green "✓ Installed to $INSTALL_LOCATION"
echo ""
# Ensure current shell PATH includes the install dir for immediate use
INSTALL_DIR="$(dirname "$INSTALL_LOCATION")"
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*) export PATH="$INSTALL_DIR:$PATH" ;;
esac
# Check bash-completion
if [ "$SHELL_TYPE" = "bash" ]; then
if ! command -v _init_completion > /dev/null 2>&1; then
@@ -188,7 +200,7 @@ main() {
echo ""
echo " 3. Start using by pressing Tab twice after any command"
echo ""
echo "Documentation: https://git.appmodel.nl/Tour/finish"
echo "Documentation: https://git.appmodel.nl/tour/finish"
else
echo_error "Installation failed. Please check the output above."
exit 1