-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathokc
More file actions
51 lines (42 loc) · 1.11 KB
/
okc
File metadata and controls
51 lines (42 loc) · 1.11 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
#!/usr/bin/env bash
set -euo pipefail
# Small wrapper to quickly run repository scripts without prefixing with "bash src/..."
# Usage:
# okc init -> bash src/init.sh
# okc app install <pkg> -> bash src/app.sh install <pkg>
# okc dotfiles sync -> bash src/dotfiles.sh sync
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$#" -lt 1 ]; then
cat <<EOF
Usage: okc <script> [args...]
Exemples:
okc init
okc app install firefox
okc dotfiles status
okc packages sync
Installez-le dans votre PATH et rendez-le exécutable:
chmod +x okc
ln -s "${SCRIPT_DIR}/okc" /usr/local/bin/okc
EOF
exit 1
fi
cmd="$1"
shift || true
case "$cmd" in
app|dotfiles|init|update|install_fonts|wifi_from_kdbx|setup_auto_update)
target="$SCRIPT_DIR/src/${cmd}.sh"
;;
packages)
# packages subcommand is handled by src/dotfiles.sh packages ...
target="$SCRIPT_DIR/src/dotfiles.sh"
;;
*)
# fallback: try src/<cmd>.sh
target="$SCRIPT_DIR/src/${cmd}.sh"
;;
esac
if [ ! -f "$target" ]; then
echo "Script introuvable: $target" >&2
exit 2
fi
exec bash "$target" "$@"