Skip to content

Commit 9024645

Browse files
XECDesignpelwell
authored andcommitted
vcgencmd: Add bash completion script
1 parent 00393b2 commit 9024645

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

vcgencmd/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ project(vcgencmd)
88
add_executable(vcgencmd vcgencmd.c)
99
install(TARGETS vcgencmd RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1010
install(FILES vcgencmd.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
11+
install(FILES vcgencmd-completion.bash RENAME vcgencmd DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions")

vcgencmd/vcgencmd-completion.bash

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_vcgencmd() {
2+
local cur prev words cword split
3+
_init_completion -s || return
4+
if ! ((cword == 1)); then
5+
return
6+
fi
7+
local cmds=$(vcgencmd commands | sed 's/^.*=//;s/[",]//g')
8+
COMPREPLY+=($(compgen -W "$cmds" -- $cur))
9+
}
10+
11+
complete -F _vcgencmd vcgencmd

0 commit comments

Comments
 (0)