Initial bash completion

This commit is contained in:
Imbus 2026-02-21 07:24:25 +01:00
parent 4b853f9c16
commit 8601db8811
2 changed files with 32 additions and 0 deletions

View 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