[Bash-completion-commits] [bash-completion] 01/01: pdftotext: New completion

Ville Skyttä scop-guest at moszumanska.debian.org
Tue Jul 7 14:51:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit 4289460691719255ca5d34c04d2a7cacc6ccd1ba
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jul 7 17:50:36 2015 +0300

    pdftotext: New completion
---
 completions/Makefile.am            |  1 +
 completions/pdftotext              | 36 ++++++++++++++++++++++++++++++++++++
 test/completion/pdftotext.exp      |  1 +
 test/lib/completions/pdftotext.exp | 18 ++++++++++++++++++
 4 files changed, 56 insertions(+)

diff --git a/completions/Makefile.am b/completions/Makefile.am
index e3060c5..d535126 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -256,6 +256,7 @@ bashcomp_DATA = 2to3 \
 		pack200 \
 		passwd \
 		patch \
+		pdftotext \
 		perl \
 		pgrep \
 		pidof \
diff --git a/completions/pdftotext b/completions/pdftotext
new file mode 100644
index 0000000..8c10d82
--- /dev/null
+++ b/completions/pdftotext
@@ -0,0 +1,36 @@
+# bash completion for pdftotext(1)                         -*- shell-script -*-
+
+_pdftotext()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -h|-help|--help|-'?'|-f|-l|-r|-x|-y|-W|-H|-fixed|-opw|-upw)
+            return
+            ;;
+        -enc)
+            COMPREPLY=( $( compgen -W '$( "$1" -listenc 2>/dev/null |
+                sed -e 1d )' -- "$cur" ) )
+            return
+            ;;
+        -eol)
+            COMPREPLY=( $( compgen -W "unix dos mac" -- "$cur" ) )
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* && ${prev,,} != *.pdf ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        return
+    fi
+
+    case ${prev,,} in
+        -|*.txt) ;;
+        *.pdf) COMPREPLY=( $( compgen -W '-' -- "$cur" ) ) ; _filedir txt ;;
+        *) _filedir pdf ;;
+    esac
+} &&
+complete -F _pdftotext pdftotext
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/pdftotext.exp b/test/completion/pdftotext.exp
new file mode 100644
index 0000000..d84cee5
--- /dev/null
+++ b/test/completion/pdftotext.exp
@@ -0,0 +1 @@
+assert_source_completions pdftotext
diff --git a/test/lib/completions/pdftotext.exp b/test/lib/completions/pdftotext.exp
new file mode 100644
index 0000000..4c5cfca
--- /dev/null
+++ b/test/lib/completions/pdftotext.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pdftotext "
+sync_after_int
+
+
+teardown

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list