summaryrefslogtreecommitdiffstats
path: root/docs/reprepro.zsh_completion
blob: 44a132b2942c5010c37ae009383c718c67c06fbe (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
#compdef reprepro

# This is a zsh completion script for reprepro.
# To make use of it make sure it is stored as _reprepro in your
# zsh's fpath (like /usr/local/share/zsh/site-functions/).
#
# to install as user:
#
# mkdir ~/.zshfiles
# cp reprepro.zsh_completion ~/.zshfiles/_reprepro
# echo 'fpath=(~/.zshfiles $fpath)' >> ~/.zshrc
# echo 'autoload -U ~/.zshfiles*(:t)' >> ~/.zshrc
#
# make sure compinit is called after those lines in .zshrc

local context state line confdir distfile incomingfile incomingdir outdir basedir confdirset basedirset
typeset -A opt_args
local -a codenames architectures list commands hiddencommands

function _reprepro_calcbasedir ()
{
	if [[ -n "$opt_args[-b]" ]]; then
		basedir=${opt_args[-b]}
		basedirset=true
	elif [[ -n "$opt_args[--basedir]" ]]; then
		basedir=${opt_args[--basedir]}
		basedirset=true
	elif [[ -n "$REPREPRO_BASE_DIR" ]]; then
		basedir=${REPREPRO_BASE_DIR}
		basedirset=true
	else
		basedir=$PWD
		basedirset=false
	fi
        if [[ -n "$opt_args[--confdir]" ]]; then
		confdir=${opt_args[--confdir]}
	elif [[ -n "$REPREPRO_CONFIG_DIR" ]]; then
		confdir=${REPREPRO_CONFIG_DIR}
	else
		confdir=$basedir/conf
	fi
	if [[  -e "$confdir/options" ]] ; then
		if [ "$basedirset" != "true" ] && grep -q '^basedir ' -- "$confdir/options" 2>/dev/null ; then
		     	basedir="$(grep '^basedir ' -- "$confdir/options" 2>/dev/null | sed -e 's/^basedir *//')"
		fi
	fi
}
function _reprepro_filekeys ()
{
	_reprepro_calcbasedir
	if [[ -n "$opt_args[--outdir]" ]]; then
		outdir=${opt_args[--outdir]}
	else
		outdir=$basedir
	fi
	list=( $outdir )
	_files -W list
}

function _reprepro_calcconfdir ()
{
        if [[ -n "$opt_args[--confdir]" ]]; then
		confdir=${opt_args[--confdir]}
		confdirset=direct
	elif [[ -n "$REPREPRO_CONFIG_DIR" ]]; then
		confdir=${REPREPRO_CONFIG_DIR}
		confdirset=direct
	elif [[ -n "$opt_args[-b]" ]]; then
		confdir=${opt_args[-b]}/conf
		confdirset=basedir
		basedirset=true
	elif [[ -n "$opt_args[--basedir]" ]]; then
		confdir=${opt_args[--basedir]}/conf
		confdirset=basedir
		basedirset=true
	elif [[ -n "$REPREPRO_BASE_DIR" ]]; then
		confdir=${REPREPRO_BASE_DIR}/conf
		confdirset=basedir
		basedirset=true
	else
		confdir=$PWD/conf
		confdirset=default
		basedirset=false
	fi
	if [ "$confdirset" != "direct" ] && [[  -e "$confdir/options" ]] ; then
		if grep -q '^confdir ' -- "$confdir/options" 2>/dev/null ; then
			confdir="$(grep '^confdir ' -- "$confdir/options" 2>/dev/null | sed -e 's/^confdir  *//')"
		elif [ "$basedirset" = "false" ] \
		     &&  grep -q '^basedir ' -- "$confdir/options" 2>/dev/null ; then
		     	confdir="$(grep '^basedir ' -- "$confdir/options" 2>/dev/null | sed -e 's/^basedir *//')/conf"
		fi
	fi
}

function _reprepro_finddistributions ()
{
	_reprepro_calcconfdir
	distfile="$confdir"/distributions
	test -e "$distfile"
}

function _reprepro_findincoming ()
{
	_reprepro_calcconfdir
	incomingfile="$confdir"/incoming
	test -e "$incomingfile"
}

function _reprepro_grepdistfile ()
{
	_reprepro_finddistributions &&
		if test -d "$distfile" ; then
			sed -n -e 's#^'"$1"': \(.*\)#\1#p' "$distfile"/*.conf
		else
			sed -n -e 's#^'"$1"': \(.*\)#\1#p' "$distfile"
		fi
}

function _reprepro_architectures ()
{
	architectures=($(_reprepro_grepdistfile '[Aa][Rr][Cc][Hh][Ii][Tt][Ee][Cc][Tt][Uu][Rr][Ee][Ss]')) \
		|| architectures=(i386 m68k sparc alpha powerpc arm mips mipsel hppa ia64 s390 amd64 ppc64 sh armeb m32r hurd-i386 netbsd-i386 netbsd-alpha kfreebsd-gnu)
      	_wanted -V 'architectures' expl 'architecture' compadd -a architectures
}

function _reprepro_components ()
{
	components=($(_reprepro_grepdistfile '[Cc][Oo][Mm][Pp][Oo][Nn][Ee][Nn][Tt][Ss]')) \
		|| components=(main contrib non-free bad)
      	_wanted -V 'components' expl 'component' compadd -a components
}
function _reprepro_codenames () {
	codenames=($(_reprepro_grepdistfile '[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]')) \
	|| codenames=(sid lenny etch sarge unstable testing stable local)
      	_wanted -V 'codenames' expl 'codename' compadd -a codenames
}
function _reprepro_identifiers () {
	_reprepro_finddistributions \
		&& list=($(if test -d "$distfile" ; then set -- "$distfile"/*.conf ;
			   else set -- "$distfile" ; fi && awk '
			/^$/ {for(a=2;a<=acount;a++){
				for(c=2;c<=ccount;c++){
				print codename "|" components[c] "|" architectures[a]
				}
				if( architectures[a] != "source" ) {
				for(c=2;c<=uccount;c++){
				print "u|" codename "|" ucomponents[c] "|" architectures[a]
				}
				}
			     }; acount=0;ccount=0;ucount=0}
			/^[Cc][Oo][Mm][Pp][Oo][Nn][Ee][Nn][Tt][Ss]: / {ccount = split($0,components); next}
			/^[Uu][Dd][Ee][Bb][Cc][Oo][Mm][Pp][Oo][Nn][Ee][Nn][Tt][Ss]: / {uccount = split($0,ucomponents); next}
			/^[Aa][Rr][Cc][Hh][Ii][Tt][Ee][Cc][Tt][Uu][Rr][Ee][Ss]: / {acount = split($0,architectures); next}
			/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {codename = $2; next}
			END {for(a=2;a<=acount;a++){
				for(c=2;c<=ccount;c++){
				print codename "|" components[c] "|" architectures[a]
				}
				if( architectures[a] != "source" ) {
				for(c=2;c<=uccount;c++){
				print "u|" codename "|" ucomponents[c] "|" architectures[a]
				}
				}
			     }; acount=0;ccount=0;ucount=0}
			{next}
			' "$@" )) \
		|| list=(identifier)
  	_wanted -V 'identifiers' expl 'identifier' compadd -a list
}
function _reprepro_incomings () {
	_reprepro_findincoming \
	&& list=($(if test -d "$incomingfile" ; then set -- "$incomingfile"/*.conf ; else set -- "$incomingfile" ; fi && awk '/^[Nn][Aa][Mm][Ee]: / {print $2}' "$@")) \
	|| list=(rule-name)
      	_wanted -V 'rule names' expl 'rule name' compadd -a list
}
function _reprepro_incomingdir () {
	local rulename=$1
	shift
	_reprepro_findincoming \
	&& incomingdir=($(if test -d "$incomingfile" ; then set -- "$incomingfile"/*.conf ; else set -- "$incomingfile" ; fi && awk '
		/^[Ii][Nn][Cc][Oo][Mm][Ii][Nn][Gg][Dd][Ii][Rr]: / {dir=$2; next}
		/^[Nn][Aa][Mm][Ee]: / {name=$2; next}
		/^$/ { if( name="'"$rulename"'" ) { print dir } ; next } 
		END { if( name="'"$rulename"'" ) { print dir }}
		{next}
		' "$@"))
	# needs to be an array, as it might not be absolute...
	list=( $incomingdir )
}
function _reprepro_package_names () {
#todo get package names?...
      		_wanted -V 'package names' expl 'package name' compadd name
}
function _reprepro_source_package_names () {
#todo get package names?...
      	_wanted -V 'source package names' expl 'source package name' compadd name
}

commands=(
	build-needing:"list packages likely needing a build"
	check:"check if all references are correct"
	checkpool:"check if all files are still there and correct"
	checkpull:"check what would be pulled"
	checkupdate:"check what would be updated"
	cleanlists:"clean unneeded downloaded list files"
	clearvanished:"remove empty databases"
	collectnewchecksums:"calculate missing file hashes"
	copy:"copy a package from one distribution to another"
	copyfilter:"copy packages from one distribution to another"
	copymatched:"copy packages from one distribution to another"
	copysrc:"copy packages belonging to a specific source from one distribution to another"
	createsymlinks:"create suite symlinks"
	deleteunreferenced:"delete files without reference"
	dumpreferences:"dump reference information"
	dumppull:"dump what would be pulled"
	dumptracks:"dump tracking information"
	dumpupdate:"dump what would be updated"
	dumpunreferenced:"dump files without reference (i.e. unneded)"
	export:"export index files"
	forcerepairdescriptions:"forcefully readd lost long descriptions from .deb file"
	flood:"copy architecture all packages within a distribution"
	generatefilelists:"pre-prepare filelist caches for all binary packages"
	gensnapshot:"generate a snapshot"
	includedeb:"include a .deb file"
	includedsc:"include a .dsc file"
	include:"include a .changes file"
	includeudeb:"include a .udeb file"
	listfilter:"list packages matching filter"
	listmatched:"list packages matching filter"
	list:"list packages"
	ls:"list versions of package"
	lsbycomponent:"list versions of package (grouped by component)"
	predelete:"delete what would be removed or superseded by an update"
	processincoming:"process files from an incoming directory"
	pull:"update from another local distribtuion"
	removealltracks:"remove tracking information"
	remove:"remove packages"
	removefilter:"remove packages matching a formula"
	removematched:"remove packages matching a glob"
	removesrc:"remove packages belonging to a source package"
	removesrcs:"remove packages belonging to names source packages"
	removetrack:"remove a single tracking data"
	reoverride:"apply override information to already existing packages"
	repairdescriptions:"readd lost long descriptions from .deb file"
	reportcruft:"report source packages without binaries and vice versa"
	rereference:"recreate references"
	rerunnotifiers:"call notificators as if all packages were just included"
	restore:"restore a package from a distribution's snapshot"
	restorefilter:"restore packages matching a filter from a snapshot"
	restorematched:"restore packages matching a glob from a snapshot"
	restoresrc:"restore packages belonging to a specific source from a snapshot"
	retrack:"refresh tracking information"
	sourcemissing:"list binary packages with no source package"
	tidytracks:"look for files referened by tracks but no longer needed"
	translatefilelists:"translate pre-3.0.0 contents.cache.db into new format"
	translatelegacychecksums:"get rid of obsolete files.db"
	unreferencesnapshot:"no longer mark files used by an snapshot"
	unusedsources:"list source packages with no binary packages"
	update:"update from external source"
   	)
hiddencommands=(
	__dumpuncompressors:"list what external uncompressors are available"
	__extractcontrol:"extract the control file from a .deb file"
	__extractfilelist:"extract the filelist from a .deb file"
	__extractsourcesection:"extract source and priority from a .dsc"
	__uncompress:"uncompress a file"
	_addchecksums:"add checksums to database"
	_addmd5sums:"add checksums to database"
	_addreference:"mark a filekey needed by an identifier"
	_addreferences:"mark multiple filekeys needed by an identifier"
	_detect:"look if the file belonging to a filekey exists and add to the database."
	_dumpcontents:"output contents of a part of the repository"
	_fakeemptyfilelist:"create an empty fake filelist cache item for a filekey"
	_forget:"forget a file specified by filekey."
	_listchecksums:"print a list of filekeys and their checksums"
	_listcodenames:"list configured codenames"
	_listconfidentifiers:"list parts of the repository in the configuration"
	_listdbidentifiers:"list parts of the repository in the database"
	_listmd5sums:"print a list of filekeys and their md5 hashes"
	_removereference:"manuall remove a reference"
	_removereferences:"remove all references by an identifier"
    	)

_arguments \
	'*'{-v,-V,--verbose}'[be more verbose]' \
	'*--silent[be less verbose]' \
	'*--delete[Delete files after inclusion]' \
	'(-b --basedir)'{-b,--basedir}'[Base drectory]:basedir:_files -/' \
	'--outdir[Directory where pool and dist are in]:out dir:_files -/' \
	'--confdir[Directory where config files are]:config dir:_files -/' \
	'--distdir[Directory where index files will be exported to]:dist dir:_files -/' \
	'--logdir[Directory where log files will be generated]:log dir:_files -/' \
	'--morguedir[Directory where files removed from the pool are stored]:morgue dir:_files -/' \
	'--dbdir[Directory where the database is stored]:database dir:_files -/' \
	'--listdir[Directory where downloaded index files will be stored]:list dir:_files -/' \
	'--methoddir[Directory to search apt methods in]:method dir:_files -/' \
	'(-C --component)'{-C,--component}'[Override component]:component:{_reprepro_components}' \
	'(-A --architecture)'{-A,--architecture}'[Limit to a specific architecture]:architecture:{_reprepro_architectures}' \
	'(-T --type)'{-T,--type}'[Limit to a specific type]:file type:(dsc deb udeb)' \
	'(-S --section)'{-S,--section}'[Override section]:section:(admin base comm contrib devel doc editors electronics embedded games gnome graphics hamradio interpreters kde libs libdevel mail math misc net news non-free oldlibs otherosfs perl python science shells sound tex text utils web x11 contrib/admin contrib/base contrib/comm contrib/contrib contrib/devel contrib/doc contrib/editors contrib/electronics contrib/embedded contrib/games contrib/gnome contrib/graphics contrib/hamradio contrib/interpreters contrib/kde contrib/libs contrib/libdevel contrib/mail contrib/math contrib/misc contrib/net contrib/news contrib/non-free contrib/oldlibs contrib/otherosfs contrib/perl contrib/python contrib/science contrib/shells contrib/sound contrib/tex contrib/text contrib/utils contrib/web contrib/x11 non-free/admin non-free/base non-free/comm non-free/contrib non-free/devel non-free/doc non-free/editors non-free/electronics non-free/embedded non-free/games non-free/gnome non-free/graphics non-free/hamradio non-free/interpreters non-free/kde non-free/libs non-free/libdevel non-free/mail non-free/math non-free/misc non-free/net non-free/news non-free/non-free non-free/oldlibs non-free/otherosfs non-free/perl non-free/python non-free/science non-free/shells non-free/sound non-free/tex non-free/text non-free/utils non-free/web non-free/x11)' \
	'(-P --priority)'{-P,--priority}'[Override priority]:priority:(required important standard optional extra)' \
	'--export=[]:when:(silent-never never changed lookedat force)' \
	'*--ignore=[Do ignore errors of some type]:error type:((\
		ignore\:"ignore unknown ignore tags"\
		flatandnonflat\:"ignore warnings about flat and non-flat distribution"\
		forbiddenchar\:"allow more 7bit characters for names and versions"\
		8bit\:"allow 8 bit characters"\
		emptyfilenamepart\:"allow strings used to construct filenames to be empty"\
		spaceonlyline\:"do not warn about lines containing only spaces"\
		malformedchunk\:"ignore lines without colons"\
		unknownfield\:"ignore unknown fields"\
		wrongdistribution\:"put .changes files in distributed they were not made for"\
		wrongarchitecture\:"do not warn about wrong Architecture fields in downloaded Packages files"\
		missingfield\:"allow missing fields"\
		brokenold\:"ignore broken packages in database"\
		brokenversioncmp\:"ignore versions not parseable"\
		extension\:"ignore unexpected suffixes of files"\
		unusedarch\:"allow changes files to list architectures not used"\
		unusedoption\:"ignore command line options not used by an action"\
		undefinedtarget\:"allow unspecified package databases"\
		undefinedtracking\:"allow unspecified tracking databases"\
		surprisingarch\:"do not protest when a changes file does not list a architecture it has files for"\
		surprisingbinary\:"do not demand a .changes Binaries header to list all binaries"\
		wrongsourceversion\:"do not demand coherent source versions in a .changes"\
		wrongversion\:"do not demand coherent version of source packages in a .changes"\
		dscinbinnmu\:"do not reject source files in what looks like a binMNU"\
		brokensignatures\:"ignore corrupted signatures if there is a valid one"\
		uploaders\:"allow even when forbidden by uploaders file"\
		missingfile\:"include commands search harder for missing files like .orig.tar.gz"\
		expiredkey\:"allow signatures with expired keys"\
		expiredsignature\:"allow expired signatures"\
		revokedkey\:"allow signatures with revoked keys"\
		oldfile\:"silence warnings about strange old files in dists"\
		longkeyid\:"do not warn about keyid in uploaders files gpgme might not accept"\
		))' \
	'*--unignore=[Do not ignore errors of type]:error type:(
		ignore flatandnonflat forbiddenchar 8bit emptyfilenamepart\
		spaceonlyline malformedchunk unknownfield unusedoption\
		wrongdistribution missingfield brokenold brokenversioncmp\
		extension unusedarch surprisingarch surprisingbinary\
		wrongsourceversion wrongversion brokensignatures\
		missingfile uploaders undefinedtarget undefinedtracking\
		expiredkey expiredsignature revokedkey wrongarchitecture)' \
	'--waitforlock=[Time to wait if database is locked]:count:(0 3600)' \
	'--spacecheck[Mode for calculating free space before downloading packages]:behavior:(full none)' \
	'--dbsafetymargin[Safety margin for the partition with the database]:bytes count:' \
	'--safetymargin[Safety margin per partition]:bytes count:' \
	'--gunzip[external Program to extract .gz files]:gunzip binary:_files' \
	'--bunzip2[external Program to extract .bz2 files]:bunzip binary:_files' \
	'--unlzma[external Program to extract .lzma files]:unlzma binary:_files' \
	'--unxz[external Program to extract .xz files]:unxz binary:_files' \
	'--lunzip[external Program to extract .lz files]:lunzip binary:_files' \
	'--list-format[Format for list output]:listfilter format:' \
	'--list-skip[Number of packages to skip in list output]:list skip:' \
	'--list-max[Maximum number of packages in list output]:list max:' \
	'(--nonothingiserror)--nothingiserror[Return error code when nothing was done]' \
	'(--listsdownload --nonolistsdownload)--nolistsdownload[Do not download Release nor index files]' \
	'(--nokeepunneededlists)--keepunneededlists[Do not delete list/ files that are no longer needed]' \
	'(--nokeepunreferencedfiles)--keepunreferencedfiles[Do not delete files that are no longer used]' \
	'(--nokeepunusednewfiles)--keepunusednewfiles[Do not delete newly added files that later were found to not be used]' \
	'(--nokeepdirectories)--keepdirectories[Do not remove directories when they get empty]' \
	'(--nokeeptemporaries)--keeptemporaries[When exporting fail do not remove temporary files]' \
	'(--noask-passphrase)--ask-passphrase[Ask for passphrases (insecure)]' \
  	'(--nonoskipold --skipold)--noskipold[Do not ignore parts where no new index file is available]' \
	'(--guessgpgtty --nonoguessgpgtty)--noguessgpgtty[Do not set GPG_TTY variable even when unset and stdin is a tty]' \
	':reprepro command:->commands' \
	'2::arguments:->first' \
	'3::arguments:->second' \
	'4::arguments:->third' \
	'*::arguments:->argument' && return 0

case "$state" in
 (commands)
	if [[ -prefix _* ]] ; then
		_describe "reprepro command" hiddencommands
	else
		_describe "reprepro command" commands
	fi
	;;

 (first argument|second argument|third argument|argument)
	case "$words[1]" in
	 (export|update|checkupdate|predelete|pull|checkpull|check|reoverride|repairdescriptions|forcerepairdescriptions|rereference|dumptracks|retrack|removealltracks|tidytracks|dumppull|dumpupdate|rerunnotifiers|unusedsources|sourcemissing|reportcruft)
		_reprepro_codenames
		;;
	 (checkpool)
		if [[ "$state" = "first argument" ]] ; then
      			_wanted -V 'modifiers' expl 'modifier' compadd fast
		fi
		;;

	 (cleanlists|clearvanished|dumpreferences|dumpunreferened|deleteunreferenced|_listmd5sums|_listchecksums|_addmd5sums|_addchecksums|__dumpuncompressors|transatelegacychecksums|_listcodenames)
		;;
	 (_dumpcontents|_removereferences)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_identifiers
		fi
		;;
	  (_removereference)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_identifiers
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_filekeys
		fi
		;;
	 (list|listfilter|listmatched)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		fi
		;;
	 (remove)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		else
			_reprepro_package_names "$words[2]"
		fi
		;;
	 # removesrcs might be improveable...
	 (removesrc|removesrcs)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		else
			_reprepro_source_package_names "$words[2]"
		fi
		;;
	 (removefilter|removematched)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		fi
		;;
	 (gensnapshot|unreferencesnapshot)
		# TODO: for unreferencesnapshot get instead a list of existing ones
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
      			_wanted -V 'snapshot names' expl 'snapshot name' compadd $(date -I)
		fi
		;;
	 (removetrack)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_source_package_names "$words[2]"
		elif [[ "$state" = "third argument" ]] ; then
#and version...
		fi
		;;
	 (includedeb)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_files -g "*.deb"
		fi
		;;
	 (includedsc)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_files -g "*.dsc"
		fi
		;;
	 (__extractsourcesection)
		if [[ "$state" = "first argument" ]] ; then
			_files -g "*.dsc"
		fi
		;;
	 (copy|copysrc|copyfilter|copymatched)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_codenames
		fi
		;;
	 (restore|restoresrc|restorefilter|restorematched)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
# TODO:
#		elif [[ "$state" = "second argument" ]] ; then
#			_reprepro_codenames
		fi
		;;
	 (include)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_files -g "*.changes"
		fi
		;;
	 (__extractfilelist|__extractcontrol)
		_files -g "*.deb"
		;;
	 (processincoming)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_incomings
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_incomingdir "$words[2]" \
			&& _files -g "*.changes" -W list \
			|| _files -g "*.changes"
		fi
		;;
	  (_detect|_forget)
		_reprepro_filekeys
		;;
	  (_fakeemptyfilelist)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_filekeys
		fi
		;;
	  (_addreference)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_filekeys
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_identifiers
		fi
		;;
	  (_addreferences)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_identifiers
		else
			_reprepro_filekeys
		fi
		;;
	  (__uncompress)
		if [[ "$state" = "first argument" ]] ; then
			uncompressions=(.gz .bz2 .lzma .xz .lz)
		      	_wanted -V 'uncompressions' expl 'uncompression' compadd -a uncompressions
		elif [[ "$state" = "second argument" ]] ; then
			_files
		elif [[ "$state" = "third argument" ]] ; then
			_files
		fi
	  	;;
	  (build-needing)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_architectures
##TODO		elif [[ "$state" = "third argument" ]] ; then
##TODO			_reprepro_glob
		fi
	  	;;
	  (flood)
		if [[ "$state" = "first argument" ]] ; then
			_reprepro_codenames
		elif [[ "$state" = "second argument" ]] ; then
			_reprepro_architectures
		fi
	  	;;
	 (*)
    		_files
	   	;;
	esac
	;;
esac