1# check if we are currently in a west workspace 2# this is used to filter which command to show 3# 4# return 0 if in west workspace 5# return 1 else 6function __zephyr_west_check_if_in_workspace 7 west topdir &>/dev/null 8 if test $status = 0 9 return 0 10 else 11 return 1 12 end 13end 14 15# exclude the caller if one of the arguments is present in the command line 16# 17# return 1 if one of the arguments is present in the command line 18# return 0 else 19function __zephyr_west_exclude 20 set -l tokens (commandline -opc) 21 22 for t in $tokens 23 for a in $argv 24 if test $t = $a 25 return 1 26 end 27 end 28 end 29 30 return 0 31end 32 33# function used to have a maximum number of arguments 34# 35# argv[1] is the maximum number of arguments 36# argv[n] are the arguments to count, if not specified will count all arguments after 'west <command>' on the command line 37# 38# return 1 if the command line contain more than $argv[1] element from $argv[n...] 39# return 0 else 40function __zephyr_west_max_args 41 set -l tokens (commandline -opc) 42 set -l argc (count $argv) 43 set -l max $argv[1] 44 set -l counter 0 45 46 if test $argc -eq 1 47 if test (math (count $tokens) - 2) -ge $max 48 return 1 49 else 50 return 0 51 end 52 end 53 54 for idx in (seq 2 $argc) 55 if contains $argv[idx] $tokens 56 set counter (math $counter + 1) 57 end 58 end 59 60 if $counter -ge $max 61 return 1 62 end 63 64 return 0 65end 66 67# alias of '__fish_complete_directories' but set the arguments to '' 68function __zephyr_west_complete_directories 69 __fish_complete_directories '' '' 70end 71 72# check if a given token is the last one in the command line 73# 74# return 0 if one of the given argument is the last token 75# return 1 else 76function __zephyr_west_is_last_token 77 set -l tokens (commandline -opc) 78 79 for token in $argv 80 if string match -qr -- "$token*" "$tokens[-1]" 81 return 0 82 end 83 end 84 85 return 1 86end 87 88# function similar to '__fish_use_subcommand' but with special cases 89function __zephyr_west_use_subcommand 90 set -l tokens (commandline -opc) 91 92 for idx in (seq 2 (count $tokens)) 93 switch $tokens[$idx] 94 case '-*' 95 continue 96 case '*' 97 if test $idx -ge 3 98 set -l prv_idx (math $idx - 1) 99 switch $tokens[$prv_idx] 100 # this option can be placed before subcommand and require a folder 101 # if we don't do that the folder will be catched as a subcommand and 102 # the subcommands will not be completed 103 case '-z' '--zephyr-base' 104 continue 105 end 106 end 107 end 108 return 1 109 end 110 111 return 0 112end 113 114# function similar to '__fish_seen_subcommand_from' but with special cases 115function __zephyr_west_seen_subcommand_from 116 set -l tokens (commandline -opc) 117 set -e tokens[1] 118 119 # special case: 120 # we don't want the command completion when doing `west help <cmd>` 121 if contains -- "help" $tokens 122 return 1 123 end 124 125 for token in $tokens 126 if contains -- $token $argv 127 return 0 128 end 129 end 130 131 return 1 132end 133 134# return the list of projects 135function __zephyr_west_complete_projects 136 set -l tokens (commandline -opc) 137 set -l zephyr_base "" 138 set -l projects 139 140 for idx in (seq 1 (count $tokens)) 141 if test \("$tokens[$idx]" = "-z"\) -o \("$tokens[$idx]" = "--zephyr-base"\) 142 if set -q $tokens[(math $idx + 1)] 143 set $zephyr_base $tokens (math $idx + 1) 144 break 145 end 146 end 147 end 148 149 if test $zephyr_base != "" 150 set projects (west "-z $zephyr_base" list --format="{name}") 151 else 152 set projects (west list --format="{name}") 153 end 154 155 printf "%s\n" $projects 156end 157 158# return the list of available west commands 159function __zephyr_west_complete_help 160 set -l builtin_cmds "init" "create a west repository" \ 161 "update" "update projects described in west manifest" \ 162 "list" "print information about projects" \ 163 "manifest" "manage the west manifest" \ 164 "diff" '"git diff" for one or more projects' \ 165 "status" '"git status" for one or more projects' \ 166 "forall" "run a command in one or more local projects" \ 167 "config" "get or set config file values" \ 168 "topdir" "print the top level directory of the workspace" \ 169 "help" "get help for west or a command" 170 set -l nb_builtin_cmds (count $builtin_cmds) 171 172 set -l ext_cmds "completion" "display shell completion scripts" \ 173 "boards" "display information about supported boards" \ 174 "build" "compile a Zephyr application" \ 175 "sign" "sign a Zephyr binary for bootloader chain-loading" \ 176 "flash" "flash and run a binary on a board" \ 177 "debug" "flash and interactively debug a Zephyr application" \ 178 "debugserver" "connect to board and launch a debug server" \ 179 "attach" "interactively debug a board" \ 180 "zephyr-export" "export Zephyr installation as a CMake config package" \ 181 "spdx" "create SPDX bill of materials" \ 182 "blobs" "work with binary blobs" \ 183 "sdk" "manage SDKs" 184 set -l nb_ext_cmds (count $ext_cmds) 185 186 if __zephyr_west_check_if_in_workspace 187 for idx in (seq 1 2 $nb_ext_cmds) 188 set -l desc_idx (math $idx + 1) 189 printf "%s\n" $ext_cmds[$idx]\t"$ext_cmds[$desc_idx]" 190 end 191 end 192 193 for idx in (seq 1 2 $nb_builtin_cmds) 194 set -l desc_idx (math $idx + 1) 195 printf "%s\n" $builtin_cmds[$idx]\t"$builtin_cmds[$desc_idx]" 196 end 197end 198 199function __zephyr_west_topdir 200 set -l cwd (pwd) 201 set -l fallback 1 202 203 if test (count $argv) -eq 2 204 set cwd $argv[1] 205 set fallback $argv[2] 206 end 207 208 set -l cwd_split (string split '/' $cwd) 209 210 while true 211 set -l tmp_path (path normalize /(string join "/" $cwd_split)) 212 213 if test -d $tmp_path/.west 214 echo "$tmp_path" 215 return 216 end 217 218 if test -z "$tmp_path" -o $tmp_path = "/" 219 break 220 end 221 222 set -e cwd_split[-1] 223 set tmp_path (string join "/" $cwd_split) 224 end 225 226 if test $fallback -eq 1 -a -n "$ZEPHYR_BASE" 227 west-topdir "$ZEPHYR_BASE" 0 228 end 229end 230 231function __zephyr_west_manifest_path 232 set -l west_topdir (__zephyr_west_topdir) 233 234 set -l config (cat $west_topdir/.west/config) 235 236 set -l manifest_path "" 237 set -l manifest_file "" 238 239 set -l in_manifest_group 0 240 241 for line in $config 242 if string match -rq '^\s*\[manifest\]\s*$' $line 243 set in_manifest_group 1 244 continue 245 else if string match -rq '^\[.*\]$' $line 246 set in_manifest_group 0 247 continue 248 end 249 250 if test $in_manifest_group -eq 1 251 set -l tmp_manifest_path (string match -r '^path\s*=\s*(\S*)\s*$' $line)[2] 252 if test $status -eq 0 253 set manifest_path "$tmp_manifest_path" 254 continue 255 end 256 257 set -l tmp_manifest_file (string match -r '^file\s*=\s*(\S*)\s*$' $line)[2] 258 if test $status -eq 0 259 set manifest_file "$tmp_manifest_file" 260 continue 261 end 262 end 263 end 264 265 if test -z "$manifest_path" -o -z "$manifest_file" 266 return 267 end 268 269 echo (path normalize "$west_topdir"/"$manifest_path"/"$manifest_file") 270end 271 272function __zephyr_west_get_cache_dir 273 set -l manifest_path $argv[1] 274 set -l manifest_path_hash (echo "$manifest_path" | md5sum | string trim --chars=' -') 275 276 echo (__zephyr_west_topdir)/.west/fish/$manifest_path_hash 277end 278 279function __zephyr_west_complete_board 280 set -l is_cache_valid 1 # 0: invalid; 1: valid 281 282 set -l manifest_file (__zephyr_west_manifest_path) 283 set -l manifest_dir (path dirname "$manifest_file") 284 285 set -l cache_folder (__zephyr_west_get_cache_dir "$manifest_file") 286 set -l cache_file $cache_folder/fish_boards_completion.cache 287 288 set -l manifest_hash (git --work-tree "$manifest_dir" log -1 --pretty=format:'%H' 2> /dev/null) 289 290 if test $status -ne 0 291 # if the manifest folder is not a git repo, use the hash of the manifest file 292 set manifest_hash (md5sum "$manifest_path") 293 end 294 295 if test ! -f $cache_file 296 mkdir -p $cache_folder 297 touch $cache_file 298 299 set is_cache_valid 0 300 else 301 set -l cache_manifest_hash (head -n 1 $cache_file) 302 303 if test -z "$manifest_hash" -o -z "$cache_manifest_hash" -o "$manifest_hash" != "$cache_manifest_hash" 304 set is_cache_valid 0 305 end 306 end 307 308 if test $is_cache_valid -eq 0 309 set -l boards (west boards --format="{name}|{qualifiers}|{vendor}" 2> /dev/null) 310 311 if test $status -eq 0 312 echo $manifest_hash > $cache_file 313 end 314 315 for board in $boards 316 set -l split_b (string split "|" $board) 317 set -l name $split_b[1] 318 set -l qualifiers $split_b[2] 319 set -l vendor $split_b[3] 320 321 if test $vendor != "None" 322 for qualifier in (string split "," $qualifiers) 323 printf "%s\t%s\n" $name/$qualifier $vendor >> $cache_file 324 end 325 else 326 for qualifier in (string split "," $qualifiers) 327 printf "%s\n" $name/$qualifier >> $cache_file 328 end 329 end 330 end 331 end 332 333 tail -n +2 $cache_file 334end 335 336# disable file completion, if an option need it, it should use '--force-files' 337complete -c west -f 338 339# global options 340complete -c west -n "__zephyr_west_exclude -h --help" -o h -l help -d "show help" 341complete -c west -o v -l verbose -d "enable verbosity" 342complete -c west -n "__zephyr_west_exclude -V --version" -o V -l version -d "print version" 343complete -c west -n "__zephyr_west_exclude -z --zephyr-base; or __zephyr_west_is_last_token -z --zephyr-base" -o z -l zephyr-base -xa "(__zephyr_west_complete_directories)" -d "zephyr base folder" 344 345# init 346complete -c west -n __zephyr_west_use_subcommand -ra init -d "create a west workspace" 347complete -c west -n "__zephyr_west_seen_subcommand_from init" -ra "(__zephyr_west_complete_directories)" 348complete -c west -n "__zephyr_west_seen_subcommand_from init; and __zephyr_west_exclude -l --local" -l mr -l manifest-rev -r -d "manifest revision" 349complete -c west -n "__zephyr_west_seen_subcommand_from init" -l mf -l manifest-file -r -d "manifest file" 350complete -c west -n "__zephyr_west_seen_subcommand_from init; and __zephyr_west_exclude -l --local" -o m -l manifest -ra "(__zephyr_west_complete_directories)" -d "manifest URL" 351complete -c west -n "__zephyr_west_seen_subcommand_from init; and __zephyr_west_exclude -m --manifest --mr --manifest-rev" -o l -l local -ra "(__zephyr_west_complete_directories)" -d "use local directory as manifest repository" 352 353# update 354complete -c west -n __zephyr_west_use_subcommand -ra update -d "update projects described in west manifest" 355complete -c west -n "__zephyr_west_seen_subcommand_from update" -ra "(__zephyr_west_complete_projects)" 356complete -c west -n "__zephyr_west_seen_subcommand_from update" -l stats -d "print performance stats" 357complete -c west -n "__zephyr_west_seen_subcommand_from update" -l name-cache -ra "(__zephyr_west_complete_directories)" -d "name-based cache" 358complete -c west -n "__zephyr_west_seen_subcommand_from update" -l path-cache -ra "(__zephyr_west_complete_directories)" -d "path-based cache" 359complete -c west -n "__zephyr_west_seen_subcommand_from update" -o f -l fetch -ra "always smart" -d "fetch strategy" 360complete -c west -n "__zephyr_west_seen_subcommand_from update" -o o -l fetch-opt -d "fetch options" 361complete -c west -n "__zephyr_west_seen_subcommand_from update" -o n -l narrow -d "narrow fetch" 362complete -c west -n "__zephyr_west_seen_subcommand_from update" -o k -l keep-descendants -d "keep manifest-rev descendants checked out" 363complete -c west -n "__zephyr_west_seen_subcommand_from update" -o r -l rebase -d "rebase checked out branch onto the new manifest-rev" 364 365# list 366complete -c west -n __zephyr_west_use_subcommand -ra list -d "print information about projects" 367complete -c west -n "__zephyr_west_seen_subcommand_from list; and not __fish_seen_subcommand_from blobs" -ra "(__zephyr_west_complete_projects)" 368complete -c west -n "__zephyr_west_seen_subcommand_from list; and not __fish_seen_subcommand_from blobs" -o a -l all -d "include inactive projects" 369complete -c west -n "__zephyr_west_seen_subcommand_from list; and not __fish_seen_subcommand_from blobs" -l manifest-path-from-yaml -d "print performance stats" 370complete -c west -n "__zephyr_west_seen_subcommand_from list; and not __fish_seen_subcommand_from blobs" -o f -l format -d "format string" 371 372# manifest 373complete -c west -n __zephyr_west_use_subcommand -ra manifest -d "manage the west manifest" 374complete -c west -n "__zephyr_west_seen_subcommand_from manifest" -l resolve -d "resolve into single manifest" 375complete -c west -n "__zephyr_west_seen_subcommand_from manifest" -l freeze -d "resolve into single manifest, with SHAs" 376complete -c west -n "__zephyr_west_seen_subcommand_from manifest" -l validate -d "silently validate manifest" 377complete -c west -n "__zephyr_west_seen_subcommand_from manifest" -l path -d "print the path to the top level manifest file" 378complete -c west -n "__zephyr_west_seen_subcommand_from manifest" -o o -l output -rF -d "output file" 379 380# diff 381complete -c west -n __zephyr_west_use_subcommand -ra diff -d '"git diff" for one or more projects' 382complete -c west -n "__zephyr_west_seen_subcommand_from diff" -ra "(__zephyr_west_complete_projects)" 383complete -c west -n "__zephyr_west_seen_subcommand_from diff" -o a -l all -d "include inactive projects" 384 385# status 386complete -c west -n __zephyr_west_use_subcommand -ra status -d '"git status" for one or more projects' 387complete -c west -n "__zephyr_west_seen_subcommand_from status" -ra "(__zephyr_west_complete_projects)" 388complete -c west -n "__zephyr_west_seen_subcommand_from status" -o a -l all -d "include inactive projects" 389 390# forall 391complete -c west -n __zephyr_west_use_subcommand -ra forall -d "run a command in one or more local projects" 392complete -c west -n "__zephyr_west_seen_subcommand_from forall" -ra "(__zephyr_west_complete_projects)" 393complete -c west -n "__zephyr_west_seen_subcommand_from forall" -o c -x -d "command to execute" 394complete -c west -n "__zephyr_west_seen_subcommand_from forall" -o a -l all -d "include inactive projects" 395complete -c west -n "__zephyr_west_seen_subcommand_from forall" -o g -l group -x -d "run command on projects in one of the group" 396 397# config 398complete -c west -n __zephyr_west_use_subcommand -ra config -d "get or set config file values" 399complete -c west -n "__zephyr_west_seen_subcommand_from config" -o l -l list -d "list all options and values" 400complete -c west -n "__zephyr_west_seen_subcommand_from config" -o d -l delete -d "delete an option in one config file" 401complete -c west -n "__zephyr_west_seen_subcommand_from config" -o D -l delete-all -d "delete an option everywhere it's set" 402complete -c west -n "__zephyr_west_seen_subcommand_from config" -l system -d "system-wide file" 403complete -c west -n "__zephyr_west_seen_subcommand_from config" -l global -d "global user-wide" 404complete -c west -n "__zephyr_west_seen_subcommand_from config" -l local -d "this workspace's file" 405 406# topdir 407complete -c west -n __zephyr_west_use_subcommand -a topdir -d "print the top level directory of the workspace" 408 409# help 410complete -c west -n __zephyr_west_use_subcommand -ra help -d "get help for west or a command" 411complete -c west -n "__fish_seen_subcommand_from help; and __zephyr_west_max_args 1" -ra "(__zephyr_west_complete_help)" 412 413 414 415# completion 416complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra completion -d "display shell completion scripts" 417complete -c west -n "__zephyr_west_seen_subcommand_from completion; and __zephyr_west_max_args 1" -ra "bash zsh fish" 418 419# boards 420complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra boards -d "display information about supported boards" 421complete -c west -n "__zephyr_west_seen_subcommand_from boards" -o f -l format -d "format string" 422complete -c west -n "__zephyr_west_seen_subcommand_from boards" -o n -l name -d "name regex" 423complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l arch-root -xa "(__zephyr_west_complete_directories)" -d "add an arch root" 424complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l board-root -xa "(__zephyr_west_complete_directories)" -d "add a board root" 425complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l soc-root -xa "(__zephyr_west_complete_directories)" -d "add a soc root" 426complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l board -xa "(__zephyr_west_complete_board)" -d "lookup the specific board" 427complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l board-dir -xa "(__zephyr_west_complete_directories)" -d "only look for boards in this directory" 428 429# build 430complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra build -d "compile a Zephyr application" 431complete -c west -n "__zephyr_west_seen_subcommand_from build" -ra "(__zephyr_west_complete_directories)" 432complete -c west -n "__zephyr_west_seen_subcommand_from build" -o b -l board -xa "(__zephyr_west_complete_board)" 433complete -c west -n "__zephyr_west_seen_subcommand_from build" -o d -l build-dir -xa "(__zephyr_west_complete_directories)" -d "build directory to create or use" 434complete -c west -n "__zephyr_west_seen_subcommand_from build" -o f -l force -d "ignore errors and continue" 435complete -c west -n "__zephyr_west_seen_subcommand_from build" -l sysbuild -d "create multi-domain build system" 436complete -c west -n "__zephyr_west_seen_subcommand_from build" -l no-sysbuild -d "do not create multi-domain build system" 437complete -c west -n "__zephyr_west_seen_subcommand_from build" -o c -l cmake -d "force a cmake run" 438complete -c west -n "__zephyr_west_seen_subcommand_from build" -l domain -d "execute build tool (make or ninja) for a given domain" 439complete -c west -n "__zephyr_west_seen_subcommand_from build" -o t -l target -d "run build system target" 440complete -c west -n "__zephyr_west_seen_subcommand_from build" -o T -l test-item -d "build based on test data in .yml" 441complete -c west -n "__zephyr_west_seen_subcommand_from build" -o o -l build-opt -d "options to pass to build tool (make or ninja)" 442complete -c west -n "__zephyr_west_seen_subcommand_from build" -o n -l just-print -l dry-run -l recon -d "just print build commands, don't run them" 443complete -c west -n "__zephyr_west_seen_subcommand_from build" -o p -l pristine -ra "auto always never" -d "pristine build setting" 444 445# sign 446complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra sign -d "sign a Zephyr binary for bootloader chain-loading" 447complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o d -l build-dir -ra "(__zephyr_west_complete_directories)" -d "build directory to create or use" 448complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o q -l quiet -d "suppress non-error output" 449complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o f -l force -d "ignore errors and continue" 450complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o t -l tool -ra "imgtool rimage" -d "image signing tool name" 451complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o p -l tool-path -ra "(__zephyr_west_complete_directories)" -d "path to the tool" 452complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o P -l tool-data -ra "(__zephyr_west_complete_directories)" -d "path to tool data" 453complete -c west -n "__zephyr_west_seen_subcommand_from sign; and __zephyr_west_exclude --no-bin" -l bin -d "produce a signed bin file" 454complete -c west -n "__zephyr_west_seen_subcommand_from sign; and __zephyr_west_exclude --bin" -l no-bin -d "do not produce a signed bin file" 455complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o B -l sbin -rF -d "signed .bin filename" 456complete -c west -n "__zephyr_west_seen_subcommand_from sign; and __zephyr_west_exclude --no-hex" -l hex -d "produce a signed hex file" 457complete -c west -n "__zephyr_west_seen_subcommand_from sign; and __zephyr_west_exclude --hex" -l no-hex -d "do not produce a signed hex file" 458complete -c west -n "__zephyr_west_seen_subcommand_from sign" -o H -l shex -rF -d "signed .hex filename" 459 460# flash 461complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra flash -d "flash and run a binary on a board" 462 463# debug 464complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra debug -d "flash and interactively debug a Zephyr application" 465 466# debugserver 467complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra debugserver -d "connect to board and launch a debug server" 468 469# attach 470complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra attach -d "interactively debug a board" 471 472## flash, debug, debugserver, attach 473complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -o d -l build-dir -ra "(__zephyr_west_complete_directories)" -d "build directory to create or use" 474complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -o r -l runner -r -d "override default runner from build-dir" 475complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l skip-rebuild -d "do not refresh cmake dependencies first" 476complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l domain -r -d "execute build tool (make or ninja) for a given domain" 477complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -o H -l context -d "print runner-specific options" 478complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l board-dir -ra "(__zephyr_west_complete_directories)" -d "board directory" 479complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -o f -l file -Fr -d "path to binary" 480complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -o t -l file-type -ra "hex bin elf" -d "type of binary" 481complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l elf-file -rka "(__fish_complete_suffix .elf)" -d "path to zephyr.elf" 482complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l hex-file -rka "(__fish_complete_suffix .hex)" -d "path to zephyr.hex" 483complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l bin-file -rka "(__fish_complete_suffix .bin)" -d "path to zephyr.bin" 484complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l gdb -Fr -d "path to GDB" 485complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l openocd -Fr -d "path to openocd" 486complete -c west -n "__zephyr_west_seen_subcommand_from flash debug debugserver attach" -l openocd-search -ra "(__zephyr_west_complete_directories)" -d "path to add to openocd search path" 487 488# zephyr-export 489complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra zephyr-export -d "export Zephyr installation as a CMake config package" 490 491# spdx 492complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra spdx -d "create SPDX bill of materials" 493complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -o i -l init -d "initialize CMake file-based API" 494complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -o d -l build-dir -ra "(__zephyr_west_complete_directories)" -d "build directory to create or use" 495complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -o n -l namespace-prefix -rf -d "namespace prefix" 496complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -o s -l spdx-dir -ra "(__zephyr_west_complete_directories)" -d "SPDX output directory" 497complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -l analyze-includes -d "also analyze included header files" 498complete -c west -n "__zephyr_west_seen_subcommand_from spdx" -l include-sdk -d "also generate SPDX document for SDK" 499 500# blobs 501complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra blobs -d "work with binary blobs" 502complete -c west -n "__zephyr_west_seen_subcommand_from blobs; and not __fish_seen_subcommand_from list fetch clean" -ra "list\t'list binary blobs' fetch\t'fetch binary blobs' clean\t'clean working tree of binary blobs'" 503complete -c west -n "__zephyr_west_seen_subcommand_from blobs; and __fish_seen_subcommand_from list fetch clean" -ra "(__zephyr_west_complete_projects)" 504complete -c west -n "__zephyr_west_seen_subcommand_from blobs; and not __fish_seen_subcommand_from fetch clean" -o f -l format -r -d "format string" 505 506# sdk 507complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra sdk -d "manage SDKs" 508complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and not __fish_seen_subcommand_from list install" -ra "list\t'list installed SDKs' install\t'install SDK'" 509complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -l version -d "version of the Zephyr SDK to install" 510complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o b -l install-base -d "SDK isntall base directory" 511complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o d -l install-dir -d "SDK isntall destination directory" 512complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o i -l interactive -d "interactive" 513complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o t -l toolchains -d "toolchain(s) to install" 514complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o T -l no-toolchains -d "do not install toolchains" 515complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -o H -l no-hosttools -d "do not install host-tools" 516complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -l personal-access-token -d "GitHub personal access token" 517complete -c west -n "__zephyr_west_seen_subcommand_from sdk; and __fish_seen_subcommand_from install" -l api-url -d "GitHub releases API endpoint URL" 518