mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-10 12:05:53 +00:00
- Update CLIInstaller to install both vt script and vibetunnel binary - Remove duplicate replacement dialog for better UX - Check versions of both files and use lowest version for updates - Prioritize finding vibetunnel in same directory as vt script - Bump vt version to 1.0.6 - Add comprehensive CLI versioning documentation
53 lines
No EOL
2 KiB
Bash
Executable file
53 lines
No EOL
2 KiB
Bash
Executable file
#!/bin/bash
|
|
# vt - VibeTunnel CLI wrapper
|
|
# Simple bash wrapper that passes through to vibetunnel with shell expansion
|
|
|
|
VERSION="1.0.6"
|
|
|
|
# Handle version flag
|
|
if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
|
|
echo "vt version $VERSION"
|
|
exit 0
|
|
fi
|
|
|
|
# Find vibetunnel binary (prefer Go implementation)
|
|
# First check in the same directory as this script (when installed together)
|
|
SCRIPT_DIR="$(dirname "$0")"
|
|
if [ -x "$SCRIPT_DIR/vibetunnel" ]; then
|
|
VIBETUNNEL="$SCRIPT_DIR/vibetunnel"
|
|
elif command -v vibetunnel >/dev/null 2>&1; then
|
|
# Check if vibetunnel is in PATH
|
|
VIBETUNNEL="vibetunnel"
|
|
elif [ -x "/usr/local/bin/vibetunnel" ]; then
|
|
VIBETUNNEL="/usr/local/bin/vibetunnel"
|
|
elif [ -x "/Users/steipete/Projects/vibetunnel/linux/build/vibetunnel" ]; then
|
|
VIBETUNNEL="/Users/steipete/Projects/vibetunnel/linux/build/vibetunnel"
|
|
elif [ -x "./vibetunnel" ]; then
|
|
VIBETUNNEL="./vibetunnel"
|
|
elif [ -x "/Applications/VibeTunnel.app/Contents/Resources/tty-fwd" ]; then
|
|
# Fallback to Rust implementation if Go version not found
|
|
VIBETUNNEL="/Applications/VibeTunnel.app/Contents/Resources/tty-fwd"
|
|
else
|
|
echo >&2 "Error: vibetunnel not found. Please install it first."
|
|
exit 1
|
|
fi
|
|
|
|
# Use the user's shell to resolve aliases and run commands
|
|
USER_SHELL="${SHELL:-/bin/bash}"
|
|
SHELL_NAME=$(basename "$USER_SHELL")
|
|
|
|
# Execute through shell to resolve aliases, functions, and builtins
|
|
case "$SHELL_NAME" in
|
|
zsh)
|
|
# For zsh, use interactive mode to get aliases
|
|
exec "$VIBETUNNEL" --do-not-allow-column-set=true -- "$USER_SHELL" -i -c "$(printf '%q ' "$@")"
|
|
;;
|
|
bash)
|
|
# For bash, expand aliases in non-interactive mode
|
|
exec "$VIBETUNNEL" --do-not-allow-column-set=true -- "$USER_SHELL" -c "shopt -s expand_aliases; source ~/.bashrc 2>/dev/null || source ~/.bash_profile 2>/dev/null || true; $(printf '%q ' "$@")"
|
|
;;
|
|
*)
|
|
# Generic shell handling
|
|
exec "$VIBETUNNEL" --do-not-allow-column-set=true -- "$USER_SHELL" -c "$(printf '%q ' "$@")"
|
|
;;
|
|
esac |