summaryrefslogtreecommitdiff
path: root/contrib/iconv
diff options
context:
space:
mode:
authorDavid Paleino <d.paleino@gmail.com>2009-06-05 08:25:08 +0200
committerDavid Paleino <d.paleino@gmail.com>2009-06-05 08:25:08 +0200
commitfe1e044ed1e79cae5cd9ecab4653e2211c7b6cc4 (patch)
tree6acdba42dbc19195d0225076d50088d62bc6da34 /contrib/iconv
parent6a9c2b191b207b8950484cbd5c372d8c6e52cfaf (diff)
downloadbash-completion-fe1e044ed1e79cae5cd9ecab4653e2211c7b6cc4.tar.gz
Split iconv completion to contrib/iconv
Diffstat (limited to 'contrib/iconv')
-rw-r--r--contrib/iconv27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/iconv b/contrib/iconv
new file mode 100644
index 00000000..fe3dd4b8
--- /dev/null
+++ b/contrib/iconv
@@ -0,0 +1,27 @@
+# iconv(1) completion
+#
+have iconv &&
+_iconv()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(f|t|-@(from|to)-code))
+ COMPREPLY=( $( compgen -W \
+ '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
+ --output -o --verbose' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _iconv $default iconv