cloudMux
gitlabCross-shell GitHub, Google Cloud, and Azure CLI shortcuts for Termux and desktop Linux.
clone
https://gitlab.com/bitzzdev/cloudMux.gitazure-clibashclicloud-toolsgcloudgh-cliproductivityshell-scriptstermuxzsh
#!/usr/bin/env bashset -euo pipefailsay() { printf '%s\n' "$*"; }warn() { printf 'cloudMux: %s\n' "$*" >&2; }script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"install_dir="${CLOUDMUX_INSTALL_DIR:-$HOME/.config/cloudmux}"temp_dir=""cleanup() {if [[ -n "$temp_dir" && -d "$temp_dir" ]]; thenrm -rf -- "$temp_dir"fi}trap cleanup EXITif [[ ! -f "$script_dir/bash/main.bash" ]]; thenrepo_url="${CLOUDMUX_REPO_URL:-}"if [[ -z "$repo_url" ]]; thenwarn "CLOUDMUX_REPO_URL is required when install.sh is run through curl."exit 2ficommand -v git >/dev/null 2>&1 || { warn "git is required for a remote install."; exit 127; }temp_dir="$(mktemp -d "${TMPDIR:-/tmp}/cloudmux-install-XXXXXX")"git clone --depth 1 "$repo_url" "$temp_dir/repo" >/dev/nullscript_dir="$temp_dir/repo"fiif [[ -n "${TERMUX_VERSION:-}" || "${PREFIX:-}" == *"/com.termux"* || "${PATH:-}" == *"/com.termux"* ]]; thenplatform=termuxelseplatform=linuxfisay "cloudMux installer"say "Platform: $platform"say "Install directory: $install_dir"for cli in gh gcloud az; doif command -v "$cli" >/dev/null 2>&1; thenprintf '%-8s installed (%s)\n' "$cli" "$(command -v "$cli")"elseprintf '%-8s missing\n' "$cli"fidoneinstall_missing_cli() {local cli="$1"if [[ "${CLOUDMUX_NO_INSTALL:-}" == "1" ]]; thenreturnfiread -r -p "Install missing $cli now? [y/N] " answer[[ "$answer" =~ ^[Yy]$ ]] || returnif [[ "$platform" == termux && "$cli" == gh ]]; thenpkg install -y ghelif [[ "$platform" == termux ]]; thenwarn "$cli is not offered by this installer's Termux package path. Use the official $cli installer."elif command -v pacman >/dev/null 2>&1; thencase "$cli" ingh) sudo pacman -S --needed github-cli ;;gcloud) warn "Install Google Cloud SDK from Google's official Linux instructions." ;;az) warn "Install Azure CLI from Microsoft's official Linux instructions." ;;esacelif command -v apt-get >/dev/null 2>&1; thencase "$cli" ingh) sudo apt-get install -y gh ;;gcloud) warn "Install Google Cloud SDK from Google's official Linux instructions." ;;az) warn "Install Azure CLI from Microsoft's official Linux instructions." ;;esacelif command -v dnf >/dev/null 2>&1; thencase "$cli" ingh) sudo dnf install -y gh ;;gcloud) warn "Install Google Cloud SDK from Google's official Linux instructions." ;;az) warn "Install Azure CLI from Microsoft's official Linux instructions." ;;esacelif command -v brew >/dev/null 2>&1; thencase "$cli" ingh) brew install gh ;;gcloud) brew install --cask google-cloud-sdk ;;az) brew install azure-cli ;;esacelsewarn "No supported package manager found for $cli."fi}for cli in gh gcloud az; docommand -v "$cli" >/dev/null 2>&1 || install_missing_cli "$cli"donemkdir -p "$install_dir" "$HOME/.bashrc.d" "$HOME/.config/fish/conf.d" "$HOME/.config/fish/functions"ln -sfn "$script_dir/bash" "$install_dir/bash"ln -sfn "$script_dir/fish" "$install_dir/fish"ln -sfn "$script_dir/bash/main.bash" "$HOME/.bashrc.d/cloudmux.bash"ln -sfn "$script_dir/fish/conf.d/cloudmux.fish" "$HOME/.config/fish/conf.d/cloudmux.fish"for file in "$script_dir"/fish/functions/*.fish; doln -sfn "$file" "$HOME/.config/fish/functions/$(basename "$file")"doneif [[ -f "$HOME/.bashrc" ]] && ! grep -Fqx 'source "$HOME/.bashrc.d/cloudmux.bash"' "$HOME/.bashrc"; thenprintf '\nsource "$HOME/.bashrc.d/cloudmux.bash"\n' >> "$HOME/.bashrc"fisay "Installed. Start a new shell, or run: source ~/.bashrc.d/cloudmux.bash"