Skip to content

Commit 062815d

Browse files
Merge pull request #96 from bsdlme/main
Add completions for ZSH and Bash
2 parents 9ad012f + 8a90c37 commit 062815d

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

completions/bash/framework_tool

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
3+
# Bash completion for framework_tool
4+
5+
_framework_tool() {
6+
local options
7+
options=(
8+
"--flash-gpu-descriptor"
9+
"-v" "--verbose"
10+
"-q" "--quiet"
11+
"--versions"
12+
"--version"
13+
"--features"
14+
"--esrt"
15+
"--device"
16+
"--compare-version"
17+
"--power"
18+
"--thermal"
19+
"--sensors"
20+
"--pdports"
21+
"--info"
22+
"--pd-info"
23+
"--dp-hdmi-info"
24+
"--dp-hdmi-update"
25+
"--audio-card-info"
26+
"--privacy"
27+
"--pd-bin"
28+
"--ec-bin"
29+
"--capsule"
30+
"--dump"
31+
"--ho2-capsule"
32+
"--dump-ec-flash"
33+
"--flash-ec"
34+
"--flash-ro-ec"
35+
"--flash-rw-ec"
36+
"--intrusion"
37+
"--inputmodules"
38+
"--input-deck-mode"
39+
"--charge-limit"
40+
"--get-gpio"
41+
"--fp-led-level"
42+
"--fp-brightness"
43+
"--kblight"
44+
"--rgbkbd"
45+
"--tablet-mode"
46+
"--touchscreen-enable"
47+
"--console"
48+
"--reboot-ec"
49+
"--hash"
50+
"--driver"
51+
"--pd-addrs"
52+
"--pd-ports"
53+
"--has-mec"
54+
"-t" "--test"
55+
"-h" "--help"
56+
)
57+
58+
local devices=("bios" "ec" "pd0" "pd1" "rtm01" "rtm23" "ac-left" "ac-right")
59+
local input_deck_modes=("auto" "off" "on")
60+
local console_modes=("recent" "follow")
61+
local drivers=("portio" "cros-ec" "windows")
62+
local has_mec_options=("true" "false")
63+
local brightness_options=("high" "medium" "low" "ultra-low")
64+
65+
local current_word prev_word
66+
current_word="${COMP_WORDS[COMP_CWORD]}"
67+
prev_word="${COMP_WORDS[COMP_CWORD-1]}"
68+
69+
# Handle options
70+
if [[ $COMP_CWORD -eq 1 ]]; then
71+
COMPREPLY=( $(compgen -W "${options[*]}" -- "$current_word") )
72+
elif [[ $prev_word == "--device" ]]; then
73+
COMPREPLY=( $(compgen -W "${devices[*]}" -- "$current_word") )
74+
elif [[ $prev_word == "--input-deck-mode" ]]; then
75+
COMPREPLY=( $(compgen -W "${input_deck_modes[*]}" -- "$current_word") )
76+
elif [[ $prev_word == "--console" ]]; then
77+
COMPREPLY=( $(compgen -W "${console_modes[*]}" -- "$current_word") )
78+
elif [[ $prev_word == "--driver" ]]; then
79+
COMPREPLY=( $(compgen -W "${drivers[*]}" -- "$current_word") )
80+
elif [[ $prev_word == "--has-mec" ]]; then
81+
COMPREPLY=( $(compgen -W "${has_mec_options[*]}" -- "$current_word") )
82+
elif [[ $prev_word == "--fp-brightness" ]]; then
83+
COMPREPLY=( $(compgen -W "${brightness_options[*]}" -- "$current_word") )
84+
fi
85+
86+
return 0
87+
}
88+
89+
complete -F _framework_tool framework_tool

completions/zsh/_framework_tool

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#compdef framework_tool
2+
3+
local -a options
4+
5+
options=(
6+
'--flash-gpu-descriptor[]'
7+
'-v[Increase logging verbosity]'
8+
'-q[Decrease logging verbosity]'
9+
'--versions[Show current firmware versions]'
10+
'--version[Show tool version information (Add -vv for more details)]'
11+
'--features[Show features supported by the firmware]'
12+
'--esrt[Display the UEFI ESRT table]'
13+
'--device[Specify device type]:device:(bios ec pd0 pd1 rtm01 rtm23 ac-left ac-right)'
14+
'--compare-version[Specify version to compare]:compare_version'
15+
'--power[Show current power status of battery and AC (Add -vv for more details)]'
16+
'--thermal[Print thermal information (Temperatures and Fan speed)]'
17+
'--sensors[Print sensor information (ALS, G-Sensor)]'
18+
'--pdports[Show information about USB-C PD ports]'
19+
'--info[Show info from SMBIOS (Only on UEFI)]'
20+
'--pd-info[Show details about the PD controllers]'
21+
'--dp-hdmi-info[Show details about connected DP or HDMI Expansion Cards]'
22+
'--dp-hdmi-update[Update the DisplayPort or HDMI Expansion Card]:update_bin'
23+
'--audio-card-info[Show details about connected Audio Expansion Cards (Needs root privileges)]'
24+
'--privacy[Show privacy switch statuses (camera and microphone)]'
25+
'--pd-bin[Parse versions from PD firmware binary file]:pd_bin'
26+
'--ec-bin[Parse versions from EC firmware binary file]:ec_bin'
27+
'--capsule[Parse UEFI Capsule information from binary file]:capsule'
28+
'--dump[Dump extracted UX capsule bitmap image to a file]:dump'
29+
'--ho2-capsule[Parse UEFI Capsule information from binary file]:ho2_capsule'
30+
'--dump-ec-flash[Dump EC flash contents]:dump_ec_flash'
31+
'--flash-ec[Flash EC with new firmware from file]:flash_ec'
32+
'--flash-ro-ec[Flash EC with new RO firmware from file]:flash_ro_ec'
33+
'--flash-rw-ec[Flash EC with new RW firmware from file]:flash_rw_ec'
34+
'--intrusion[Show status of intrusion switch]'
35+
'--inputmodules[Show status of the input modules (Framework 16 only)]'
36+
'--input-deck-mode[Set input deck power mode]:input_deck_mode:(auto off on)'
37+
'--charge-limit[Get or set max charge limit]:charge_limit'
38+
'--get-gpio[Get GPIO value by name]:get_gpio'
39+
'--fp-led-level-gpio[Get or set fingerprint LED brightness level]:fp_led_level:(high medium low ultra-low auto)'
40+
'--fp-brightness[Get or set fingerprint LED brightness]:fp_brightness'
41+
'--kblight[Set keyboard backlight percentage or get, if no value provided]:kblight'
42+
'--rgbkbd[Set the color of <key> to <RGB>.]'
43+
'--tablet-mode[Set tablet mode override]:tablet_mode:(auto tablet laptop)'
44+
'--touchscreen-enable[Enable/disable touchscreen]:touchscreen_enable:(true false)'
45+
'--console[Get EC console, choose whether recent or to follow the output]:console:(recent follow)'
46+
'--reboot-ec[Control EC RO/RW jump]:reboot_ec:(reboot jump-ro jump-rw cancel-jump disable-jump)'
47+
'--hash[Hash a file of arbitrary data]:hash'
48+
'--driver[Select which driver is used]:driver:(portio cros-ec windows)'
49+
'--pd-addrs[Specify I2C addresses of the PD chips (Advanced)]:pd_addrs'
50+
'--pd-ports[Specify I2C ports of the PD chips (Advanced)]:pd_ports'
51+
'--has-mec[Specify the type of EC chip (MEC/MCHP or other)]:has_mec:(true false)'
52+
'-t[Run self-test to check if interaction with EC is possible]'
53+
'-h[Print help]'
54+
)
55+
56+
_arguments -s -S $options

0 commit comments

Comments
 (0)