| 1 |
# /etc/bash_completion.d/isoquery |
| 2 |
# Programmable Bash command completion for the ‘isoquery’ command. |
| 3 |
|
| 4 |
shopt -s progcomp |
| 5 |
|
| 6 |
_isoquery_completion () { |
| 7 |
local cur prev opts |
| 8 |
|
| 9 |
COMPREPLY=() |
| 10 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 11 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 12 |
|
| 13 |
opts="-h --help -v --version" |
| 14 |
opts="${opts} -i --iso -p --pathname -l --locale -0 --null -f --flag" |
| 15 |
opts="${opts} -n --name -o --official_name -c --common_name" |
| 16 |
|
| 17 |
case "${prev}" in |
| 18 |
-i|--iso) |
| 19 |
local standards=(639-2 639-3 639-5 3166-1 3166-2 3166-3 4217 15924) |
| 20 |
COMPREPLY=( $(compgen -W "${standards[*]}" -- ${cur}) ) |
| 21 |
;; |
| 22 |
|
| 23 |
-p|--pathname) |
| 24 |
COMPREPLY=( $(compgen -A file -- ${cur}) ) |
| 25 |
;; |
| 26 |
|
| 27 |
-l|--locale) |
| 28 |
local locale_names=$(locale --all-locales) |
| 29 |
COMPREPLY=( $(compgen -W "${locale_names}" -- ${cur}) ) |
| 30 |
;; |
| 31 |
|
| 32 |
*) |
| 33 |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
| 34 |
;; |
| 35 |
esac |
| 36 |
} |
| 37 |
|
| 38 |
complete -F _isoquery_completion isoquery |
| 39 |
|
| 40 |
|
| 41 |
# Local variables: |
| 42 |
# coding: utf-8 |
| 43 |
# mode: shell-script |
| 44 |
# End: |
| 45 |
# vim: fileencoding=utf-8 filetype=bash : |