-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.sh
More file actions
executable file
·24 lines (24 loc) · 1.18 KB
/
Copy pathmenu.sh
File metadata and controls
executable file
·24 lines (24 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
set -euo pipefail
[[ $# = 0 ]] || { echo 'Usage: bash menu.sh' >&2; exit 2; }
tools=(pi dsh lmm codex claude-code cc-switch clash-verge-rev codewhale opencode)
if [[ -n ${TERMUX_VERSION:-} || ${PREFIX:-} == */com.termux/files/usr ]]; then tools=(pi dsh lmm codex claude-code codewhale); fi
dir=$(dirname -- "${BASH_SOURCE[0]:-}")
while true; do
printf '\nInstall / update\n'
for i in "${!tools[@]}"; do printf '%s %s\n' "$((i+1))" "${tools[i]}"; done
printf '0 Exit\n> '
read -r choice </dev/tty || exit 1
[[ $choice = 0 ]] && exit 0
[[ $choice =~ ^[1-9][0-9]?$ ]] || continue
((choice <= ${#tools[@]})) || continue
tool=${tools[choice-1]}
# Positional parameters also work with empty arguments under Bash 3 + nounset.
if [[ $tool = codewhale ]]; then set -- menu; else set --; fi
if [[ -n ${BASH_SOURCE[0]:-} && -f $dir/$tool.sh ]]; then
bash "$dir/$tool.sh" "$@" </dev/tty || printf 'Installation failed.\n' >&2
else
script=$(curl -fsSL "https://raw.githubusercontent.com/TokenNotIncluded/lmm-scripts/873bb8de2d9af00fb2a5fbb592b3da094e665271/$tool.sh") || continue
bash -c "$script" -- "$@" </dev/tty || printf 'Installation failed.\n' >&2
fi
done