* typo whisper-cpp
[t2sde.git] / t2
blob375ab01ea6547fce7105a3551b0f03e39b9234fe
1 #!/usr/bin/env bash
2 # --- T2-COPYRIGHT-BEGIN ---
3 # t2/t2
4 # Copyright (C) 2023 - 2025 The T2 SDE Project
5 # SPDX-License-Identifier: GPL-2.0
6 # --- T2-COPYRIGHT-END ---
8 top=$(readlink -f $0)
9 [ "$top" ] && cd ${top%/*}
11 declare -A commands
13 commands["bootstrap"]="bootstrap vital deps on homebrew systems"
14 commands["config"]="creates a target configuration profile"
15 commands["install"]="installs a package and its dependencies"
16 commands["uninstall"]="uninstalls a package from the system"
17 commands["download"]="downloads assets of a package"
18 commands["build"]="builds a package from source"
19 commands["build-target"]="builds a whole target sandbox"
20 commands["clean"]="clean-up build artifacts"
21 commands["create"]="create a package from external URLs"
22 commands["create-iso"]="create an ISO after a target build"
23 commands["list-errors"]="list build target errors"
24 commands["commit"]="commit changes to the T2 source tree"
25 commands["find"]="find package based on meta data"
26 commands["update"]="update a package meta-data version"
27 commands["upgrade"]="upgrade the system install packages"
28 commands["up|pull"]="update / pull t2 source tree changes"
30 usage() {
31 cat << EOT
32 Usage: t2 command <options>
33 Commands:
34 EOT
36 for i in "${!commands[@]}"; do
37 local desc=${commands[$i]}
38 local n=$((${#i} + 2))
39 local t="\t\t"
40 [ $n -gt 7 ] && t="\t"
41 echo -e " $i$t$desc"
42 done | sort
44 cat << EOT
45 Options:
46 -v, --verbose verbose operation
47 -c, --cfg config name
48 EOT
49 exit 1
52 # convert modern --* args to backward-compat single-dash -*
53 # and save the first non option as cmd
54 cmd=
55 declare -a args
56 for a; do
57 a=(${a/--/-})
58 [[ -z "$cmd" && "$a" = [^-]* && ( ${#args[*]} -eq 0 || ${args[-1]} != "-cfg" ) ]] && cmd="$a" && continue
59 args+=($a)
60 done
62 case "$cmd" in
63 conf|config) exec scripts/Config "${args[@]}" ;;
64 bootstrap) exec scripts/Bootstrap "${args[@]}" ;;
65 build) exec scripts/Build-Pkg "${args[@]}" ;;
66 build-target) exec scripts/Build-Target "${args[@]}" ;;
67 clean) exec scripts/Cleanup "${args[@]}" ;;
68 create) exec scripts/Create-Pkg "${args[@]}" ;;
69 create-iso) exec scripts/Create-ISO "${args[@]}" ;;
70 list-errors) exec scripts/Create-ErrList "${args[@]}" ;;
71 commit|ci) exec scripts/Commit "${args[@]}" ;;
72 download|dl) exec scripts/Download "${args[@]}" ;;
73 find) exec scripts/Find-Pkg "${args[@]}" ;;
74 install|inst) exec scripts/Emerge-Pkg "${args[@]}" ;;
75 update) exec scripts/Update-Pkg "${args[@]}" ;;
76 upgrade) exec scripts/Emerge-Pkg -system "${args[@]}" ;;
77 uninstall) exec mine -r "${args[@]}" ;;
78 up|pull) if [ -e .git ]; then exec git pull; else exec svn up; fi ;;
79 *) usage ;;
80 esac