This file is indexed.

/etc/bash_completion.d/reprepro is in reprepro 4.16.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
_reprepro()
{
	local cur prev commands options noargoptions i state cmd ignores hiddencommands commands codenames confdir outdir basedir architectures components importrules snapshots

	confdir=""
	basedir=""
	outdir=""

	function parse_config() {
		local conffile distfile
		if [[ -n "$confdir" ]] ; then
			conffile="$confdir/options"
			distfile="$confdir/distributions"
		elif [[ -n "$basedir" ]] ; then
			conffile="$basedir/conf/options"
			distfile="$basedir/conf/distributions"
		else
			conffile="./conf/options"
			distfile="./conf/distributions"
		fi
		if [ -z "$confdir" ] && [[ -e "$conffile" ]] ; then
			if grep -q '^confdir ' -- "$conffile" 2>/dev/null ; then
				distfile="$(grep '^confdir ' -- "$conffile" 2>/dev/null | sed -e 's/^confdir *//')/distributions"
			elif [ -z "$basedir" ] && grep -q '^basedir ' -- "$conffile" 2>/dev/null  ; then
				distfile="$(grep '^basedir ' -- "$conffile" 2>/dev/null | sed -e 's/^basedir *//')/conf/distributions"
			fi
		fi
		if [[ -d "$distfile" ]] ; then
			codenames="$(awk -- '/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {$1="";print}' "$distfile"/*.conf)"
			architectures="$(awk -- '/^[Aa][Rr][Cc][Hh][Ii][Tt][Ee][Cc][Tt][Uu][Rr][Ee][Ss]: / {$1="";print}' "$distfile"/*.conf)"
			components="$(awk -- '/^[Cc][Oo][Mm][Pp][Oo][Nn][Ee][Nn][Tt][Ss]: / {$1="";print}' "$distfile"/*.conf)"
		elif [[ -e "$distfile" ]] ; then
			codenames="$(awk -- '/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {$1="";print}' "$distfile")"
			architectures="$(awk -- '/^[Aa][Rr][Cc][Hh][Ii][Tt][Ee][Cc][Tt][Uu][Rr][Ee][Ss]: / {$1="";print}' "$distfile")"
			components="$(awk -- '/^[Cc][Oo][Mm][Pp][Oo][Nn][Ee][Nn][Tt][Ss]: / {$1="";print}' "$distfile")"
		else
			codenames="experimental woody sarge sid etch whatever-you-defined"
			architectures="source i386 abacus whatever-you-defined"
			components="main contrib non-free whatever-you-defined"
		fi
	}
	function parse_config_for_distdir() {
		local conffile
		if [[ -n "$confdir" ]] ; then
			conffile="$confdir/options"
		elif [[ -n "$basedir" ]] ; then
			conffile="$basedir/conf/options"
		else
			conffile="./conf/options"
		fi
		if [ -z "$basedir" ] && [[ -e "$conffile" ]] ; then
			if grep -q '^basedir ' -- "$conffile" 2>/dev/null ; then
				basedir="$(grep '^basedir ' -- "$conffile" 2>/dev/null | sed -e 's/^basedir *//')"
			fi
		fi
		if [ -z "$outdir" ] && [[ -e "$conffile" ]] ; then
			if grep -q '^outdir ' -- "$conffile" 2>/dev/null ; then
				outdir="$(grep '^outdir ' -- "$conffile" 2>/dev/null | sed -e 's/^outdir *//')"
			fi
		fi
		if [ -z "$distdir" ] && [[ -e "$conffile" ]] ; then
			if grep -q '^distdir ' -- "$conffile" 2>/dev/null ; then
				distdir="$(grep '^distdir ' -- "$conffile" 2>/dev/null | sed -e 's/^distdir *//')"
			fi
		fi
		if [ -z "$basedir" ] ; then
			basedir="."
		fi
		if [ -z "$outdir" ] && ! [ -z "$basedir" ] ; then
			outdir="$basedir"
		fi
		if [ -z "$distdir" ] && ! [ -z "$outdir" ] ; then
			distdir="$outdir/dists"
		fi
	}
	function parse_incoming() {
		local conffile incomingfile
		if [[ -n "$confdir" ]] ; then
			conffile="$confdir/options"
			incomingfile="$confdir/incoming"
		elif [[ -n "$basedir" ]] ; then
			conffile="$basedir/conf/options"
			incomingfile="$basedir/conf/incoming"
		else
			conffile="./conf/options"
			incomingfile="./conf/incoming"
		fi
		if [ -z "$confdir" ] && [[ -e "$conffile" ]] ; then
			if grep -q '^confdir ' -- "$conffile" 2>/dev/null ; then
				incomingfile="$(grep '^confdir ' -- "$conffile" 2>/dev/null | sed -e 's/^confdir //')/incoming"
			elif [ -z "$basedir" ] && grep -q '^basedir ' -- "$conffile" 2>/dev/null  ; then
				incoming="$(grep '^basedir ' -- "$conffile" 2>/dev/null | sed -e 's/^basedir //')/conf/incoming"
			fi
		fi
		if [[ -d "$incomingfile" ]] ; then
			importrules="$(awk -- '/^[Nn][Aa][Mm][Ee]: / {$1="";print}' "$incomingfile"/*.conf)"
		elif [[ -e "$incomingfile" ]] ; then
			importrules="$(awk -- '/^[Nn][Aa][Mm][Ee]: / {$1="";print}' "$incomingfile")"
		else
			importrules="rule-name"
		fi
	}

	COMPREPLY=()

	ignores='ignore flatandnonflat forbiddenchar 8bit emptyfilenamepart\
		spaceonlyline malformedchunk unknownfield\
		wrongdistribution missingfield brokenold\
		undefinedtracking undefinedtarget unusedoption\
		brokenversioncmp extension unusedarch surprisingarch\
		surprisingbinary wrongsourceversion wrongversion dscinbinnmu\
		brokensignatures uploaders missingfile longkeyid\
	       	expiredkey expiredsignature revokedkey oldfile wrongarchitecture'
	noargoptions='--delete --nodelete --help -h --verbose -v\
	--nothingiserror --nolistsdownload --keepunreferencedfiles --keepunusednewfiles\
	--keepdirectories --keeptemporaries --keepuneededlists\
	--ask-passphrase --nonothingiserror --listsdownload\
	--nokeepunreferencedfiles --nokeepdirectories --nokeeptemporaries\
	--nokeepuneededlists --nokeepunusednewfiles\
	--noask-passphrase --skipold --noskipold --show-percent \
	--version --guessgpgtty --noguessgpgtty --verbosedb --silent -s --fast'
	options='-b -i --basedir --outdir --ignore --unignore --methoddir --distdir --dbdir\
	--listdir --confdir --logdir --morguedir \
	--section -S --priority -P --component -C\
	--architecture -A --type -T --export --waitforlock \
	--spacecheck --safetymargin --dbsafetymargin\
	--gunzip --bunzip2 --unlzma --unxz --lunzip --gnupghome --list-format --list-skip --list-max\
	--outhook --endhook'

	i=1
	prev=""
	cmd="XYZnoneyetXYZ"
	while [[ $i -lt $COMP_CWORD ]] ; do
		cur=${COMP_WORDS[i]}
		prev=""
		case "$cur" in
			--basedir=*)
				basedir="${cur#--basedir=}"
				i=$((i+1))
				;;
			--outdir=*)
				outdir="${cur#--basedir=}"
				i=$((i+1))
				;;
			--distdir=*)
				distdir="${cur#--basedir=}"
				i=$((i+1))
				;;
			--confdir=*)
				confdir="${cur#--confdir=}"
				i=$((i+1))
				;;
			--*=*)
				i=$((i+1))
				;;
			-b|--basedir)
				prev="$cur"
				basedir="${COMP_WORDS[i+1]}"
				i=$((i+2))
				;;
			--outdir)
				prev="$cur"
				outdir="${COMP_WORDS[i+1]}"
				i=$((i+2))
				;;
			--distdir)
				prev="$cur"
				distdir="${COMP_WORDS[i+1]}"
				i=$((i+2))
				;;
			--confdir)
				prev="$cur"
				confdir="${COMP_WORDS[i+1]}"
				i=$((i+2))
				;;
			-i|--ignore|--unignore|--methoddir|--distdir|--dbdir|--listdir|--section|-S|--priority|-P|--component|-C|--architecture|-A|--type|-T|--export|--waitforlock|--spacecheck|--checkspace|--safetymargin|--dbsafetymargin|--logdir|--gunzip|--bunzip2|--unlzma|--unxz|--lunzip|--gnupghome|--morguedir)

				prev="$cur"
				i=$((i+2))
				;;
			--*|-*)
				i=$((i+1))
				;;
			*)
				cmd="$cur"
				i=$((i+1))
				break
				;;
		esac
	done
	cur=${COMP_WORDS[COMP_CWORD]}
	if [[ $i -gt $COMP_CWORD && -n "$prev" ]]; then
		case "$prev" in
			-b|--basedir|--outdir|--methoddir|--distdir|--dbdir|--listdir|--confdir)
        			COMPREPLY=( $( compgen -d  -- $cur ) )

				return 0
				;;
			-T|--type)
        			COMPREPLY=( $( compgen -W "dsc deb udeb"  -- $cur ) )
				return 0
				;;
			-i|--ignore|--unignore)
        			COMPREPLY=( $( compgen -W "$ignores"  -- $cur ) )
				return 0
				;;
			-P|--priority)
        			COMPREPLY=( $( compgen -W "required important standard optional extra" -- $cur ) )
				return 0
				;;
			-S|--section)
        			COMPREPLY=( $( compgen -W "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"  -- $cur ) )
				return 0
				;;
			-A|--architecture)
				parse_config
        			COMPREPLY=( $( compgen -W "$architectures" -- $cur ) )
				return 0
				;;
			-C|--component)
				parse_config
        			COMPREPLY=( $( compgen -W "$components" -- $cur ) )
				return 0
				;;
			--export)
        			COMPREPLY=( $( compgen -W "never changed normal force" -- $cur ) )
				return 0
				;;
			--waitforlock)
        			COMPREPLY=( $( compgen -W "0 60 3600 86400" -- $cur ) )
				return 0
				;;
			--spacecheck)
        			COMPREPLY=( $( compgen -W "none full" -- $cur ) )
				return 0
				;;
			--safetymargin)
        			COMPREPLY=( $( compgen -W "0 1048576" -- $cur ) )
				return 0
				;;
			--dbsafetymargin)
        			COMPREPLY=( $( compgen -W "0 104857600" -- $cur ) )
				return 0
				;;
		esac
	fi

	if [[ "XYZnoneyetXYZ" = "$cmd" ]] ; then
		commands='build-needing\
			check\
			checkpool\
			checkpull\
			checkupdate\
			cleanlists\
			clearvanished\
			collectnewchecksums\
			copy\
			copyfilter\
			copymatched\
			copysrc\
			createsymlinks\
			deleteunreferenced\
			deleteifunreferenced\
			dumpreferences\
			dumptracks\
			dumppull\
			dumpunreferenced\
			dumpupdate\
			export\
			forcerepairdescriptions\
			flood\
			generatefilelists\
			gensnapshot\
			include\
			includedeb\
			includedsc\
			includeudeb\
			list\
			listfilter\
			listmatched\
			ls\
			lsbycomponent\
			predelete\
			processincoming\
			pull\
			remove\
			removealltracks\
			removefilter\
			removematched\
			removesrc\
			removesrcs\
			removetrack\
			reoverride\
			repairdescriptions\
			reportcruft\
			rereference\
			rerunnotifiers\
			restore\
			restorefilter\
			restorematched\
			restoresrc\
			retrack\
			sourcemissing\
			tidytracks\
			translatefilelists\
			translatelegacychecksums\
			unusedsources\
			update'
		hiddencommands='__d\
			__dumpuncompressors
	       		__extractcontrol\
		       	__extractfilelist\
			__extractsourcesection\
			__uncompress\
		       	_addchecksums\
			_addpackage\
		       	_addreference\
			_addreferences\
		       	_detect\
		       	_dumpcontents\
		       	_fakeemptyfilelist\
		       	_forget\
		       	_listchecksums\
		       	_listconfidentifiers\
		       	_listdbidentifiers\
			_listmd5sums\
			_removereferences\
		       	_versioncompare'

		if [[ "$cur" == -* ]]; then
			case "$cur" in 
				--ignore=*)
					COMPREPLY=( $( compgen -W "$ignores"  -- ${cur#--ignore=} ) )
					;;
				--unignore=*)
					COMPREPLY=( $( compgen -W "$ignores"  -- ${cur#--unignore=} ) )
					;;
				--component=*)
					parse_config
        				COMPREPLY=( $( compgen -W "$components" -- {cur#--component=} ) )
					;;
				--architectures=*)
					parse_config
        				COMPREPLY=( $( compgen -W "$architectures" -- {cur#--architectures=} ) )
					;;

				*)
					COMPREPLY=( $( compgen -W "$options $noargoptions" -- $cur ) )
					;;
			esac
		elif [[ "$cur" == _* ]]; then
			COMPREPLY=( $( compgen -W "$hiddencommands" -- $cur ) )
		else
			COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
		fi
		return 0
	fi

	case "$cmd" in
		remove|list|listfilter|removefilter|removetrack|listmatched|removematched|removesrc|removesrcs)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# these later could also look for stuff, but
			# that might become a bit slow
			;;
		export|update|checkupdate|pull|checkpull|rereference|retrack|removealltracks|tidytracks|dumptracks|check|repairdescriptions|forcerepairdescriptions|reoverride|rerunnotifiers|dumppull|dumpupdate|unusedsources|sourcemissing|reportcruft)
			# all arguments are codenames
			parse_config
			COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
			return 0
			;;

		processincoming)
			# arguments are rule-name from conf/incoming
			parse_config
			parse_incoming
			if [[ $i -eq $COMP_CWORD ]] ; then
				COMPREPLY=( $( compgen -W "$importrules" -- $cur ) )
				return 0
			fi
			;;

		collectnewchecksums|cleanlists)
			return 0
			;;

		checkpool)
			# first argument can be fast
			if [[ $i -eq $COMP_CWORD ]] ; then
				COMPREPLY=( $( compgen -W "fast" -- $cur ) )
				return 0
			fi
			return 0
			;;
		flood)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then an architecture might follow
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				parse_config
        			COMPREPLY=( $( compgen -W "$architectures" -- $cur ) )
				return 0
			fi
			# then nothing else
			return 0
			;;
		build-needing)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then an architecture
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				parse_config
        			COMPREPLY=( $( compgen -W "$architectures" -- $cur ) )
				return 0
			fi
			# then a glob
			if [[ $(( $i + 2 )) -eq $COMP_CWORD ]] ; then
        			COMPREPLY=( $( compgen -W "$cur'\*'" -- $cur ) )
				return 0
			fi
			return 0
			;;
		__uncompress)
			# first argument is method
			if [[ $i -eq $COMP_CWORD ]] ; then
				COMPREPLY=( $( compgen -W ".gz .bz2 .lzma .xz .lz" -- $cur ) )
				return 0
			fi
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
					COMPREPLY=( $( compgen -f -- $cur ) )
					return 0
			fi
			if [[ $(( $i + 2 )) -eq $COMP_CWORD ]] ; then
					COMPREPLY=( $( compgen -f -- $cur ) )
					return 0
			fi
			return 0
			;;
		__extractsourcesection)
			if [[ $i -eq $COMP_CWORD ]] ; then
				_filedir dsc
			fi
			return 0
			;;
		includedeb)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then one .deb file follows
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				_filedir deb
			fi
			return 0
			;;
		includedsc)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then one .dsc file follows
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				_filedir dsc
			fi
			return 0
			;;
		include)
			# first argument is the codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then one .changes file follows
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				_filedir changes
			fi
			return 0
			;;
		gensnapshot)
			# first argument is a codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# then the name of a snapshot, add a suggestion
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				COMPREPLY=( $( compgen -W "$(date +%Y/%m/%d)" -- $cur ) )
				return 0
			fi
			return 0;
			;;
		copy|copysrc|copyfilter|copymatched)
			# first argument is a codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# second argument is a codename
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# here we could look for package names existing in
			# that distribution, but that would be slow...
			;;
		restore|restoresrc|restorefilter|restorematched)
			# first argument is a codename
			if [[ $i -eq $COMP_CWORD ]] ; then
				parse_config
				COMPREPLY=( $( compgen -W "$codenames" -- $cur ) )
				return 0
			fi
			# second argument is snapshot of that name
			if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
				parse_config_for_distdir
				snapshots="$( ls "$distdir/${COMP_WORDS[i]}/snapshots" )"
				COMPREPLY=( $( compgen -W "$snapshots" -- $cur ) )
				return 0
			fi
			# here we could look for package names existing in
			# that distribution, but that would be slow...
			;;
		__dumpuncompressors|translatelageacychecksums|deleteunreferenced)
			# no arguments
			return 0
			;;
		deleteifunreferenced)
			# less usefull than the output of dumpunreferenced,
			# but this way it should be massively faster:
			parse_config_for_distdir
			COMPREPLY=( $(cd "$outdir" && compgen -o filenames -f -- $cur) )
			return 0
			;;
	esac
	COMPREPLY=( $( compgen -f -- $cur ) )
	return 0
}
# This -o filename has its problems when there are directories named like
# commands in you current directory. But it makes adding filenames so much
# easier. I wished I knew a way to only active it for those parts that are
# filenames.
complete -o filenames -F _reprepro reprepro

_changestool()
{
	local cur prev commands options noargoptions i j cmd ignores wascreate changesfilename

	COMPREPLY=()

	ignores=' notyetimplemented '
	noargoptions='--help --create'
	options='--ignore --searchpath'
	wascreate=no

	i=1
	prev=""
	while [[ $i -lt $COMP_CWORD ]] ; do
		cur=${COMP_WORDS[i]}
		prev=""
		case "$cur" in
			--*=*)
				i=$((i+1))
				;;
			-i|--ignore|--unignore|-s|--searchpath)
				prev="$cur"
				i=$((i+2))
				;;
			--create|-c)
				i=$((i+1))
				wascreate=yes
				;;
			--*|-*)
				i=$((i+1))
				;;
			*)
				break
				;;
		esac
	done
	cur=${COMP_WORDS[COMP_CWORD]}
	if [[ $i -gt $COMP_CWORD && -n "$prev" ]]; then
		case "$prev" in
			-i|--ignore|--unignore)
        			COMPREPLY=( $( compgen -W "$ignores"  -- $cur ) )
				return 0
				;;
			-s|--searchpath)
				COMPREPLY=( $( compgen -d  -- $cur ) )
				return 0
				;;
		esac
	fi

	if [[ $i -ge $COMP_CWORD ]] ; then
		# No changes filename yet specified:
		commands='addrawfile adddsc adddeb add includeallsources setdistribution updatechecksums verify'

		if [[ "$cur" == -* ]]; then
			case "$cur" in
				*)
					COMPREPLY=( $( compgen -W "$options $noargoptions" -- $cur ) )
					;;
			esac
			return 0
		fi
		if [ "$wascreate" = "yes" ] ; then
				_filedir
		else
				_filedir changes
		fi
		return 0
	fi
	changesfilename=${COMP_WORDS[i]}
	i=$((i+1))
	if [[ $i -ge $COMP_CWORD ]] ; then
		# No command yet specified:
		commands='addrawfile adddsc adddeb add includeallsources setdistribution updatechecksums verify'
		# todo: restrict to add commands when --create and file not yet existing?
		COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
		return 0
	fi
	cmd=${COMP_WORDS[i]}

	case "$cmd" in
# with searchpath it should also list the files available there,
# but I know no easy way to get that done...
		addrawfile)
				_filedir
				return 0
			;;
		adddsc)
				_filedir dsc
				return 0
			;;
		adddeb)
				_filedir deb
				return 0
			;;
		adddeb)
				_filedir
				return 0
			;;
		includeallsources)
			prev="$(grep '^ [0-9a-f]\{32\} \+[0-9]\+ \+[a-zA-Z/0-9.:-]\+ \+[a-zA-Z/0-9.:-]\+ \+[^ ]\+\.dsc$'  -- "$changesfilename" | sed -e 's/^ [0-9a-f]\+ \+[0-9]\+ \+[^ ]\+ \+[^ ]\+ \+//')"
			j=0
			options=()
			for i in $prev ; do
				if [ -f "$i" ] ; then
					options=(${options[@]:-} $(grep '^ [0-9a-f]\{32\} \+[0-9]\+ \+[^ ]\+$'  -- "$i" | sed -e 's/^ [0-9a-f]\+ \+[0-9]\+ \+//') )
				elif [ -f "$(dirname $changesfilename)/$i" ] ; then
					options=(${options[@]:-} $(grep '^ [0-9a-f]\{32\} \+[0-9]\+ \+[^ ]\+$'  -- "$(dirname $changesfilename)/$i" | sed -e 's/^ [0-9a-f]\+ \+[0-9]\+ \+//') )
				else
					cmd="missing"
				fi
			done
			COMPREPLY=( $( compgen -W "${options[@]}" -- $cur ) )
			# if some .dsc cannot be found or read, offer everythin additionally
			if [ "$cmd" = "missing" ] ; then
				_filedir
			fi
			return 0
			;;
		setdistribution)
			COMPREPLY=( $( compgen -W "unstable testing stable sarge etch lenny sid backports local" -- $cur ) )
			return 0
			;;
		updatechecksums)
			options="$(grep '^ [0-9a-f]\{32\} \+[0-9]\+ \+[a-zA-Z/0-9.:-]\+ \+[a-zA-Z/0-9.:-]\+ \+[^ ]\+$'  -- "$changesfilename" | sed -e 's/^ [0-9a-f]\+ \+[0-9]\+ \+[^ ]\+ \+[^ ]\+ \+//')"
			if [ -n "$options" ] ; then
				COMPREPLY=( $( compgen -W "$options" -- $cur ) )
			else
				_filedir
			fi
			return 0
			;;
		verify)
			return 0
			;;
	esac
	COMPREPLY=( $( compgen -f -- $cur ) )
	return 0
}
# same problem as above with -o filenames,
# but I guess still better than without...
complete -o filenames -F _changestool changestool