1#compdef apt-file
2
3_apt-file() {
4  local -a arguments
5  local state line cmds 
6  arguments=(
7    '(--cache -c)'{--cache,-c}'[cache directory]:directory:_directories'
8    '(-v --verbose)'{-v,--verbose}'[verbose]'
9     '(--cdrom-mount -d)'{--cdrom-mount,-d}'[cdrom mount point]:directory:_directories'
10     '(--ignore-case -i)'{--ignore-case,-i}'[ignore case]'
11     '(--regexp -r)'{--regexp,-r}'[regular expression]'
12     '(-V --version)'{-V,--version}'[version]'
13     '(-a --architecture)'{-a,--architecture}'[architecture]:architecture:(alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)'
14    '(-s --sources-list)'{-s,--sources-list}'[source.list file]:file:_files'
15    '(-l --package-only)'{-l,--package-only}'[only display package name]'
16    '(-F --fixed-string)'{-F,--fixed-string}'[do not expand search pattern]'
17    '(-y --dummy)'{-y,--dummy}'[run in dummy mode]'
18    '(-h --help)'{-h,--help}'[display help screen]'
19    '1: :->cmds'
20    '*: :->args'
21  )
22    _arguments -S $arguments
23
24    case $state in
25      cmds)
26        cmds=(
27            'update:resynchronize package contents'
28            'search:search in which package file is included'
29            'list:list contents of a package'
30            'show:alias for list'
31            'purge:remove all Contents-<ARCH>.gz files in cache directory'
32        )
33        _describe -t commands 'apt-list command' cmds && ret=0
34      ;;
35      args)
36        case $line[1] in
37            search)
38                _message "pattern"
39            ;;
40            list|show)
41               _deb_packages avail 
42            ;;
43            update|purge)
44                # do nothing
45            ;;
46            *)
47                _message "command $line[1] not available"
48            ;;
49        esac
50      ;;
51    esac
52
53}
54
55_apt-file "$@"
56