@@ -25,6 +25,7 @@ _west_cmds() {
25
25
local -a zephyr_ext_cmds=(
26
26
' completion[display shell completion scripts]'
27
27
' boards[display information about supported boards]'
28
+ ' shields[display information about supported shields]'
28
29
' build[compile a Zephyr application]'
29
30
' sign[sign a Zephyr binary for bootloader chain-loading]'
30
31
' flash[flash and run a binary on a board]'
@@ -114,6 +115,18 @@ _get_west_boards() {
114
115
_describe ' boards' _west_boards
115
116
}
116
117
118
+ _get_west_shields () {
119
+ _west_shields=( $( __west_x shields --format=' {name}' ) )
120
+ for i in {1..${# _west_shields[@]} }; do
121
+ local name=" ${_west_shields[$i]%% |* } "
122
+ local transformed_shield=" ${_west_shields[$i]// |// } "
123
+ _west_shields[$i ]=" ${transformed_shield// ,/ ${name} / } "
124
+ done
125
+ _west_shields=(${(@ s/ / )_west_shields} )
126
+
127
+ _describe ' shields' _west_shields
128
+ }
129
+
117
130
_west_init () {
118
131
local -a opts=(
119
132
' (-l --local)' {--mr,--manifest-rev}' [manifest revision]:manifest rev:'
@@ -228,6 +241,16 @@ _west_boards() {
228
241
_arguments -S $opts
229
242
}
230
243
244
+ _west_shields () {
245
+ local -a opts=(
246
+ {-f,--format}' [format string]:format string:'
247
+ {-n,--name}' [name regex]:regex:'
248
+ ' *--board-root[Add a board root]:board root:_directories'
249
+ )
250
+
251
+ _arguments -S $opts
252
+ }
253
+
231
254
_west_build () {
232
255
local -a opts=(
233
256
' (-b --board)' {-b,--board}' [board to build for]:board:_get_west_boards'
@@ -243,6 +266,7 @@ _west_build() {
243
266
{-o,--build-opt}' [options to pass to build tool (make or ninja)]:tool opt:'
244
267
' (-n --just-print --dry-run --recon)' {-n,--just-print,--dry-run,--recon}" [just print build commands, don't run them]"
245
268
' (-p --pristine)' {-p,--pristine}' [pristine build setting]:pristine:(auto always never)'
269
+ ' --shield[shield to build for]:shield:_get_west_shields'
246
270
)
247
271
_arguments -S $opts \
248
272
" 1:source_dir:_directories"
0 commit comments