#!/usr/bin/env bash gitpack_url="https://gitpack.htlc.io" cmd_help() { echo "Usage: gitpack " echo "" echo "Commands:" echo " gitpack install [app] - Install an app" echo " gitpack remove [app] - Remove an app" echo " gitpack run [app] % - Update and run an app. Additional arguments are passed through to the app" echo " gitpack update - Update gitpack itself" echo "" } ensure_gitpack_installed() { local bin_dir="$HOME/.local/bin" # Ensure ~/.local/bin exists mkdir -p "$bin_dir" # Ensure ~/.local/bin is in PATH if [[ ":$PATH:" != *":$bin_dir:"* ]]; then echo "Warning: $bin_dir is not in your PATH. Add it to your shell config." fi # Copy gitpack itself if not already installed if [[ ! -f "$bin_dir/gitpack" ]]; then curl fi } cmd_install() { ensure_gitpack_installed # clones the project repo # generates a file in .local/bin that calls gitpack run [app] echo "cmd_install: $1" } cmd_remove() { echo "cmd_remove: $1" } cmd_run() { echo "cmd_run: $1" } cmd_update() { echo "cmd_update" } case "$1" in help) cmd_help ;; install) cmd_install "$2" ;; remove) cmd_remove "$2" ;; run) cmd_run "$2" ;; update) cmd_update ;; *) echo "Unknown command: $1" echo "Run gitpack help for usage instructions" exit 1 ;; esac