_mkfs_module()
{
- local cur prev OPTS DEVS
+ local cur prev OPTS
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) )
return 0
;;
+ '-h'|'--help'|'-V'|'--version')
+ return 0
+ ;;
esac
case $cur in
-*)
- OPTS='-t --type --verbose -h --help -V --version'
+ OPTS='--type --verbose --help --version'
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
return 0
;;
esac
- while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
- COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) )
+ COMPREPLY=( $(compgen -W "$(lsblk -pnro name) /path/to/file" -- $cur) )
return 0
}
complete -F _mkfs_module mkfs