Initial bash completion
This commit is contained in:
parent
4b853f9c16
commit
8601db8811
2 changed files with 32 additions and 0 deletions
25
writeimg_completion_bash.sh
Normal file
25
writeimg_completion_bash.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
_writeimg_completion() {
|
||||
local cur prev opts
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
opts="-v -d -h --help -n --noconfirm -V --version"
|
||||
|
||||
# Devices
|
||||
if [[ "$prev" == "-d" ]]; then
|
||||
COMPREPLY=( $(compgen -W "$(ls -d /dev/sd* /dev/nvme* /dev/mmcblk* 2>/dev/null)" -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Flags
|
||||
if [[ "$cur" != -* ]]; then
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Files
|
||||
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
|
||||
}
|
||||
|
||||
complete -F _writeimg_completion writeimg
|
||||
Loading…
Add table
Add a link
Reference in a new issue