@@ -28,6 +28,58 @@ _chip_tool_get_options() {
28
28
" $@ " --help 2>&1 | awk -F' [[]|[]]' ' /^[[]--/{ print $2 }'
29
29
}
30
30
31
+ _chip_app () {
32
+
33
+ local cur prev words cword split
34
+ _init_completion -s || return
35
+
36
+ case " $prev " in
37
+ --ble-device)
38
+ readarray -t words < <( ls -I ' *:*' /sys/class/bluetooth)
39
+ # Get the list of Bluetooth devices without the 'hci' prefix.
40
+ readarray -t COMPREPLY < <( compgen -W " ${words[*]# hci} " -- " $cur " )
41
+ return
42
+ ;;
43
+ --custom-flow)
44
+ readarray -t COMPREPLY < <( compgen -W " 0 1 2" -- " $cur " )
45
+ return
46
+ ;;
47
+ --capabilities)
48
+ # The capabilities option is a bit-field with 3 bits currently defined.
49
+ readarray -t COMPREPLY < <( compgen -W " 001 010 011 100 101 111" -- " $cur " )
50
+ return
51
+ ;;
52
+ --KVS)
53
+ _filedir
54
+ return
55
+ ;;
56
+ --PICS)
57
+ _filedir
58
+ return
59
+ ;;
60
+ --trace_file)
61
+ _filedir
62
+ return
63
+ ;;
64
+ --trace_log | --trace_decode)
65
+ readarray -t COMPREPLY < <( compgen -W " 0 1" -- " $cur " )
66
+ return
67
+ ;;
68
+ --trace-to)
69
+ readarray -t COMPREPLY < <( compgen -W " json perfetto" -- " $cur " )
70
+ compopt -o nospace
71
+ return
72
+ ;;
73
+ esac
74
+
75
+ case " $cur " in
76
+ -* )
77
+ readarray -t COMPREPLY < <( compgen -W " $( _parse_help " $1 " ) " -- " $cur " )
78
+ ;;
79
+ esac
80
+
81
+ }
82
+
31
83
_chip_tool () {
32
84
33
85
local cur prev words cword split
@@ -36,34 +88,56 @@ _chip_tool() {
36
88
# Get command line arguments up to the cursor position
37
89
local args=(" ${COMP_WORDS[@]: 0: $cword +1} " )
38
90
39
- local command=0
40
91
case " $prev " in
41
92
--commissioner-name)
42
93
readarray -t COMPREPLY < <( compgen -W " alpha beta gamma 4 5 6 7 8 9" -- " $cur " )
94
+ return
95
+ ;;
96
+ --only-allow-trusted-cd-keys)
97
+ readarray -t COMPREPLY < <( compgen -W " 0 1" -- " $cur " )
98
+ return
43
99
;;
44
- --paa-trust-store-path | --cd-trust-store-path)
100
+ --paa-trust-store-path | --cd-trust-store-path | --dac-revocation-set-path )
45
101
_filedir -d
102
+ return
46
103
;;
47
104
--storage-directory)
48
105
_filedir -d
106
+ return
49
107
;;
50
- * )
51
- command=1
108
+ --trace-to)
109
+ readarray -t COMPREPLY < <( compgen -W " json perfetto" -- " $cur " )
110
+ compopt -o nospace
111
+ return
52
112
;;
53
113
esac
54
114
55
- if [ " $command " -eq 1 ]; then
56
- case " $cur " in
57
- -* )
58
- words=$( _chip_tool_get_options " ${args[@]} " )
59
- ;;
60
- * )
61
- words=$( _chip_tool_get_commands " ${args[@]} " )
62
- ;;
63
- esac
64
- readarray -t COMPREPLY < <( compgen -W " $words " -- " $cur " )
65
- fi
115
+ case " $cur " in
116
+ -* )
117
+ words=$( _chip_tool_get_options " ${args[@]} " )
118
+ ;;
119
+ * )
120
+ words=$( _chip_tool_get_commands " ${args[@]} " )
121
+ ;;
122
+ esac
123
+ readarray -t COMPREPLY < <( compgen -W " $words " -- " $cur " )
66
124
67
125
}
68
126
127
+ complete -F _chip_app chip-air-purifier-app
128
+ complete -F _chip_app chip-all-clusters-app
129
+ complete -F _chip_app chip-bridge-app
130
+ complete -F _chip_app chip-dishwasher-app
131
+ complete -F _chip_app chip-energy-management-app
132
+ complete -F _chip_app chip-lighting-app
133
+ complete -F _chip_app chip-lock-app
134
+ complete -F _chip_app chip-log-source-app
135
+ complete -F _chip_app chip-microwave-oven-app
136
+ complete -F _chip_app chip-ota-provider-app
137
+ complete -F _chip_app chip-ota-requestor-app
138
+ complete -F _chip_app chip-refrigerator-app
139
+ complete -F _chip_app chip-rvc-app
140
+ complete -F _chip_app chip-tv-app
141
+ complete -F _chip_app chip-tv-casting-app
142
+
69
143
complete -F _chip_tool chip-tool
0 commit comments