diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-12 23:01:10 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-12 23:01:10 +0300 |
commit | 156656c16d4302d059221a06eb7c1bd460e41fe9 (patch) | |
tree | 87b9edeaab27b4d7a5ae70644a5b7803c3cc7c25 /completions/badblocks | |
parent | d3d6476f6c24cebb89e4712477e568dd5f5fbca8 (diff) | |
download | bash-completion-156656c16d4302d059221a06eb7c1bd460e41fe9.tar.gz |
Split/rename many completions into per-command files.
Diffstat (limited to 'completions/badblocks')
-rw-r--r-- | completions/badblocks | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/completions/badblocks b/completions/badblocks new file mode 100644 index 00000000..4953a182 --- /dev/null +++ b/completions/badblocks @@ -0,0 +1,38 @@ +# badblocks(8) completion + +_badblocks() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -b|-c|-e|-d|-p|-t) + return 0 + ;; + -i|-o) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + # Filter out -w (dangerous) and -X (internal use) + for i in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i] + done + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _badblocks badblocks + +# Local variables: +# mode: shell-script +# sh-basic-offset: 4 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: ts=4 sw=4 et filetype=sh |