-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbcs.bash_completion
More file actions
115 lines (105 loc) · 4.09 KB
/
bcs.bash_completion
File metadata and controls
115 lines (105 loc) · 4.09 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# SPDX-License-Identifier: GPL-3.0-or-later
# bcs(1) bash completion — unified completer for `bcs` and the bcs* shim aliases
# shellcheck shell=bash
_bcs() {
local -- cur prev words cword
_init_completion || return
local -r subcommands='display template check codes generate help'
local -r models='
fast balanced thorough
claude-code claude-code:fast claude-code:balanced claude-code:thorough
claude-haiku-4-5 claude-sonnet-4-6 claude-opus-4-6
gemini-2.5-flash-lite gemini-2.5-flash gemini-2.5-pro
gpt-4.1-mini gpt-5.4-mini gpt-5.4
minimax-m2:cloud minimax-m2.7:cloud qwen3-coder:480b-cloud
deepseek-v3.1:671b-cloud gpt-oss:120b-cloud glm-5.1:cloud
'
local -r efforts='low medium high max'
local -r tiers='core recommended style'
local -r tiers_full='core recommended style disabled'
local -r template_types='minimal basic complete library'
# Resolve subcommand from invocation: shim name maps directly,
# `bcs` walks $words to find the first non-option token.
local -- subcmd=''
case ${1##*/} in
bcscheck) subcmd=check ;;
bcsdisplay) subcmd=display ;;
bcstemplate) subcmd=template ;;
bcscodes) subcmd=codes ;;
bcsgenerate) subcmd=generate ;;
bcs)
local -- i
for ((i = 1; i < cword; i+=1)); do
case ${words[i]} in
-*) continue ;;
*) subcmd=${words[i]}; break ;;
esac
done
if [[ -z "$subcmd" ]]; then
case $cur in
-*) mapfile -t COMPREPLY < <(compgen -W '-V --version -v --verbose -q --quiet -h --help' -- "$cur") ;;
*) mapfile -t COMPREPLY < <(compgen -W "$subcommands" -- "$cur") ;;
esac
return
fi
;;
*) return ;;
esac
case $subcmd in
display)
mapfile -t COMPREPLY < <(compgen -W '-c --cat -f --file -S --symlink -v --verbose -q --quiet -h --help' -- "$cur")
;;
template)
case $prev in
-t|--type) mapfile -t COMPREPLY < <(compgen -W "$template_types" -- "$cur"); return ;;
-o|--output) _filedir; return ;;
-n|--name|-d|--desc|-V|--version) return ;;
esac
mapfile -t COMPREPLY < <(compgen -W '-t --type -n --name -d --desc -V --version -o --output -x --executable -f --force -v --verbose -q --quiet -h --help' -- "$cur")
;;
check)
case $prev in
-e|--effort) mapfile -t COMPREPLY < <(compgen -W "$efforts" -- "$cur"); return ;;
-T|--tier|-M|--min-tier) mapfile -t COMPREPLY < <(compgen -W "$tiers" -- "$cur"); return ;;
-m|--model) mapfile -t COMPREPLY < <(compgen -W "$models" -- "$cur"); return ;;
esac
case $cur in
-*) mapfile -t COMPREPLY < <(compgen -W '-m --model -e --effort -s --strict -S --no-strict -T --tier -M --min-tier -j --json -D --debug -v --verbose -q --quiet -h --help' -- "$cur") ;;
*) _filedir ;;
esac
;;
codes)
case $prev in
-T|--tier) mapfile -t COMPREPLY < <(compgen -W "$tiers_full" -- "$cur"); return ;;
-E|--explain)
# Static placeholder list; codes are dynamic, so users may type any BCS####.
mapfile -t COMPREPLY < <(compgen -W '
BCS0101 BCS0106 BCS0107 BCS0109 BCS0110 BCS0202 BCS0206
BCS0301 BCS0302 BCS0303 BCS0406 BCS0407 BCS0410 BCS0411
BCS0501 BCS0503 BCS0504 BCS0606 BCS0604 BCS0801 BCS0803
BCS0901 BCS0906 BCS1001 BCS1002 BCS1004 BCS1006 BCS1007
BCS1101 BCS1103 BCS1104 BCS1202 BCS1204 BCS1206
' -- "$cur")
return
;;
esac
mapfile -t COMPREPLY < <(compgen -W '-T --tier -E --explain -p --plain -x --exclude-disabled -h --help' -- "$cur")
;;
generate)
case $prev in
-o|--output) _filedir; return ;;
esac
mapfile -t COMPREPLY < <(compgen -W '-o --output -v --verbose -q --quiet -h --help' -- "$cur")
;;
help)
mapfile -t COMPREPLY < <(compgen -W "$subcommands" -- "$cur")
;;
esac
}
complete -F _bcs bcs
complete -F _bcs bcscheck
complete -F _bcs bcsdisplay
complete -F _bcs bcstemplate
complete -F _bcs bcscodes
complete -F _bcs bcsgenerate
#fin