summaryrefslogtreecommitdiff
path: root/completion/pdfgrep
blob: e156004ab8a4e5dd9fdb5470cbff7e5b50f45ca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Bash completion for pdfgrep
#
# Copyright (C) 2015-2018 by Hans-Peter Deifel (hpd@hpdeifel.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA.

_pdfgrep() 
{
    local cur prev words cword
    _init_completion || return

    local opts
    opts=(-n --page-number \
          -i --ignore-case \
          -F --fixed-strings \
          -P --perl-regexp \
          -H --with-filename \
          -h --no-filename \
	  -l --files-with-matches \
	  -L --files-without-match \
          -c --count \
          -p --page-count \
	  -C --context \
	  -A --after-context \
	  -B --before-context \
          --color \
          --cache \
          -r -R --recursive \
          --exclude \
          --include \
	  --page-range \
          --help \
          -V --version \
          -q --quiet \
          -Z --null\
          --match-prefix-separator \
          --password \
          -m --max-count \
          --debug \
          --warn-empty \
          --unac \
	  -e --regexp \
	  -f --file \
         )

    case "${prev}" in
        --color)
            COMPREPLY=( $(compgen -W "always never auto" -- ${cur}) )
            ;;
        --exclude|--include|--password|-m|--max-count|--match-prefix-separator|--page-range|-e|--regexp|-f|--file)
            COMPREPLY=( )
            ;;
        *)
            case "${cur}" in
                -*)
                    COMPREPLY=( $(compgen -W "${opts[*]}" -- ${cur}) )
                    return
                    ;;
                *)
                    _filedir pdf
                    ;;
            esac
    esac

    return
} &&
complete -F _pdfgrep pdfgrep

# Local Variables:
# mode: shell-script
# End: