Skip to content

Commit 7a0d5bd

Browse files
authored
Merge pull request #21860 from maribu/dist/tools/zsh-completion
dist/tools/zsh-completion: Add completion for DOCKER_IMAGE and OPENOCD_FTDI_ADAPTER
2 parents bc3c992 + 4710d56 commit 7a0d5bd

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

dist/tools/zsh-completion/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ the CI are (intentionally) not added.
88

99
## Installation
1010

11-
1. Copy the `zsh-riot.sh` script where you can find it,
12-
e.g. `cp zsh-riot.sh ~/.zsh-riot.sh`
11+
1. Copy the `zsh-riot.zsh` script where you can find it,
12+
e.g. `cp zsh-riot.zsh ~/.zsh-riot.zsh`
1313
2. Hook up the custom RIOT specific make completion in `.zshrc` and use that
1414
instead of the default `make` completion if and only if the working
1515
directory is inside a RIOT repository. This can be done by adding the
1616
following snippet:
1717

1818
``` sh
19-
source ~/.zsh-riot.sh
19+
source ~/.zsh-riot.zsh
2020
compdef '
2121
if git rev-parse --is-inside-work-tree &> /dev/null && [[ -e "$(git rev-parse --show-toplevel)/.murdock" ]]; then
2222
_riot

dist/tools/zsh-completion/zsh-riot.sh renamed to dist/tools/zsh-completion/zsh-riot.zsh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
OPENOCD_SCRIPTS_PATH=${OPENOCD_SCRIPTS_PATH:-/usr/share/openocd/scripts/}
2+
DOCKER=${DOCKER:-docker}
3+
14
function _boards {
25
local -a _boards_available
36
local -a _board_dirs
@@ -78,6 +81,16 @@ function _hw_programmers {
7881
_describe 'hw_programmer' _hw_programmer_vals
7982
}
8083

84+
function _ftdi_adapter {
85+
local -a _adapter_vals=($(find "$OPENOCD_SCRIPTS_PATH"/interface/ftdi -type f -name '*.cfg' -exec basename --suffix=.cfg {} \;))
86+
_describe 'ftdi_adapter' _adapter_vals
87+
}
88+
89+
function _docker_image {
90+
local -a _docker_image_vals=($("$DOCKER" image ls --format '{{.Repository}}'))
91+
_describe 'docker_image' _docker_image_vals
92+
}
93+
8194
function _riot {
8295
local -a _std_targets=(
8396
"all:build the application"
@@ -123,13 +136,15 @@ function _riot {
123136
'BOARD[Select the board to build for]:board:_boards'
124137
'TOOLCHAIN[Select the toolchain to use]:toolcahin:_toolchains'
125138
'BUILD_IN_DOCKER[Build inside docker container]:bool:_bools'
139+
'DOCKER_IMAGE[The docker image to use with BUILD_IN_DOCKER=1]:docker_image:_docker_image'
126140
'LTO[Enable link time optimization]:bool:_bools'
127141
'VERBOSE_ASSERT[Print source file and line on blown assertion]:bool:_bools'
128142
'QUIET[Reduce verbosity of build output]:bool:_bools'
129143
'WERROR[Enable/disable -Werror flag]:bool:_bools'
130144
'RIOT_CI_BUILD[Behave as in the CI: Less verbose output, reproducible builds, ...]:bool:_bools'
131145
'PROGRAMMER[Select the programmer software to flash (debug) with]:programmer:_programmers'
132146
'OPENOCD_DEBUG_ADAPTER[Select the programmer hardware to use with OpenOCD]:hw_programmer:_hw_programmers'
147+
'OPENOCD_FTDI_ADAPTER[Select the FTDI adapter config to use with OpenOCD]:ftdi_adapter:_ftdi_adapter'
133148
'OPENOCD_RESET_USE_CONNECT_ASSERT_SRST[Let OpenOCD attach while reset signal is asserted]:bool:_bools'
134149
'STATIC_ANALYSIS[Enable static analysis for modules that claim support]:bool:_bools'
135150
)

0 commit comments

Comments
 (0)