summary refs log tree commit diff
path: root/Completion/Debian/Command/_reprepro
blob: d1e124eeff97a27d5f1657140a2f84c855b78135 (plain) (blame)
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
#compdef reprepro

local curcontext="$curcontext" state line expl distfile ret=1
typeset -A opt_args
local -a codenames

_arguments -C \
  '(-h --help)'{-h,--help}'[display help]' \
  '*'{-v,-V,--verbose}'[be more verbose]' \
  '--silent[be less verbose]' \
  '(-b --basedir)'{-b,--basedir}':basedir:_files -/' \
  '--confdir:config dir:_files -/' \
  '--distdir:dist dir:_files -/' \
  '--logdir:log dir:_files -/' \
  '--overridedir:override dir:_files -/' \
  '--dbdir:db dir:_files -/' \
  '--listdir:list dir:_files -/' \
  '--methoddir:method dir:_files -/' \
  '(-C --component)'{-C,--component}':component:(component1 component2)' \
  '(-A --architecture)'{-A,--architecture}':architecture:_sequence -s "|" _deb_architectures -' \
  '(-T --type)'{-T,--type}':file type:(dsc deb udeb)' \
  '(-S --section)'{-S,--section}':section:(section1 section2)' \
  '(-P --priority)'{-P,--priority}':priority:(high low)' \
  '--export=:whether and how:(never changed normal force)' \
  '--ignore=:error type:(what otherwhat)' \
  '--nolistsdownload[do not download Release or index files]' \
  '--keepunreferencedfiles[do not delete files that are no longer used]' \
  '--keepunneededlists' \
  '--keepdirectories' \
  '--ask-passphrase' \
  '--noskipold' \
  '--waitforlock:count:' \
  '--spacecheck:behavior:(full none)' \
  '--dbsafetymargin:bytes count:' \
  '--safetymargin:bytes count:' \
  '--noguessgpgtty' \
  ':reprepro command:(export createsymlinks list listfilter remove update
    iteratedupdate checkupdate predelete pull checkpull includedeb
    includeudeb includedsc include processincoming check checkpool
    rereference dumpreferences dumpunreferenced deleteunreferenced
    reoverride dumptracks retrack removealltracks removetrack tidytracks
    copy clearvanished gensnapshot rerunnotifiers)' \
  '*::subcmd:->subcmd' && ret=0

case "$state" in
  subcmd)
    case "$words[1]" in
      (export|update|iteratedupdate|checkupdate|predelete|pull|checkpull|check)
        if [[ -n "$opt_args[--confdir]" ]]; then
	  distfile=${opt_args[--confdir]}/distributions
	elif [[ -n "$opt_args[-b]" ]]; then
	  distfile=${opt_args[-b]}/conf/distributions
	elif [[ -n "$opt_args[--basedir]" ]]; then
	  distfile=${opt_args[--basedir]}/conf/distributions
	elif [[ -n "$REPREPRO_BASE_DIR" ]]; then
	  distfile=${REPREPRO_BASE_DIR}/conf/distributions
	else
	  distfile=$PWD/conf/distributions
	fi

        codenames=($(awk '/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {$1="";print}' "$distfile"))
	_wanted -V 'codenames' expl 'codename' compadd -a codenames && ret=0
      ;;
      (*)
	_files && ret=0
      ;;
    esac
  ;;
esac

return ret