-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenscripts.sh
More file actions
executable file
·71 lines (61 loc) · 2.34 KB
/
openscripts.sh
File metadata and controls
executable file
·71 lines (61 loc) · 2.34 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# openscripts: single entrypoint that dispatches to the project's utility
# scripts under ./scripts. Each subcommand maps to one underlying script
# and forwards remaining arguments to it unchanged.
set -u
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Each entry: "name|relative path|description"
COMMANDS=(
"apache|scripts/apache-manage.sh|Manage Apache virtual hosts (sites + SSL)"
"django|scripts/django-manage.sh|Run Django management commands"
"macos-cleanup|scripts/macos-cleanup.sh|Selective macOS disk cleanup"
"ssh|scripts/ssh-manage.sh|Manage local SSH keys"
"ssh-keygen|scripts/ssh-keygen.sh|Generate a new SSH key (Ed25519/RSA) and update SSH config"
"ssh-agent|scripts/ssh-agent-manage.sh|Select an SSH key, start ssh-agent and load it into memory"
"ssh-keyremove|scripts/ssh-keyremove.sh|Remove an SSH key pair and clean SSH config / known_hosts"
"caesar|scripts/caesar-cipher.sh|Encrypt or decrypt text with the Caesar cipher"
"calc|scripts/scientific-calc.sh|Scientific calculator (arithmetic, trig, log, sqrt)"
"ai-skills|scripts/ai-skills-manage.sh|List and install AI skills"
"devtools-checkup|scripts/devtools-checkup.sh|Check installed dev tools (Git, Xcode, Node, Python, Ruby, Docker)"
"dotfiles|scripts/dotfiles-manage.sh|Backup/restore dev environment dotfiles (.zshrc, .gitconfig, .vimrc, ...)"
"install-lazydocker|scripts/installers/install-lazydocker.sh|Install lazydocker"
"install-openscripts|scripts/installers/install-openscripts.sh|Symlink openscripts to /usr/local/bin (install/uninstall/status)"
)
show_help() {
echo "Usage: $0 <command> [arguments...]"
echo
echo "Available commands:"
local entry name rest desc
for entry in "${COMMANDS[@]}"; do
name="${entry%%|*}"
rest="${entry#*|}"
desc="${rest#*|}"
printf " %-20s %s\n" "$name" "$desc"
done
echo
echo "Run '$0 help' to show this message."
}
if [ "$#" -lt 1 ]; then
show_help
exit 1
fi
cmd="$1"
shift
case "$cmd" in
-h | --help | help)
show_help
exit 0
;;
esac
for entry in "${COMMANDS[@]}"; do
name="${entry%%|*}"
rest="${entry#*|}"
path="${rest%%|*}"
if [ "$cmd" = "$name" ]; then
exec bash "$SCRIPT_DIR/$path" "$@"
fi
done
echo "Error: unknown command '$cmd'." >&2
echo
show_help
exit 1