· 9 years ago · May 03, 2017, 09:42 PM
1BASH=/bin/bash
2BASH_ALIASES=()
3BASH_ARGC=()
4BASH_ARGV=()
5BASH_CMDS=()
6BASH_COMPLETION=/etc/bash_completion
7BASH_COMPLETION_DIR=/etc/bash_completion.d
8BASH_LINENO=()
9BASH_SOURCE=()
10BASH_VERSINFO=([0]="4" [1]="0" [2]="33" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
11BASH_VERSION='4.0.33(1)-release'
12COLORTERM=gnome-terminal
13COLUMNS=237
14COMP_WORDBREAKS=$' \t\n"\'><=;|&(:'
15DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-kai9iQx73q,guid=85eaf0d67cdb59410922ef504b70a8e2
16DESKTOP_SESSION=gnome
17DIRSTACK=()
18DISPLAY=:0.0
19EUID=1000
20GDMSESSION=gnome
21GDM_KEYBOARD_LAYOUT=us
22GDM_LANG=en_US.UTF-8
23GNOME_DESKTOP_SESSION_ID=this-is-deprecated
24GNOME_KEYRING_PID=2143
25GNOME_KEYRING_SOCKET=/tmp/keyring-QTfVLA/socket
26GPG_AGENT_INFO=/tmp/seahorse-cQAIRA/S.gpg-agent:2226:1
27GROUPS=()
28GTK_MODULES=canberra-gtk-module
29GTK_RC_FILES=/etc/gtk/gtkrc:/home/maulin/.gtkrc-1.2-gnome2
30HISTCONTROL=ignoreboth
31HISTFILE=/home/maulin/.bash_history
32HISTFILESIZE=500
33HISTSIZE=500
34HOME=/home/maulin
35HOSTNAME=mayhem
36HOSTTYPE=i486
37IFS=$' \t\n'
38LANG=en_US.UTF-8
39LESSCLOSE='/usr/bin/lesspipe %s %s'
40LESSOPEN='| /usr/bin/lesspipe %s'
41LINES=63
42LOGNAME=maulin
43LS_COLORS='rs=0:di=01;34:ln=01;36:hl=44;37:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'
44MACHTYPE=i486-pc-linux-gnu
45MAILCHECK=60
46OLDPWD=/home/maulin/projects
47OPTERR=1
48OPTIND=1
49ORBIT_SOCKETDIR=/tmp/orbit-maulin
50OSTYPE=linux-gnu
51PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin:/home/maulin/projects/android/android-sdk-linux_86/tools
52PIPESTATUS=([0]="0")
53PPID=2444
54PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
55PS2='> '
56PS4='+ '
57PWD=/home/maulin/projects/Puppet
58SESSION_MANAGER=local/mayhem:@/tmp/.ICE-unix/2158,unix/mayhem:/tmp/.ICE-unix/2158
59SHELL=/bin/bash
60SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
61SHLVL=1
62SPEECHD_PORT=7560
63SSH_AGENT_PID=2201
64SSH_AUTH_SOCK=/tmp/keyring-QTfVLA/socket.ssh
65TERM=xterm
66UID=1000
67USER=maulin
68USERLAND=GNU
69USERNAME=maulin
70WINDOWID=25165827
71XAUTHORITY=/var/run/gdm/auth-for-maulin-HEb9g8/database
72XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
73XDG_SESSION_COOKIE=44ba0d19abb3d811320abbaf4a91bbb9-1265674465.394390-602045140
74_=rake
75__git_all_commandlist=$'add\ngrep\nread-tree\nhash-object\nrebase\nam\nhelp\nannotate\nhttp-fetch\nreceive-pack\napply\nhttp-push\nreflog\narchive\nimap-send\nrelink\nbisect\nindex-pack\nremote\ninit\nrepack\nblame\ninit-db\nrepo-config\nbranch\ninstaweb\nrequest-pull\nbundle\nlog\nrerere\ncat-file\nlost-found\nreset\ncheck-attr\nls-files\nrev-list\ncheck-ref-format\nls-remote\nrev-parse\ncheckout\nls-tree\nrevert\ncheckout-index\nmailinfo\nrm\ncherry\nmailsplit\nsend-pack\ncherry-pick\nmerge\nsh-setup\nclean\nmerge-base\nshell\nclone\nmerge-file\nshortlog\ncommit\nmerge-index\nshow\ncommit-tree\nmerge-octopus\nshow-branch\nconfig\nmerge-one-file\nshow-index\ncount-objects\nmerge-ours\nshow-ref\ndaemon\nmerge-recursive\nstage\ndescribe\nmerge-resolve\nstash\ndiff\nmerge-subtree\nstatus\ndiff-files\nmerge-tree\nstripspace\ndiff-index\nmergetool\nsubmodule\ndiff-tree\nsymbolic-ref\ndifftool\nmktag\ntag\nmktree\ntar-tree\nfast-export\nmv\nunpack-file\nfast-import\nname-rev\nunpack-objects\nfetch\npack-objects\nupdate-index\npack-redundant\nupdate-ref\nfetch-pack\npack-refs\nupdate-server-info\nfilter-branch\nparse-remote\nupload-archive\nfmt-merge-msg\npatch-id\nupload-pack\nfor-each-ref\npeek-remote\nvar\nformat-patch\nprune\nverify-pack\nfsck\nprune-packed\nverify-tag\nfsck-objects\npull\ngc\npush\nwhatchanged\nget-tar-commit-id\nquiltimport\nwrite-tree'
76__git_diff_common_options=$'--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --exit-code --quiet --ext-diff\n\t\t\t--no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience\n\t\t\t--raw\n'
77__git_fetch_options=$'\n\t--quiet --verbose --append --upload-pack --force --keep --depth=\n\t--tags --no-tags\n'
78__git_log_common_options=$'\n\t--not --all\n\t--branches --tags --remotes\n\t--first-parent --no-merges\n\t--max-count=\n\t--max-age= --since= --after=\n\t--min-age= --until= --before=\n'
79__git_log_date_formats='relative iso8601 rfc2822 short local default raw'
80__git_log_gitk_options=$'\n\t--dense --sparse --full-history\n\t--simplify-merges --simplify-by-decoration\n\t--left-right\n'
81__git_log_pretty_formats='oneline short medium full fuller email raw format:'
82__git_log_shortlog_options=$'\n\t--author= --committer= --grep=\n\t--all-match\n'
83__git_merge_options=$'\n\t--no-commit --no-stat --log --no-log --squash --strategy\n\t--commit --stat --no-squash --ff --no-ff\n'
84__git_merge_strategylist='file octopus ours recursive resolve subtree'
85__git_mergetools_common=$'diffuse ecmerge emerge kdiff3 meld opendiff\n\t\t\ttkdiff vimdiff gvimdiff xxdiff\n'
86__git_porcelain_commandlist=$'help\nadd\ngrep\nrebase\nam\nhelp\nannotate\napply\narchive\nimap-send\nrelink\nbisect\nremote\ninit\nrepack\nblame\nbranch\ninstaweb\nrequest-pull\nbundle\nlog\nreset\ncheckout\nrevert\nrm\ncherry\ncherry-pick\nmerge\nclean\nclone\nshortlog\ncommit\nshow\nshow-branch\nconfig\nstage\ndescribe\nstash\ndiff\nstatus\nmergetool\nsubmodule\ndifftool\ntag\nmv\nname-rev\nfetch\nfilter-branch\nformat-patch\nfsck\npull\ngc\npush\nwhatchanged\nget-tar-commit-id'
87__git_send_email_confirm_options='always never auto cc compose'
88__git_send_email_suppresscc_options='author self cc ccbody sob cccmd body all'
89__git_whitespacelist='nowarn warn error error-all fix'
90bash205='4.0.33(1)-release'
91bash205b='4.0.33(1)-release'
92bash3='4.0.33(1)-release'
93__git_aliased_command ()
94{
95 local word cmdline=$(git --git-dir="$(__gitdir)" config --get "alias.$1");
96 for word in $cmdline;
97 do
98 if [ "${word##-*}" ]; then
99 echo $word;
100 return;
101 fi;
102 done
103}
104__git_aliases ()
105{
106 local i IFS='
107';
108 for i in $(git --git-dir="$(__gitdir)" config --list);
109 do
110 case "$i" in
111 alias.*)
112 i="${i#alias.}";
113 echo "${i/=*/}"
114 ;;
115 esac;
116 done
117}
118__git_all_commands ()
119{
120 if [ -n "${__git_all_commandlist-}" ]; then
121 echo "$__git_all_commandlist";
122 return;
123 fi;
124 local i IFS=" "'
125';
126 for i in $(git help -a|egrep '^ ');
127 do
128 case $i in
129 *--*)
130 : helper pattern
131 ;;
132 *)
133 echo $i
134 ;;
135 esac;
136 done
137}
138__git_complete_file ()
139{
140 local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}";
141 case "$cur" in
142 ?*:*)
143 ref="${cur%%:*}";
144 cur="${cur#*:}";
145 case "$cur" in
146 ?*/*)
147 pfx="${cur%/*}";
148 cur="${cur##*/}";
149 ls="$ref:$pfx";
150 pfx="$pfx/"
151 ;;
152 *)
153 ls="$ref"
154 ;;
155 esac;
156 case "$COMP_WORDBREAKS" in
157 *:*)
158 : great
159 ;;
160 *)
161 pfx="$ref:$pfx"
162 ;;
163 esac;
164 local IFS='
165';
166 COMPREPLY=($(compgen -P "$pfx" -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" | sed '/^100... blob /{
167 s,^.* ,,
168 s,$, ,
169 }
170 /^120000 blob /{
171 s,^.* ,,
172 s,$, ,
173 }
174 /^040000 tree /{
175 s,^.* ,,
176 s,$,/,
177 }
178 s/^.* //')" -- "$cur"))
179 ;;
180 *)
181 __gitcomp "$(__git_refs)"
182 ;;
183 esac
184}
185__git_complete_remote_or_refspec ()
186{
187 local cmd="${COMP_WORDS[1]}";
188 local cur="${COMP_WORDS[COMP_CWORD]}";
189 local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0;
190 while [ $c -lt $COMP_CWORD ]; do
191 i="${COMP_WORDS[c]}";
192 case "$i" in
193 --all | --mirror)
194 [ "$cmd" = "push" ] && no_complete_refspec=1
195 ;;
196 -*)
197
198 ;;
199 *)
200 remote="$i";
201 break
202 ;;
203 esac;
204 c=$((++c));
205 done;
206 if [ -z "$remote" ]; then
207 __gitcomp "$(__git_remotes)";
208 return;
209 fi;
210 if [ $no_complete_refspec = 1 ]; then
211 COMPREPLY=();
212 return;
213 fi;
214 [ "$remote" = "." ] && remote=;
215 case "$cur" in
216 *:*)
217 case "$COMP_WORDBREAKS" in
218 *:*)
219 : great
220 ;;
221 *)
222 pfx="${cur%%:*}:"
223 ;;
224 esac;
225 cur="${cur#*:}";
226 lhs=0
227 ;;
228 +*)
229 pfx="+";
230 cur="${cur#+}"
231 ;;
232 esac;
233 case "$cmd" in
234 fetch)
235 if [ $lhs = 1 ]; then
236 __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur";
237 else
238 __gitcomp "$(__git_refs)" "$pfx" "$cur";
239 fi
240 ;;
241 pull)
242 if [ $lhs = 1 ]; then
243 __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur";
244 else
245 __gitcomp "$(__git_refs)" "$pfx" "$cur";
246 fi
247 ;;
248 push)
249 if [ $lhs = 1 ]; then
250 __gitcomp "$(__git_refs)" "$pfx" "$cur";
251 else
252 __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur";
253 fi
254 ;;
255 esac
256}
257__git_complete_revlist ()
258{
259 local pfx cur="${COMP_WORDS[COMP_CWORD]}";
260 case "$cur" in
261 *...*)
262 pfx="${cur%...*}...";
263 cur="${cur#*...}";
264 __gitcomp "$(__git_refs)" "$pfx" "$cur"
265 ;;
266 *..*)
267 pfx="${cur%..*}..";
268 cur="${cur#*..}";
269 __gitcomp "$(__git_refs)" "$pfx" "$cur"
270 ;;
271 *)
272 __gitcomp "$(__git_refs)"
273 ;;
274 esac
275}
276__git_complete_strategy ()
277{
278 case "${COMP_WORDS[COMP_CWORD-1]}" in
279 -s | --strategy)
280 __gitcomp "$(__git_merge_strategies)";
281 return 0
282 ;;
283 esac;
284 local cur="${COMP_WORDS[COMP_CWORD]}";
285 case "$cur" in
286 --strategy=*)
287 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}";
288 return 0
289 ;;
290 esac;
291 return 1
292}
293__git_find_subcommand ()
294{
295 local word subcommand c=1;
296 while [ $c -lt $COMP_CWORD ]; do
297 word="${COMP_WORDS[c]}";
298 for subcommand in $1;
299 do
300 if [ "$subcommand" = "$word" ]; then
301 echo "$subcommand";
302 return;
303 fi;
304 done;
305 c=$((++c));
306 done
307}
308__git_has_doubledash ()
309{
310 local c=1;
311 while [ $c -lt $COMP_CWORD ]; do
312 if [ "--" = "${COMP_WORDS[c]}" ]; then
313 return 0;
314 fi;
315 c=$((++c));
316 done;
317 return 1
318}
319__git_heads ()
320{
321 local cmd i is_hash=y dir="$(__gitdir "${1-}")";
322 if [ -d "$dir" ]; then
323 git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/heads;
324 return;
325 fi;
326 for i in $(git ls-remote "${1-}" 2>/dev/null);
327 do
328 case "$is_hash,$i" in
329 y,*)
330 is_hash=n
331 ;;
332 n,*^{})
333 is_hash=y
334 ;;
335 n,refs/heads/*)
336 is_hash=y;
337 echo "${i#refs/heads/}"
338 ;;
339 n,*)
340 is_hash=y;
341 echo "$i"
342 ;;
343 esac;
344 done
345}
346__git_merge_strategies ()
347{
348 if [ -n "${__git_merge_strategylist-}" ]; then
349 echo "$__git_merge_strategylist";
350 return;
351 fi;
352 git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{
353 s/\.$//
354 s/.*://
355 s/^[ ]*//
356 s/[ ]*$//
357 p
358 }'
359}
360__git_porcelain_commands ()
361{
362 if [ -n "${__git_porcelain_commandlist-}" ]; then
363 echo "$__git_porcelain_commandlist";
364 return;
365 fi;
366 local i IFS=" "'
367';
368 for i in "help" $(__git_all_commands);
369 do
370 case $i in
371 *--*)
372 : helper pattern
373 ;;
374 applymbox)
375 : ask gittus
376 ;;
377 applypatch)
378 : ask gittus
379 ;;
380 archimport)
381 : import
382 ;;
383 cat-file)
384 : plumbing
385 ;;
386 check-attr)
387 : plumbing
388 ;;
389 check-ref-format)
390 : plumbing
391 ;;
392 checkout-index)
393 : plumbing
394 ;;
395 commit-tree)
396 : plumbing
397 ;;
398 count-objects)
399 : infrequent
400 ;;
401 cvsexportcommit)
402 : export
403 ;;
404 cvsimport)
405 : import
406 ;;
407 cvsserver)
408 : daemon
409 ;;
410 daemon)
411 : daemon
412 ;;
413 diff-files)
414 : plumbing
415 ;;
416 diff-index)
417 : plumbing
418 ;;
419 diff-tree)
420 : plumbing
421 ;;
422 fast-import)
423 : import
424 ;;
425 fast-export)
426 : export
427 ;;
428 fsck-objects)
429 : plumbing
430 ;;
431 fetch-pack)
432 : plumbing
433 ;;
434 fmt-merge-msg)
435 : plumbing
436 ;;
437 for-each-ref)
438 : plumbing
439 ;;
440 hash-object)
441 : plumbing
442 ;;
443 http-*)
444 : transport
445 ;;
446 index-pack)
447 : plumbing
448 ;;
449 init-db)
450 : deprecated
451 ;;
452 local-fetch)
453 : plumbing
454 ;;
455 lost-found)
456 : infrequent
457 ;;
458 ls-files)
459 : plumbing
460 ;;
461 ls-remote)
462 : plumbing
463 ;;
464 ls-tree)
465 : plumbing
466 ;;
467 mailinfo)
468 : plumbing
469 ;;
470 mailsplit)
471 : plumbing
472 ;;
473 merge-*)
474 : plumbing
475 ;;
476 mktree)
477 : plumbing
478 ;;
479 mktag)
480 : plumbing
481 ;;
482 pack-objects)
483 : plumbing
484 ;;
485 pack-redundant)
486 : plumbing
487 ;;
488 pack-refs)
489 : plumbing
490 ;;
491 parse-remote)
492 : plumbing
493 ;;
494 patch-id)
495 : plumbing
496 ;;
497 peek-remote)
498 : plumbing
499 ;;
500 prune)
501 : plumbing
502 ;;
503 prune-packed)
504 : plumbing
505 ;;
506 quiltimport)
507 : import
508 ;;
509 read-tree)
510 : plumbing
511 ;;
512 receive-pack)
513 : plumbing
514 ;;
515 reflog)
516 : plumbing
517 ;;
518 repo-config)
519 : deprecated
520 ;;
521 rerere)
522 : plumbing
523 ;;
524 rev-list)
525 : plumbing
526 ;;
527 rev-parse)
528 : plumbing
529 ;;
530 runstatus)
531 : plumbing
532 ;;
533 sh-setup)
534 : internal
535 ;;
536 shell)
537 : daemon
538 ;;
539 show-ref)
540 : plumbing
541 ;;
542 send-pack)
543 : plumbing
544 ;;
545 show-index)
546 : plumbing
547 ;;
548 ssh-*)
549 : transport
550 ;;
551 stripspace)
552 : plumbing
553 ;;
554 symbolic-ref)
555 : plumbing
556 ;;
557 tar-tree)
558 : deprecated
559 ;;
560 unpack-file)
561 : plumbing
562 ;;
563 unpack-objects)
564 : plumbing
565 ;;
566 update-index)
567 : plumbing
568 ;;
569 update-ref)
570 : plumbing
571 ;;
572 update-server-info)
573 : daemon
574 ;;
575 upload-archive)
576 : plumbing
577 ;;
578 upload-pack)
579 : plumbing
580 ;;
581 write-tree)
582 : plumbing
583 ;;
584 var)
585 : infrequent
586 ;;
587 verify-pack)
588 : infrequent
589 ;;
590 verify-tag)
591 : plumbing
592 ;;
593 *)
594 echo $i
595 ;;
596 esac;
597 done
598}
599__git_ps1 ()
600{
601 local g="$(__gitdir)";
602 if [ -n "$g" ]; then
603 local r;
604 local b;
605 if [ -d "$g/rebase-apply" ]; then
606 if [ -f "$g/rebase-apply/rebasing" ]; then
607 r="|REBASE";
608 else
609 if [ -f "$g/rebase-apply/applying" ]; then
610 r="|AM";
611 else
612 r="|AM/REBASE";
613 fi;
614 fi;
615 b="$(git symbolic-ref HEAD 2>/dev/null)";
616 else
617 if [ -f "$g/rebase-merge/interactive" ]; then
618 r="|REBASE-i";
619 b="$(cat "$g/rebase-merge/head-name")";
620 else
621 if [ -d "$g/rebase-merge" ]; then
622 r="|REBASE-m";
623 b="$(cat "$g/rebase-merge/head-name")";
624 else
625 if [ -f "$g/MERGE_HEAD" ]; then
626 r="|MERGING";
627 fi;
628 if [ -f "$g/BISECT_LOG" ]; then
629 r="|BISECTING";
630 fi;
631 b="$(git symbolic-ref HEAD 2>/dev/null)" || {
632 b="$(
633 case "${GIT_PS1_DESCRIBE_STYLE-}" in
634 (contains)
635 git describe --contains HEAD ;;
636 (branch)
637 git describe --contains --all HEAD ;;
638 (describe)
639 git describe HEAD ;;
640 (* | default)
641 git describe --exact-match HEAD ;;
642 esac 2>/dev/null)" || b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || b="unknown";
643 b="($b)"
644 };
645 fi;
646 fi;
647 fi;
648 local w;
649 local i;
650 local c;
651 if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
652 if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
653 c="BARE:";
654 else
655 b="GIT_DIR!";
656 fi;
657 else
658 if [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
659 if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
660 if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
661 git diff --no-ext-diff --ignore-submodules --quiet --exit-code || w="*";
662 if git rev-parse --quiet --verify HEAD > /dev/null; then
663 git diff-index --cached --quiet --ignore-submodules HEAD -- || i="+";
664 else
665 i="#";
666 fi;
667 fi;
668 fi;
669 fi;
670 fi;
671 if [ -n "$b" ]; then
672 if [ -n "${1-}" ]; then
673 printf "$1" "$c${b##refs/heads/}$w$i$r";
674 else
675 printf " (%s)" "$c${b##refs/heads/}$w$i$r";
676 fi;
677 fi;
678 fi
679}
680__git_refs ()
681{
682 local i is_hash=y dir="$(__gitdir "${1-}")";
683 local cur="${COMP_WORDS[COMP_CWORD]}" format refs;
684 if [ -d "$dir" ]; then
685 case "$cur" in
686 refs | refs/*)
687 format="refname";
688 refs="${cur%/*}"
689 ;;
690 *)
691 if [ -e "$dir/HEAD" ]; then
692 echo HEAD;
693 fi;
694 format="refname:short";
695 refs="refs/tags refs/heads refs/remotes"
696 ;;
697 esac;
698 git --git-dir="$dir" for-each-ref --format="%($format)" $refs;
699 return;
700 fi;
701 for i in $(git ls-remote "$dir" 2>/dev/null);
702 do
703 case "$is_hash,$i" in
704 y,*)
705 is_hash=n
706 ;;
707 n,*^{})
708 is_hash=y
709 ;;
710 n,refs/tags/*)
711 is_hash=y;
712 echo "${i#refs/tags/}"
713 ;;
714 n,refs/heads/*)
715 is_hash=y;
716 echo "${i#refs/heads/}"
717 ;;
718 n,refs/remotes/*)
719 is_hash=y;
720 echo "${i#refs/remotes/}"
721 ;;
722 n,*)
723 is_hash=y;
724 echo "$i"
725 ;;
726 esac;
727 done
728}
729__git_refs2 ()
730{
731 local i;
732 for i in $(__git_refs "$1");
733 do
734 echo "$i:$i";
735 done
736}
737__git_refs_remotes ()
738{
739 local cmd i is_hash=y;
740 for i in $(git ls-remote "$1" 2>/dev/null);
741 do
742 case "$is_hash,$i" in
743 n,refs/heads/*)
744 is_hash=y;
745 echo "$i:refs/remotes/$1/${i#refs/heads/}"
746 ;;
747 y,*)
748 is_hash=n
749 ;;
750 n,*^{})
751 is_hash=y
752 ;;
753 n,refs/tags/*)
754 is_hash=y
755 ;;
756 n,*)
757 is_hash=y
758 ;;
759 esac;
760 done
761}
762__git_remotes ()
763{
764 local i ngoff IFS='
765' d="$(__gitdir)";
766 shopt -q nullglob || ngoff=1;
767 shopt -s nullglob;
768 for i in "$d/remotes"/*;
769 do
770 echo ${i#$d/remotes/};
771 done;
772 [ "$ngoff" ] && shopt -u nullglob;
773 for i in $(git --git-dir="$d" config --list);
774 do
775 case "$i" in
776 remote.*.url=*)
777 i="${i#remote.}";
778 echo "${i/.url=*/}"
779 ;;
780 esac;
781 done
782}
783__git_tags ()
784{
785 local cmd i is_hash=y dir="$(__gitdir "${1-}")";
786 if [ -d "$dir" ]; then
787 git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/tags;
788 return;
789 fi;
790 for i in $(git ls-remote "${1-}" 2>/dev/null);
791 do
792 case "$is_hash,$i" in
793 y,*)
794 is_hash=n
795 ;;
796 n,*^{})
797 is_hash=y
798 ;;
799 n,refs/tags/*)
800 is_hash=y;
801 echo "${i#refs/tags/}"
802 ;;
803 n,*)
804 is_hash=y;
805 echo "$i"
806 ;;
807 esac;
808 done
809}
810__gitcomp ()
811{
812 local cur="${COMP_WORDS[COMP_CWORD]}";
813 if [ $# -gt 2 ]; then
814 cur="$3";
815 fi;
816 case "$cur" in
817 --*=)
818 COMPREPLY=()
819 ;;
820 *)
821 local IFS='
822';
823 COMPREPLY=($(compgen -P "${2-}" -W "$(__gitcomp_1 "${1-}" "${4-}")" -- "$cur"))
824 ;;
825 esac
826}
827__gitcomp_1 ()
828{
829 local c IFS=' '' ''
830';
831 for c in $1;
832 do
833 case "$c$2" in
834 --*=*)
835 printf %s'
836' "$c$2"
837 ;;
838 *.)
839 printf %s'
840' "$c$2"
841 ;;
842 *)
843 printf %s'
844' "$c$2 "
845 ;;
846 esac;
847 done
848}
849__gitdir ()
850{
851 if [ -z "${1-}" ]; then
852 if [ -n "${__git_dir-}" ]; then
853 echo "$__git_dir";
854 else
855 if [ -d .git ]; then
856 echo .git;
857 else
858 git rev-parse --git-dir 2> /dev/null;
859 fi;
860 fi;
861 else
862 if [ -d "$1/.git" ]; then
863 echo "$1/.git";
864 else
865 echo "$1";
866 fi;
867 fi
868}
869_add_members ()
870{
871 local cur prev;
872 COMPREPLY=();
873 cur=`_get_cword`;
874 prev=${COMP_WORDS[COMP_CWORD-1]};
875 case "$prev" in
876 -@(r|d|-regular-members-file=|-digest-members-file=))
877 _filedir;
878 return 0
879 ;;
880 -@(w|a|-welcome-msg=|-admin-notify=))
881 COMPREPLY=($( compgen -W 'y n' -- $cur));
882 return 0
883 ;;
884 esac;
885 if [[ "$cur" == -* ]]; then
886 COMPREPLY=($( compgen -W '--regular-members-file= -r \
887 --digest-members-file= -d --welcome-msg= -w \
888 --admin-notify= -a --help -h' -- $cur ));
889 else
890 _mailman_lists;
891 fi
892}
893_alias ()
894{
895 local cur;
896 COMPREPLY=();
897 cur=`_get_cword`;
898 case "$COMP_LINE" in
899 *[^=])
900 COMPREPLY=($( compgen -A alias -- $cur ))
901 ;;
902 *=)
903 COMPREPLY=("$( alias ${cur%=} 2>/dev/null | sed -e 's|^alias '$cur'\(.*\)$|\1|' )")
904 ;;
905 esac
906}
907_ant ()
908{
909 local cur prev buildfile i;
910 COMPREPLY=();
911 cur=`_get_cword`;
912 prev=${COMP_WORDS[COMP_CWORD-1]};
913 case "$prev" in
914 -buildfile | -f)
915 _filedir 'xml';
916 return 0
917 ;;
918 -logfile)
919 _filedir;
920 return 0
921 ;;
922 esac;
923 if [[ "$cur" == -* ]]; then
924 COMPREPLY=($( compgen -W '-help -projecthelp -version -quiet \
925 -verbose -debug -emacs -logfile -logger \
926 -listener -buildfile -f -D -find' -- $cur ));
927 else
928 buildfile=build.xml;
929 for ((i=1; i < COMP_CWORD; i++ ))
930 do
931 if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
932 buildfile=${COMP_WORDS[i+1]};
933 break;
934 fi;
935 done;
936 [ ! -f $buildfile ] && return 0;
937 COMPREPLY=($( awk -F'"' '/<target name="/ {print $2}' $buildfile | grep "^$cur" ) $( awk -F"'" "/<target name='/ "'{print $2}' $buildfile | grep "^$cur" ) $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' $buildfile | grep "^$cur" ));
938 fi
939}
940_apt_cache ()
941{
942 local cur prev special i;
943 COMPREPLY=();
944 cur=`_get_cword`;
945 prev=${COMP_WORDS[COMP_CWORD-1]};
946 if [ "$cur" != show ]; then
947 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
948 do
949 if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
950 special=${COMP_WORDS[i]};
951 fi;
952 done;
953 fi;
954 if [ -n "$special" ]; then
955 case $special in
956 add)
957 _filedir;
958 return 0
959 ;;
960 showsrc)
961 COMPREPLY=($( apt-cache dumpavail | grep "^Source: $cur" | sort | uniq | cut -f2 -d" " ));
962 return 0
963 ;;
964 *)
965 COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
966 return 0
967 ;;
968 esac;
969 fi;
970 case "$prev" in
971 -@(c|p|s|-config-file|-@(pkg|src)-cache))
972 _filedir;
973 return 0
974 ;;
975 search)
976 if [[ "$cur" != -* ]]; then
977 return 0;
978 fi
979 ;;
980 esac;
981 if [[ "$cur" == -* ]]; then
982 COMPREPLY=($( compgen -W '-h -v -p -s -q -i -f -a -g -c \
983 -o --help --version --pkg-cache --src-cache \
984 --quiet --important --full --all-versions \
985 --no-all-versions --generate --no-generate \
986 --names-only --all-names --recurse \
987 --config-file --option --installed' -- $cur ));
988 else
989 COMPREPLY=($( compgen -W 'add gencaches show showpkg showsrc \
990 stats dump dumpavail unmet search search \
991 depends rdepends pkgnames dotty xvcg \
992 policy madison' -- $cur ));
993 fi;
994 return 0
995}
996_apt_get ()
997{
998 local cur prev special i;
999 COMPREPLY=();
1000 cur=`_get_cword`;
1001 prev=${COMP_WORDS[COMP_CWORD-1]};
1002 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
1003 do
1004 if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
1005 special=${COMP_WORDS[i]};
1006 fi;
1007 done;
1008 if [ -n "$special" ]; then
1009 case $special in
1010 remove | autoremove | purge)
1011 if [ -f /etc/debian_version ]; then
1012 COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
1013 else
1014 _rpm_installed_packages;
1015 fi;
1016 return 0
1017 ;;
1018 *)
1019 COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
1020 return 0
1021 ;;
1022 esac;
1023 fi;
1024 case "$prev" in
1025 -@(c|-config-file))
1026 _filedir;
1027 return 0
1028 ;;
1029 -@(t|-target-release|-default-release))
1030 COMPREPLY=($( apt-cache policy | grep "release.o=Debian,a=$cur" | sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null));
1031 return 0
1032 ;;
1033 esac;
1034 if [[ "$cur" == -* ]]; then
1035 COMPREPLY=($( compgen -W '-d -f -h -v -m -q -s -y \
1036 -u -t -b -c -o --download-only --fix-broken \
1037 --help --version --ignore-missing \
1038 --fix-missing --no-download --quiet --simulate \
1039 --just-print --dry-run --recon --no-act --yes \
1040 --assume-yes --show-upgraded --only-source \
1041 --compile --build --ignore-hold \
1042 --target-release --no-upgrade --force-yes \
1043 --print-uris --purge --reinstall \
1044 --list-cleanup --default-release \
1045 --trivial-only --no-remove --diff-only \
1046 --no-install-recommends \
1047 --tar-only --config-file --option --auto-remove' -- $cur ));
1048 else
1049 COMPREPLY=($( compgen -W 'update upgrade dselect-upgrade \
1050 dist-upgrade install remove purge source build-dep \
1051 check clean autoclean autoremove' -- $cur ));
1052 fi;
1053 return 0
1054}
1055_aptitude ()
1056{
1057 local cur dashoptions prev special i;
1058 COMPREPLY=();
1059 cur=`_get_cword`;
1060 prev=${COMP_WORDS[COMP_CWORD-1]};
1061 dashoptions='-S -u -i -h --help --version -s --simulate -d \
1062 --download-only -P --prompt -y --assume-yes -F \
1063 --display-format -O --sort -w --width -f -r -g \
1064 --with-recommends --with-suggests -R -G \
1065 --without-recommends --without-suggests -t \
1066 --target-release -V --show-versions -D --show-deps\
1067 -Z -v --verbose --purge-unused --schedule-only';
1068 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
1069 do
1070 if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|forbid-version|purge|remove|changelog|why|why-not|keep|keep-all|build-dep) ]]; then
1071 special=${COMP_WORDS[i]};
1072 fi;
1073 [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i};
1074 [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u};
1075 done;
1076 if [[ -n "$special" ]]; then
1077 case $special in
1078 @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
1079 COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
1080 return 0
1081 ;;
1082 @(purge|remove|reinstall|forbid-version))
1083 COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
1084 return 0
1085 ;;
1086 unhold)
1087 COMPREPLY=($( _comp_dpkg_hold_packages $cur ));
1088 return 0
1089 ;;
1090 esac;
1091 fi;
1092 case $prev in
1093 @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
1094 return 0
1095 ;;
1096 -S)
1097 _filedir;
1098 return 0
1099 ;;
1100 -@(t|-target-release|-default-release))
1101 COMPREPLY=($( apt-cache policy | grep "release.o=Debian,a=$cur" | sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ));
1102 return 0
1103 ;;
1104 esac;
1105 if [[ "$cur" == -* ]]; then
1106 COMPREPLY=($( compgen -W "$dashoptions" -- $cur ));
1107 else
1108 COMPREPLY=($( compgen -W 'update upgrade safe-upgrade forget-new clean \
1109 autoclean install reinstall remove \
1110 hold unhold purge markauto unmarkauto why why-not \
1111 dist-upgrade full-upgrade download search show \
1112 forbid-version changelog keep-all build-dep' -- $cur ));
1113 fi;
1114 return 0
1115}
1116_arch ()
1117{
1118 local cur prev;
1119 COMPREPLY=();
1120 cur=`_get_cword`;
1121 prev=${COMP_WORDS[COMP_CWORD-1]};
1122 case "$prev" in
1123 -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
1124 COMPREPLY=($( compgen -W 'y n' -- $cur));
1125 return 0
1126 ;;
1127 -@(d|-file))
1128 _filedir;
1129 return 0
1130 ;;
1131 esac;
1132 if [[ "$cur" == -* ]]; then
1133 COMPREPLY=($( compgen -W '--wipe -s --start= -e --end= \
1134 -q --quiet -h --help' -- $cur ));
1135 else
1136 args=$COMP_CWORD;
1137 for ((i=1; i < COMP_CWORD; i++ ))
1138 do
1139 if [[ "${COMP_WORDS[i]}" == -* ]]; then
1140 args=$(($args-1));
1141 fi;
1142 done;
1143 case $args in
1144 1)
1145 _mailman_lists
1146 ;;
1147 2)
1148 _filedir
1149 ;;
1150 esac;
1151 fi
1152}
1153_args ()
1154{
1155 args=0;
1156 if [[ "${COMP_WORDS[0]}" == lvm ]]; then
1157 offset=2;
1158 else
1159 offset=1;
1160 fi;
1161 for ((i=$offset; i < COMP_CWORD; i++ ))
1162 do
1163 if [[ "${COMP_WORDS[i]}" != -* ]]; then
1164 args=$(($args + 1));
1165 fi;
1166 done
1167}
1168_arpspoof ()
1169{
1170 local cur;
1171 COMPREPLY=();
1172 cur=`_get_cword`;
1173 prev=${COMP_WORDS[COMP_CWORD-1]};
1174 case "$prev" in
1175 -i)
1176 _interfaces;
1177 return 0
1178 ;;
1179 -t)
1180 _known_hosts;
1181 return 0
1182 ;;
1183 esac;
1184 if [[ "$cur" == -* ]]; then
1185 COMPREPLY=($( compgen -W '-i -t' -- $cur ));
1186 else
1187 _known_hosts;
1188 fi
1189}
1190_aspell ()
1191{
1192 local cur prev;
1193 COMPREPLY=();
1194 cur=`_get_cword`;
1195 prev=${COMP_WORDS[COMP_CWORD-1]};
1196 case "$prev" in
1197 @(-c|-p|check))
1198 _filedir;
1199 return 0
1200 ;;
1201 @(dump|create|merge))
1202 COMPREPLY=($( compgen -W 'master personal repl' -- $cur ));
1203 return 0
1204 ;;
1205 -d)
1206 _aspell_dictionary;
1207 return 0
1208 ;;
1209 esac;
1210 if [[ "$cur" == *=* ]]; then
1211 prev=${cur/=*/};
1212 cur=${cur/*=/};
1213 case "$prev" in
1214 --@(conf|personal|repl|per-conf))
1215 _filedir;
1216 return 0
1217 ;;
1218 --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
1219 _filedir -d;
1220 return 0
1221 ;;
1222 --master)
1223 _aspell_dictionary;
1224 return 0
1225 ;;
1226 --mode)
1227 COMPREPLY=($( compgen -W 'none url email sgml tex' -- $cur ));
1228 return 0
1229 ;;
1230 --sug-mode)
1231 COMPREPLY=($( compgen -W 'ultra fast normal bad-speller' -- $cur ));
1232 return 0
1233 ;;
1234 --keymapping)
1235 COMPREPLY=($( compgen -W 'aspell ispell' -- $cur ));
1236 return 0
1237 ;;
1238 esac;
1239 fi;
1240 if [[ "$cur" == -* ]]; then
1241 COMPREPLY=($( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
1242 --encoding= --add-filter= --rem-filter= --mode= -e \
1243 -H -t --add-extra-dicts= --rem-extra-dicts= \
1244 --home-dir= -W --ignore= --ignore-accents \
1245 --dont-ignore-accents --ignore-case --dont-ignore-case \
1246 --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
1247 --lang= --language-tag= --local-data-dir= -d --master= \
1248 --module= --add-module-search-order= \
1249 --rem-module-search-order= --per-conf= -p --personal= \
1250 --prefix= --repl= -C -B --run-together --dont-run-together \
1251 --run-together-limit= --run-together-min= --save-repl \
1252 --dont-save-repl --set-prefix --dont-set-prefix --size= \
1253 --spelling= --strip-accents --dont-strip-accents \
1254 --sug-mode= --add-word-list-path= --rem-word-list-path= \
1255 -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
1256 --time --dont-time --keymapping= --add-email-quote= \
1257 --rem-email-quote= --email-margin= --add-tex-command= \
1258 --rem-tex-command= --tex-check-comments \
1259 --dont-tex-check-comments --add-tex-extension= \
1260 --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
1261 --add-sgml-extension= --rem-sgml-extension=' -- $cur ));
1262 else
1263 COMPREPLY=($( compgen -W '-? help -c check -a pipe -l list \
1264 config config soundslike filter -v version dump \
1265 create merge' -- $cur ));
1266 fi
1267}
1268_aspell_dictionary ()
1269{
1270 local datadir;
1271 datadir=/usr/lib/aspell;
1272 COMPREPLY=($( command ls $datadir/*.@(multi|alias) ));
1273 COMPREPLY=(${COMPREPLY[@]%.@(multi|alias)});
1274 COMPREPLY=($( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ))
1275}
1276_available_interfaces ()
1277{
1278 local cmd;
1279 if [ "${1:-}" = -w ]; then
1280 cmd="iwconfig";
1281 else
1282 if [ "${1:-}" = -a ]; then
1283 cmd="ifconfig";
1284 else
1285 cmd="ifconfig -a";
1286 fi;
1287 fi;
1288 COMPREPLY=($( eval $cmd 2>/dev/null | sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p'))
1289}
1290_bk ()
1291{
1292 local BKCMDS;
1293 COMPREPLY=();
1294 cur=`_get_cword`;
1295 BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )";
1296 COMPREPLY=($( compgen -W "$BKCMDS" -- "$cur" ));
1297 _filedir;
1298 return 0
1299}
1300_brctl ()
1301{
1302 local cur command;
1303 COMPREPLY=();
1304 cur=`_get_cword`;
1305 command=${COMP_WORDS[1]};
1306 case $COMP_CWORD in
1307 1)
1308 COMPREPLY=($( compgen -W "addbr delbr addif delif setageing setbridgeprio setfd sethello setmaxage setpathcost setportprio show showmacs showstp stp" -- $cur ))
1309 ;;
1310 2)
1311 case $command in
1312 show)
1313
1314 ;;
1315 *)
1316 COMPREPLY=($( compgen -W "$(brctl show | sed '1d' | awk '{print $1}' )" -- $cur ))
1317 ;;
1318 esac
1319 ;;
1320 3)
1321 case $command in
1322 @(add|del)if)
1323 _configured_interfaces
1324 ;;
1325 stp)
1326 COMPREPLY=($( compgen -W 'on off' -- $cur ))
1327 ;;
1328 esac
1329 ;;
1330 esac
1331}
1332_btdownload ()
1333{
1334 local cur prev;
1335 COMPREPLY=();
1336 cur=`_get_cword`;
1337 prev=${COMP_WORDS[COMP_CWORD-1]};
1338 case "$prev" in
1339 --@(responsefile|saveas))
1340 _filedir;
1341 return 0
1342 ;;
1343 esac;
1344 if [[ "$cur" == -* ]]; then
1345 COMPREPLY=($( compgen -W '--max_uploads --keepalive_interval \
1346 --download_slice_size --request_backlog \
1347 --max_message_length --ip --minport --maxport \
1348 --responsefile --url --saveas --timeout \
1349 --timeout_check_interval --max_slice_length \
1350 --max_rate_period --bind --upload_rate_fudge \
1351 --display_interval --rerequest_interval \
1352 --min_peers --http_timeout --max_initiate \
1353 --max_allow_in --check_hashes \
1354 --max_upload_rate --snub_time --spew \
1355 --rarest_first_cutoff --min_uploads \
1356 --report_hash_failures' -- $cur ));
1357 else
1358 _filedir;
1359 fi
1360}
1361_bzip2 ()
1362{
1363 local cur prev xspec;
1364 COMPREPLY=();
1365 cur=`_get_cword`;
1366 prev=${COMP_WORDS[COMP_CWORD-1]};
1367 if [[ "$cur" == -* ]]; then
1368 COMPREPLY=($( compgen -W '-c -d -f -h -k -L -q -s \
1369 -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
1370 --help --decompress --compress --keep --force \
1371 --test --stdout --quiet --verbose --license \
1372 --version --small --fast --best' -- $cur ));
1373 return 0;
1374 fi;
1375 local IFS='
1376';
1377 xspec="*.bz2";
1378 if [[ "$prev" == --* ]]; then
1379 [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec;
1380 [[ "$prev" == --compress ]] && xspec=;
1381 else
1382 if [[ "$prev" == -* ]]; then
1383 [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec;
1384 [[ "$prev" == -*z* ]] && xspec=;
1385 fi;
1386 fi;
1387 _expand || return 0;
1388 COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
1389}
1390_cancel ()
1391{
1392 local cur;
1393 COMPREPLY=();
1394 cur=`_get_cword`;
1395 COMPREPLY=($( lpstat | cut -d' ' -f1 | grep "^$cur" ))
1396}
1397_cd ()
1398{
1399 local IFS='
1400' cur=`_get_cword` i j k;
1401 if [[ "$cur" == ?(\\)\$* ]]; then
1402 COMPREPLY=($( compgen -v -P '$' -- "${cur#?(\\)$}" ));
1403 return 0;
1404 fi;
1405 compgen -f /non-existing-dir/ > /dev/null;
1406 if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
1407 _filedir -d;
1408 return 0;
1409 fi;
1410 local -r mark_dirs=$(_rl_enabled mark-directories && echo y);
1411 local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y);
1412 for i in ${CDPATH//:/' '};
1413 do
1414 k="${#COMPREPLY[@]}";
1415 for j in $( compgen -d $i/$cur );
1416 do
1417 if [[ ( -n $mark_symdirs && -h $j || -n $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
1418 j="${j}/";
1419 fi;
1420 COMPREPLY[k++]=${j#$i/};
1421 done;
1422 done;
1423 _filedir -d;
1424 if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
1425 i=${COMPREPLY[0]};
1426 if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
1427 COMPREPLY[0]="${i}/";
1428 fi;
1429 fi;
1430 return 0
1431}
1432_cdrecord ()
1433{
1434 local cur prev i generic_options track_options track_mode;
1435 COMPREPLY=();
1436 cur=`_get_cword`;
1437 prev=${COMP_WORDS[COMP_CWORD-1]};
1438 if [[ "$cur" == *=* ]]; then
1439 prev=${cur/=*/};
1440 cur=${cur/*=/};
1441 case "$prev" in
1442 @(text|cue)file)
1443 _filedir;
1444 return 0
1445 ;;
1446 blank)
1447 COMPREPLY=($( compgen -W 'help all fast \
1448 track unreserve trtail unclose session' -- $cur ));
1449 return 0
1450 ;;
1451 driveropts)
1452 COMPREPLY=($( compgen -W 'burnfree noburnfree\
1453 varirec= audiomaster forcespeed noforcespeed\
1454 speedread nospeedread singlesession \
1455 nosinglesession hidecdr nohidecdr tattooinfo\
1456 tattoofile=' -- $cur ));
1457 return 0
1458 ;;
1459 esac;
1460 fi;
1461 generic_options=(-version -v -V -d -silent -s -force -immed -dummy -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive -prcap -inq -scanbus -reset -abort -overburn -ignsize -useinfo -packet -noclose -text debug= kdebug= kd= minbuf= speed= blank= fs= dev= gracetime= timeout= driver= driveropts= defpregap= pktsize= mcn= textfile= cuefile=);
1462 track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi -isosize -pad padsize= -nopad -shorttrack -noshorttrack pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= isrc= index=);
1463 track_mode=0;
1464 if [ $COMP_CWORD -gt 1 ]; then
1465 if [ -f "$prev" ]; then
1466 track_mode=1;
1467 else
1468 for ((i=0; i < ${#track_options[@]}; i++ ))
1469 do
1470 if [[ "${track_options[i]}" == "$prev" ]]; then
1471 track_mode=1;
1472 break;
1473 fi;
1474 done;
1475 fi;
1476 fi;
1477 _filedir;
1478 COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ));
1479 if [ $track_mode -eq 0 ]; then
1480 COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${generic_options[@]}' -- $cur ));
1481 fi
1482}
1483_change_pw ()
1484{
1485 local cur prev;
1486 COMPREPLY=();
1487 cur=`_get_cword`;
1488 prev=${COMP_WORDS[COMP_CWORD-1]};
1489 case "$prev" in
1490 -@(l|-listname=))
1491 _mailman_lists;
1492 return 0
1493 ;;
1494 esac;
1495 if [[ "$cur" == -* ]]; then
1496 COMPREPLY=($( compgen -W '-a --all --domain= -d --listname= -l \
1497 --password= -p --quiet -q -h --help' -- $cur ));
1498 fi
1499}
1500_check_db ()
1501{
1502 local cur;
1503 COMPREPLY=();
1504 cur=`_get_cword`;
1505 if [[ "$cur" == -* ]]; then
1506 COMPREPLY=($( compgen -W '--all -a --verbose -v \
1507 -h --help' -- $cur ));
1508 else
1509 _mailman_lists;
1510 fi
1511}
1512_check_perms ()
1513{
1514 local cur;
1515 COMPREPLY=();
1516 cur=`_get_cword`;
1517 if [[ "$cur" == -* ]]; then
1518 COMPREPLY=($( compgen -W '-f -v -h' -- $cur ));
1519 fi
1520}
1521_chgrp ()
1522{
1523 local cur prev;
1524 COMPREPLY=();
1525 cur=`_get_cword`;
1526 cur=${cur//\\\\/};
1527 prev=${COMP_WORDS[COMP_CWORD-1]};
1528 if [[ "$cur" == -* ]]; then
1529 COMPREPLY=($( compgen -W '-c -h -f -R -v --changes \
1530 --dereference --no-dereference --silent --quiet \
1531 --reference= --recursive --verbose --help --version' -- $cur ));
1532 return 0;
1533 fi;
1534 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
1535 local IFS='
1536';
1537 COMPREPLY=($( compgen -g $cur 2>/dev/null ));
1538 else
1539 _filedir || return 0;
1540 fi;
1541 return 0
1542}
1543_chown ()
1544{
1545 local cur;
1546 cur=`_get_cword`;
1547 if [[ "$cur" == -* ]]; then
1548 COMPREPLY=($( compgen -W '-c -h -f -R -v --changes \
1549 --dereference --no-dereference --from= --silent --quiet \
1550 --reference= --recursive --verbose --help --version' -- $cur ));
1551 else
1552 _count_args;
1553 case $args in
1554 1)
1555 _usergroup
1556 ;;
1557 *)
1558 _filedir
1559 ;;
1560 esac;
1561 fi
1562}
1563_chsh ()
1564{
1565 local cur prev;
1566 COMPREPLY=();
1567 cur=`_get_cword`;
1568 prev=${COMP_WORDS[COMP_CWORD-1]};
1569 if [ "$prev" = "-s" ]; then
1570 if [ -f /etc/debian_version ]; then
1571 COMPREPLY=($( </etc/shells ));
1572 else
1573 COMPREPLY=($( chsh -l | grep "^$cur" ));
1574 fi;
1575 else
1576 COMPREPLY=($( compgen -u -- $cur ));
1577 fi;
1578 return 0
1579}
1580_civclient ()
1581{
1582 local cur;
1583 COMPREPLY=();
1584 cur=`_get_cword`;
1585 prev=${COMP_WORDS[COMP_CWORD-1]};
1586 case "$prev" in
1587 -@(l|S|t|-log|-Sound|-tiles))
1588 _filedir;
1589 return 0
1590 ;;
1591 -@(P|-Plugin))
1592 COMPREPLY=($( compgen -W 'none esd sdl' -- $cur ));
1593 return 0
1594 ;;
1595 -@(s|-server))
1596 _known_hosts;
1597 return 0
1598 ;;
1599 esac;
1600 if [[ "$cur" == -* ]]; then
1601 COMPREPLY=($( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
1602 --autoconnect --debug --help --log --meta --name \
1603 --port --Plugin --server --Sound --tiles --version' -- $cur ));
1604 fi
1605}
1606_civserver ()
1607{
1608 local cur;
1609 COMPREPLY=();
1610 cur=`_get_cword`;
1611 prev=${COMP_WORDS[COMP_CWORD-1]};
1612 case "$prev" in
1613 -@(f|g|l|r|-file|-log|-gamelog|-read))
1614 _filedir;
1615 return 0
1616 ;;
1617 esac;
1618 if [[ "$cur" == -* ]]; then
1619 COMPREPLY=($( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
1620 --debug --file --gamelog --help --info --log --meta \
1621 --Metaserver --port --quitidle --read --version' -- $cur ));
1622 fi
1623}
1624_cksfv ()
1625{
1626 COMPREPLY=();
1627 cur=`_get_cword`;
1628 if [ $COMP_CWORD -eq 1 ]; then
1629 COMPREPLY=($( compgen -W '-C -f -i -q -v' -- $cur ));
1630 return 0;
1631 fi;
1632 case "${COMP_WORDS[$COMP_CWORD-1]}" in
1633 -C)
1634 _filedir -d;
1635 return 0
1636 ;;
1637 -f)
1638 _filedir 'sfv';
1639 return 0
1640 ;;
1641 esac;
1642 _filedir;
1643 return 0
1644}
1645_cleanarch ()
1646{
1647 local cur;
1648 COMPREPLY=();
1649 cur=`_get_cword`;
1650 if [[ "$cur" == -* ]]; then
1651 COMPREPLY=($( compgen -W '-s --status -n --dry-run \
1652 -q --quiet -h --help' -- $cur ));
1653 fi
1654}
1655_clisp ()
1656{
1657 local cur;
1658 COMPREPLY=();
1659 cur=`_get_cword`;
1660 if [[ "$cur" == -* ]]; then
1661 COMPREPLY=($( compgen -W '-h --help --version --license -B -K \
1662 -M -m -L -N -E -q --quiet --silent -w -I -ansi \
1663 -traditional -p -C -norc -i -c -l -o -x ' -- $cur ));
1664 else
1665 _filedir;
1666 fi;
1667 return 0
1668}
1669_clone_member ()
1670{
1671 local cur prev;
1672 COMPREPLY=();
1673 cur=`_get_cword`;
1674 prev=${COMP_WORDS[COMP_CWORD-1]};
1675 case "$prev" in
1676 -@(l|-listname=))
1677 _mailman_lists;
1678 return 0
1679 ;;
1680 esac;
1681 if [[ "$cur" == -* ]]; then
1682 COMPREPLY=($( compgen -W '-l --listname= --remove -r \
1683 --admin -a --quiet -q --nomodify -n --help -h' -- $cur ));
1684 fi
1685}
1686_command ()
1687{
1688 local offset i;
1689 offset=1;
1690 for ((i=1; i <= COMP_CWORD; i++ ))
1691 do
1692 if [[ "${COMP_WORDS[i]}" != -* ]]; then
1693 offset=$i;
1694 break;
1695 fi;
1696 done;
1697 _command_offset $offset
1698}
1699_command_offset ()
1700{
1701 local cur func cline cspec noglob cmd i char_offset word_offset _COMMAND_FUNC _COMMAND_FUNC_ARGS;
1702 word_offset=$1;
1703 local first_word=${COMP_WORDS[$word_offset]};
1704 for ((i=0; i <= ${#COMP_LINE}; i++ ))
1705 do
1706 if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then
1707 char_offset=$i;
1708 break;
1709 fi;
1710 done;
1711 COMP_LINE=${COMP_LINE:$char_offset};
1712 COMP_POINT=$(( COMP_POINT - $char_offset ));
1713 for ((i=0; i <= COMP_CWORD - $word_offset; i++ ))
1714 do
1715 COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]};
1716 done;
1717 for ((i; i <= COMP_CWORD; i++ ))
1718 do
1719 unset COMP_WORDS[i];
1720 done;
1721 COMP_CWORD=$(( $COMP_CWORD - $word_offset ));
1722 COMPREPLY=();
1723 cur=`_get_cword`;
1724 if [[ $COMP_CWORD -eq 0 ]]; then
1725 COMPREPLY=($( compgen -c -- $cur ));
1726 else
1727 cmd=${COMP_WORDS[0]};
1728 if complete -p $cmd &>/dev/null; then
1729 cspec=$( complete -p $cmd );
1730 if [ "${cspec#* -F }" != "$cspec" ]; then
1731 func=${cspec#*-F };
1732 func=${func%% *};
1733 if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
1734 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}";
1735 else
1736 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}";
1737 fi;
1738 if [ "${cspec#*-o }" != "$cspec" ]; then
1739 cspec=${cspec#*-o };
1740 cspec=${cspec%% *};
1741 if [[ "$cspec" != @(dir|file)names ]]; then
1742 COMPREPLY=("${COMPREPLY[@]//\\\\:/:}");
1743 fi;
1744 fi;
1745 else
1746 if [ -n "$cspec" ]; then
1747 cspec=${cspec#complete};
1748 cspec=${cspec%%$cmd};
1749 COMPREPLY=($( eval compgen "$cspec" -- "$cur" ));
1750 fi;
1751 fi;
1752 fi;
1753 fi;
1754 [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
1755}
1756_comp_dpkg_hold_packages ()
1757{
1758 grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" | cut -d\ -f2
1759}
1760_comp_dpkg_installed_packages ()
1761{
1762 grep -A 1 "Package: $1" /var/lib/dpkg/status | grep -B 1 -Ee "ok installed|half-installed|unpacked| half-configured|config-files" -Ee "^Essential: yes" | grep "Package: $1" | cut -d\ -f2
1763}
1764_complete ()
1765{
1766 local cur prev options;
1767 COMPREPLY=();
1768 cur=`_get_cword`;
1769 prev=${COMP_WORDS[COMP_CWORD-1]};
1770 case $prev in
1771 -o)
1772 options="default dirnames filenames";
1773 [ -n "$bash205b" ] && options="$options nospace";
1774 [ -n "$bash3" ] && options="$options bashdefault plusdirs";
1775 COMPREPLY=($( compgen -W "$options" -- $cur ));
1776 return 0
1777 ;;
1778 -A)
1779 COMPREPLY=($( compgen -W 'alias arrayvar binding \
1780 builtin command directory disabled enabled \
1781 export file function group helptopic hostname \
1782 job keyword running service setopt shopt \
1783 signal stopped user variable' -- $cur ));
1784 return 0
1785 ;;
1786 -C)
1787 COMPREPLY=($( compgen -A command -- $cur ));
1788 return 0
1789 ;;
1790 -F)
1791 COMPREPLY=($( compgen -A function -- $cur ));
1792 return 0
1793 ;;
1794 -@(p|r))
1795 COMPREPLY=($( complete -p | sed -e 's|.* ||' | grep "^$cur" ));
1796 return 0
1797 ;;
1798 esac;
1799 if [[ "$cur" == -* ]]; then
1800 options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C";
1801 [ -n "$bash205" ] && options="$options -o";
1802 COMPREPLY=($( compgen -W "$options" -- $cur ));
1803 else
1804 COMPREPLY=($( compgen -A command -- $cur ));
1805 fi
1806}
1807_complete_vim_addons ()
1808{
1809 COMPREPLY=();
1810 cur=${COMP_WORDS[COMP_CWORD]};
1811 prev=${COMP_WORDS[COMP_CWORD-1]};
1812 commands="list status install remove disable amend files show";
1813 any_command=$(echo $commands | sed -e 's/\s\+/|/g');
1814 options="-h --help -r --registry-dir -s --source-dir -t --target-dir -v --verbose -y --system-dir -w --system-wide -q --query";
1815 any_option=$(echo $options | sed -e 's/\s\+/|/g');
1816 if [[ "$prev" == 'vim-addons' ]]; then
1817 COMPREPLY=($( compgen -W "$commands" -- $cur ));
1818 return 0;
1819 fi;
1820 if [[ "$cur" == -* ]]; then
1821 COMPREPLY=($( compgen -W "$options" -- $cur));
1822 return 0;
1823 fi;
1824 if [[ "$prev" == @(-r|--registry-dir|-s|--source-dir|-t|--target-dir|-y|--system-dir) ]]; then
1825 COMPREPLY=($( compgen -o dirnames -- $cur ));
1826 return 0;
1827 fi;
1828 command='';
1829 target_dir='';
1830 system_wide='';
1831 system_dir='';
1832 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++))
1833 do
1834 if [[ ${COMP_WORDS[i]} == @($any_command) ]]; then
1835 command=${COMP_WORDS[i]};
1836 fi;
1837 if [[ ${COMP_WORDS[i]} == @(-w|--system-wide) ]]; then
1838 system_wide="--system-wide";
1839 fi;
1840 if [[ $i -gt 0 ]]; then
1841 if [[ ${COMP_WORDS[i-1]} == @(-t|--target-dir) ]]; then
1842 target_dir="--target-dir ${COMP_WORDS[i]}";
1843 fi;
1844 if [[ ${COMP_WORDS[i-1]} == @(-y|--system-dir) ]]; then
1845 system_dir="--system-dir ${COMP_WORDS[i]}";
1846 fi;
1847 fi;
1848 done;
1849 query="vim-addons status --query $system_wide $system_dir $target_dir";
1850 if [[ -z "$command" ]]; then
1851 COMPREPLY=();
1852 return 0;
1853 fi;
1854 case "$command" in
1855 list)
1856 COMPREPLY=()
1857 ;;
1858 install)
1859 COMPREPLY=($( $query | grep -e "^$cur" | grep -v -e "installed$" | sed -e 's/^\(\S\+\).*/\1/' ))
1860 ;;
1861 remove | disable | amend)
1862 COMPREPLY=($( $query | grep -e "^$cur" | grep -e "installed$" | sed -e 's/^\(\S\+\).*/\1/' ))
1863 ;;
1864 *)
1865 COMPREPLY=($(grep -h "^addon: $cur" /usr/share/vim/registry/*.yaml | sed -e 's/^addon:\s*//'))
1866 ;;
1867 esac
1868}
1869_config_list ()
1870{
1871 local cur prev;
1872 COMPREPLY=();
1873 cur=`_get_cword`;
1874 prev=${COMP_WORDS[COMP_CWORD-1]};
1875 case "$prev" in
1876 -@(i|o|-inputfile|-outputfile))
1877 _filedir;
1878 return 0
1879 ;;
1880 esac;
1881 if [[ "$cur" == -* ]]; then
1882 COMPREPLY=($( compgen -W '--inputfile -i --outputfile -o \
1883 --checkonly -c --verbose -v -h --help' -- $cur ));
1884 else
1885 _mailman_lists;
1886 fi
1887}
1888_configure_func ()
1889{
1890 local cur;
1891 COMPREPLY=();
1892 cur=`_get_cword`;
1893 [[ "$cur" != -* ]] && return 0;
1894 if [ -n "$COMP_CONFIGURE_HINTS" ]; then
1895 COMPREPLY=($( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ));
1896 else
1897 COMPREPLY=($( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ));
1898 fi
1899}
1900_configured_interfaces ()
1901{
1902 if [ -f /etc/debian_version ]; then
1903 COMPREPLY=($( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' /etc/network/interfaces ));
1904 else
1905 if [ -f /etc/SuSE-release ]; then
1906 COMPREPLY=($( command ls /etc/sysconfig/network/ifcfg-* | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
1907 else
1908 if [ -f /etc/pld-release ]; then
1909 COMPREPLY=($( command ls -B /etc/sysconfig/interfaces | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
1910 else
1911 COMPREPLY=($( command ls /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
1912 fi;
1913 fi;
1914 fi
1915}
1916_count_args ()
1917{
1918 args=1;
1919 for ((i=1; i < COMP_CWORD; i++ ))
1920 do
1921 if [[ "${COMP_WORDS[i]}" != -* ]]; then
1922 args=$(($args+1));
1923 fi;
1924 done
1925}
1926_cpan2dist ()
1927{
1928 local cur prev packagelist cpandirs;
1929 COMPREPLY=();
1930 cur=`_get_cword`;
1931 prev=${COMP_WORDS[COMP_CWORD-1]};
1932 case $prev in
1933 --format)
1934 COMPREPLY=($( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" ));
1935 return 0
1936 ;;
1937 --@(banlist|ignorelist|modulelist|logfile))
1938 _filedir;
1939 return 0
1940 ;;
1941 esac;
1942 if [[ "$cur" == -* ]]; then
1943 COMPREPLY=($( compgen -W '--help --skiptest --force --install \
1944 --verbose --keepsource --makefile --buildprereq \
1945 --archive --flushcache --defaults --edit-metafile \
1946 --format --ban --banlist --ignore --ignorelist \
1947 --modulelist --logfile --timeout --set-config \
1948 --set-program --dist-opts --default-banlist \
1949 --default-ignorelist' -- $cur ));
1950 else
1951 cpandirs=("$HOME/.cpanplus/" "$HOME/.cpan/source/modules/");
1952 for dir in ${cpandirs[@]};
1953 do
1954 [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz";
1955 done;
1956 COMPREPLY=($( zgrep "^${cur//-/::}" $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ));
1957 fi
1958}
1959_cpio ()
1960{
1961 local cur;
1962 COMPREPLY=();
1963 cur=`_get_cword`;
1964 prev=${COMP_WORDS[COMP_CWORD-1]};
1965 case $prev in
1966 -H)
1967 _cpio_format;
1968 return 0
1969 ;;
1970 -@(E|F|I))
1971 _filedir;
1972 return 0
1973 ;;
1974 -R)
1975 _usergroup;
1976 return 0
1977 ;;
1978 esac;
1979 if [[ "$cur" == *=* ]]; then
1980 prev=${cur/=*/};
1981 cur=${cur/*=/};
1982 case $prev in
1983 --format)
1984 _cpio_format;
1985 return 0
1986 ;;
1987 --@(file|pattern-file))
1988 _filedir;
1989 return 0
1990 ;;
1991 --owner)
1992 _usergroup;
1993 return 0
1994 ;;
1995 --rsh-command)
1996 COMPREPLY=($( compgen -c -- $cur ));
1997 return 0
1998 ;;
1999 esac;
2000 fi;
2001 if [ $COMP_CWORD -eq 1 ]; then
2002 COMPREPLY=($( compgen -W '-o --create -i --extract -p --pass-through' -- $cur));
2003 else
2004 case ${COMP_WORDS[1]} in
2005 -@(o|-create))
2006 if [[ "$cur" == -* ]]; then
2007 COMPREPLY=($( compgen -W '-0 -a -c -v -A -B\
2008 -L -V -C -H -M -O -F --file= --format=\
2009 --message= --null --reset-access-time\
2010 --verbose --dot --append --block-size=\
2011 --dereference --io-size= --quiet\
2012 --force-local --rsh-command= --help\
2013 --version' -- $cur ));
2014 fi
2015 ;;
2016 -@(i|-extract))
2017 if [[ "$cur" == -* ]]; then
2018 COMPREPLY=($( compgen -W '-b -c -d -f -m -n -r\
2019 -t -s -u -v -B -S -V -C -E -H -M -R -I\
2020 -F --file= --make-directories\
2021 --nonmatching\
2022 --preserve-modification-time\
2023 --numeric-uid-gid --rename -t --list\
2024 --swap-bytes --swap --dot\
2025 --unconditional --verbose --block-size=\
2026 --swap-halfwords --io-size=\
2027 --pattern-file= --format= --owner=\
2028 --no-preserve-owner --message=\
2029 --force-local --no-absolute-filenames\
2030 --sparse --only-verify-crc --quiet\
2031 --rsh-command= --help\
2032 --version' -- $cur ));
2033 fi
2034 ;;
2035 -@(p|-pass-through))
2036 if [[ "$cur" == -* ]]; then
2037 COMPREPLY=($( compgen -W '-0 -a -d -l -m -u -v\
2038 -L -V -R --null --reset-access-time\
2039 --make-directories --link --quiet\
2040 --preserve-modification-time\
2041 --unconditional --verbose --dot\
2042 --dereference --owner=\
2043 --no-preserve-owner --sparse --help\
2044 --version' -- $cur ));
2045 else
2046 _filedir -d;
2047 fi
2048 ;;
2049 esac;
2050 fi
2051}
2052_cpio_format ()
2053{
2054 COMPREPLY=($( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ))
2055}
2056_cvs ()
2057{
2058 local cur count mode i cvsroot cvsroots pwd;
2059 local -a flags miss files entries changed newremoved;
2060 COMPREPLY=();
2061 cur=`_get_cword`;
2062 count=0;
2063 for i in "${COMP_WORDS[@]}";
2064 do
2065 [ $count -eq $COMP_CWORD ] && break;
2066 if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
2067 mode="";
2068 fi;
2069 if [ -z "$mode" ]; then
2070 case $i in
2071 -d)
2072 mode=cvsroot;
2073 cvsroot=${COMP_WORDS[((count+1))]}
2074 ;;
2075 @(ad?(d)|new))
2076 mode=add
2077 ;;
2078 @(adm?(in)|rcs))
2079 mode=admin
2080 ;;
2081 ann?(notate))
2082 mode=annotate
2083 ;;
2084 @(checkout|co|get))
2085 mode=checkout
2086 ;;
2087 @(com?(mit)|ci))
2088 mode=commit
2089 ;;
2090 di?(f?(f)))
2091 mode=diff
2092 ;;
2093 ex?(p?(ort)))
2094 mode=export
2095 ;;
2096 ?(un)edit)
2097 mode=$i
2098 ;;
2099 hi?(s?(tory)))
2100 mode=history
2101 ;;
2102 im?(p?(ort)))
2103 mode=import
2104 ;;
2105 re?(l?(ease)))
2106 mode=release
2107 ;;
2108 ?(r)log)
2109 mode=log
2110 ;;
2111 @(rdiff|patch))
2112 mode=rdiff
2113 ;;
2114 @(remove|rm|delete))
2115 mode=remove
2116 ;;
2117 @(rtag|rfreeze))
2118 mode=rtag
2119 ;;
2120 st?(at?(us)))
2121 mode=status
2122 ;;
2123 @(tag|freeze))
2124 mode=tag
2125 ;;
2126 up?(d?(ate)))
2127 mode=update
2128 ;;
2129 *)
2130
2131 ;;
2132 esac;
2133 else
2134 if [[ "$i" = -* ]]; then
2135 flags=("${flags[@]}" $i);
2136 fi;
2137 fi;
2138 count=$((++count));
2139 done;
2140 case "$mode" in
2141 add)
2142 if [[ "$cur" != -* ]]; then
2143 set_prefix;
2144 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
2145 get_entries;
2146 [ -z "$cur" ] && files=$( command ls -Ad !(CVS) ) || files=$( command ls -d ${cur}* 2>/dev/null );
2147 for i in "${entries[@]}";
2148 do
2149 files=(${files[@]/#$i//});
2150 done;
2151 COMPREPLY=($( compgen -X '*~' -W '${files[@]}' -- $cur ));
2152 fi;
2153 else
2154 COMPREPLY=($( compgen -W '-k -m' -- $cur ));
2155 fi
2156 ;;
2157 admin)
2158 if [[ "$cur" = -* ]]; then
2159 COMPREPLY=($( compgen -W '-i -a -A -e -b -c -k -l -u \
2160 -L -U -m -M -n -N -o -q -I \
2161 -s -t -t- -T -V -x -z' -- $cur ));
2162 fi
2163 ;;
2164 annotate)
2165 if [[ "$cur" = -* ]]; then
2166 COMPREPLY=($( compgen -W '-D -F -f -l -R -r' -- $cur ));
2167 else
2168 get_entries;
2169 COMPREPLY=($( compgen -W '${entries[@]}' -- $cur ));
2170 fi
2171 ;;
2172 checkout)
2173 if [[ "$cur" != -* ]]; then
2174 [ -z "$cvsroot" ] && cvsroot=$CVSROOT;
2175 COMPREPLY=($( cvs -d "$cvsroot" co -c 2> /dev/null | awk '{print $1}' ));
2176 COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur ));
2177 else
2178 COMPREPLY=($( compgen -W '-A -N -P -R -c -f -l -n -p \
2179 -s -r -D -d -k -j' -- $cur ));
2180 fi
2181 ;;
2182 commit)
2183 set_prefix;
2184 if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
2185 if [ -n "${COMP_CVS_REMOTE:-}" ]; then
2186 changed=($( cvs -q diff --brief 2>&1 | sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ));
2187 newremoved=($( cvs -q diff --brief 2>&1 | sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ));
2188 COMPREPLY=($( compgen -W '${changed[@]:-} \
2189 ${newremoved[@]:-}' -- $cur ));
2190 else
2191 COMPREPLY=($(compgen $default -- "$cur"));
2192 fi;
2193 else
2194 COMPREPLY=($( compgen -W '-n -R -l -f -F -m -r' -- $cur ));
2195 fi
2196 ;;
2197 cvsroot)
2198 if [ -r ~/.cvspass ]; then
2199 cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass );
2200 COMPREPLY=($( compgen -W '$cvsroots' -- $cur ));
2201 fi
2202 ;;
2203 export)
2204 if [[ "$cur" != -* ]]; then
2205 [ -z "$cvsroot" ] && cvsroot=$CVSROOT;
2206 COMPREPLY=($( cvs -d "$cvsroot" co -c | awk '{print $1}' ));
2207 COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur ));
2208 else
2209 COMPREPLY=($( compgen -W '-N -f -l -R -n \
2210 -r -D -d -k' -- $cur ));
2211 fi
2212 ;;
2213 diff)
2214 if [[ "$cur" == -* ]]; then
2215 _longopt diff;
2216 else
2217 get_entries;
2218 COMPREPLY=($( compgen -W '${entries[@]:-}' -- $cur ));
2219 fi
2220 ;;
2221 remove)
2222 if [[ "$cur" != -* ]]; then
2223 set_prefix;
2224 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
2225 get_entries;
2226 for i in "${entries[@]}";
2227 do
2228 [ ! -r "$i" ] && miss=("${miss[@]}" $i);
2229 done;
2230 COMPREPLY=($(compgen -W '${miss[@]:-}' -- $cur));
2231 fi;
2232 else
2233 COMPREPLY=($( compgen -W '-f -l -R' -- $cur ));
2234 fi
2235 ;;
2236 import)
2237 if [[ "$cur" != -* ]]; then
2238 [ -z "$cvsroot" ] && cvsroot=$CVSROOT;
2239 prefix=${cur%/*};
2240 if [ -r ${cvsroot}/${prefix} ]; then
2241 get_modules;
2242 COMPREPLY=(${COMPREPLY[@]#$cvsroot});
2243 COMPREPLY=(${COMPREPLY[@]#\/});
2244 fi;
2245 pwd=$( pwd );
2246 pwd=${pwd##*/};
2247 COMPREPLY=($( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ));
2248 else
2249 COMPREPLY=($( compgen -W '-d -k -I -b -m -W' -- $cur ));
2250 fi
2251 ;;
2252 update)
2253 if [[ "$cur" = -* ]]; then
2254 COMPREPLY=($( compgen -W '-A -P -C -d -f -l -R -p \
2255 -k -r -D -j -I -W' -- $cur ));
2256 fi
2257 ;;
2258 "")
2259 COMPREPLY=($( compgen -W 'add admin annotate checkout ci co \
2260 commit diff delete edit export \
2261 freeze get history import log new \
2262 patch rcs rdiff release remove \
2263 rfreeze rlog rm rtag stat status \
2264 tag unedit up update -H -Q -q -b \
2265 -d -e -f -l -n -t -r -v -w -x -z \
2266 --help --version' -- $cur ))
2267 ;;
2268 *)
2269
2270 ;;
2271 esac;
2272 return 0
2273}
2274_dd ()
2275{
2276 local cur;
2277 COMPREPLY=();
2278 cur=`_get_cword`;
2279 case "$cur" in
2280 if=* | of=*)
2281 cur=${cur#*=};
2282 _filedir;
2283 return 0
2284 ;;
2285 conv=*)
2286 cur=${cur#*=};
2287 COMPREPLY=($( compgen -W 'ascii ebcdic ibm block unblock \
2288 lcase notrunc ucase swab noerror sync' -- $cur ));
2289 return 0
2290 ;;
2291 esac;
2292 _expand || return 0;
2293 COMPREPLY=($( compgen -W '--help --version' -- $cur ) $( compgen -W 'bs cbs conv count ibs if obs of seek skip' -S '=' -- $cur ))
2294}
2295_debconf_show ()
2296{
2297 local cur;
2298 COMPREPLY=();
2299 cur=${COMP_WORDS[COMP_CWORD]};
2300 COMPREPLY=($( compgen -W '--listowners --listdbs --db=' -- $cur ) $( apt-cache pkgnames -- $cur ))
2301}
2302_desktop_file_validate ()
2303{
2304 COMPRELY=();
2305 cur=${COMP_WORDS[COMP_CWORD]};
2306 _filedir '@(desktop)'
2307}
2308_dhclient ()
2309{
2310 local cur prev;
2311 COMPREPLY=();
2312 cur=`_get_cword`;
2313 prev=${COMP_WORDS[COMP_CWORD-1]};
2314 case "$prev" in
2315 -@(cf|lf|pf|sf))
2316 _filedir;
2317 return 0
2318 ;;
2319 -s)
2320 _known_hosts;
2321 return 0
2322 ;;
2323 esac;
2324 if [[ "$cur" == -* ]]; then
2325 COMPREPLY=($( compgen -W '-p -d -q -1 -r -lf -pf \
2326 -cf -sf -s -g -n -nw -w' -- $cur ));
2327 else
2328 _available_interfaces;
2329 fi
2330}
2331_dkms ()
2332{
2333 local cur prev command module i;
2334 COMPREPLY=();
2335 cur=${COMP_WORDS[COMP_CWORD]};
2336 if [[ $COMP_CWORD -eq 1 ]]; then
2337 COMPREPLY=($( compgen -W "add remove build install uninstall match mkdriverdisk mktarball ldtarball mkrpm mkdeb mkdsc mkkmp status" -- $cur ));
2338 else
2339 prev=${COMP_WORDS[COMP_CWORD-1]};
2340 command=${COMP_WORDS[1]};
2341 case $prev in
2342 -m)
2343 if [ "$command" = 'add' ]; then
2344 _filename_parts '.*-.*' 1;
2345 else
2346 _subdirectories /var/lib/dkms;
2347 fi;
2348 return 0
2349 ;;
2350 -v)
2351 for ((i=1; i < COMP_CWORD; i++ ))
2352 do
2353 if [[ "${COMP_WORDS[i]}" == -m ]]; then
2354 module=${COMP_WORDS[i+1]};
2355 break;
2356 fi;
2357 done;
2358 if [ -n "$module" ]; then
2359 if [ "$command" = 'add' ]; then
2360 _filename_parts "$module-.*" 2;
2361 else
2362 _subdirectories /var/lib/dkms/$module;
2363 fi;
2364 return 0;
2365 fi
2366 ;;
2367 -k)
2368 _kernels;
2369 return 0
2370 ;;
2371 -@\(c | -spec | -archive | -config\))
2372 _filedir;
2373 return 0
2374 ;;
2375 --kernelsourcedir)
2376 _filedir -d;
2377 return 0
2378 ;;
2379 esac;
2380 if [[ "$cur" == -* ]]; then
2381 case $command in
2382 add)
2383 options='-c --rpm_safe_upgrade'
2384 ;;
2385 remove)
2386 options='--rpm_safe_upgrade'
2387 ;;
2388 build)
2389 options='--config'
2390 ;;
2391 mkdriverdisk)
2392 options='-d --distro -r --release --size'
2393 ;;
2394 ldtarball)
2395 options='--archive --force'
2396 ;;
2397 mktarball)
2398 options='--source-only --binaries-only'
2399 ;;
2400 mkrpm)
2401 options='--source-only'
2402 ;;
2403 mkkmp)
2404 options='--spec'
2405 ;;
2406 match)
2407 options='--templatekernel'
2408 ;;
2409 esac;
2410 options="$options -m -v -k -a --arch -q --quiet -V --version --all --no-prepare-kernel --no-clean-kernel --kernelsourcedir --directive";
2411 COMPREPLY=($( compgen -W "$options" -- $cur ));
2412 fi;
2413 fi
2414}
2415_dnsspoof ()
2416{
2417 local cur;
2418 COMPREPLY=();
2419 cur=`_get_cword`;
2420 prev=${COMP_WORDS[COMP_CWORD-1]};
2421 case "$prev" in
2422 -i)
2423 _interfaces;
2424 return 0
2425 ;;
2426 -f)
2427 _filedir;
2428 return 0
2429 ;;
2430 esac;
2431 if [[ "$cur" == -* ]]; then
2432 COMPREPLY=($( compgen -W '-i -f' -- $cur ));
2433 fi
2434}
2435_dpkg ()
2436{
2437 local cur prev i;
2438 COMPREPLY=();
2439 cur=`_get_cword`;
2440 prev=${COMP_WORDS[COMP_CWORD-1]};
2441 i=$COMP_CWORD;
2442 _expand || return 0;
2443 if [[ $cur != -* ]]; then
2444 while [[ $prev != -* && $i != 1 ]]; do
2445 i=$((i-1));
2446 prev=${COMP_WORDS[i-1]};
2447 done;
2448 fi;
2449 case "$prev" in
2450 -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
2451 _filedir '?(u)deb';
2452 return 0
2453 ;;
2454 -@(b|-build))
2455 _filedir -d;
2456 return 0
2457 ;;
2458 -@(s|p|l|-@(status|print-avail|list)))
2459 COMPREPLY=($( apt-cache pkgnames $cur 2>/dev/null ));
2460 return 0
2461 ;;
2462 -@(S|-search))
2463 _filedir;
2464 return 0
2465 ;;
2466 -@(r|L|P|-@(remove|purge|listfiles)))
2467 COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
2468 return 0
2469 ;;
2470 *)
2471 COMPREPLY=($( compgen -W '-i --install --unpack -A --record-avail \
2472 --configure -r --remove -P --purge --get-selections \
2473 --set-selections --update-avail --merge-avail \
2474 --clear-avail --command-fd --forget-old-unavail -s \
2475 --status -p --print-avail -L --listfiles -l --list \
2476 -S --search -C --audit --print-architecture \
2477 --print-gnu-build-architecture \
2478 --print-installation-architecture \
2479 --compare-versions --help --version --force-help \
2480 --force-all --force-auto-select --force-downgrade \
2481 --force-configure-any --force-hold --force-bad-path \
2482 --force-not-root --force-overwrite \
2483 --force-overwrite-diverted --force-bad-verify \
2484 --force-depends-version --force-depends \
2485 --force-confnew --force-confold --force-confdef \
2486 --force-confmiss --force-conflicts --force-architecture\
2487 --force-overwrite-dir --force-remove-reinstreq \
2488 --force-remove-essential -Dh \
2489 --debug=help --licence --admindir= --root= --instdir= \
2490 -O --selected-only -E --skip-same-version \
2491 -G --refuse-downgrade -B --auto-deconfigure \
2492 --no-debsig --no-act -D --debug= --status-fd \
2493 -b --build -I --info -f --field -c --contents \
2494 -x --extract -X --vextract --fsys-tarfile -e --control \
2495 --ignore-depends= --abort-after' -- $cur ))
2496 ;;
2497 esac
2498}
2499_dpkg_reconfigure ()
2500{
2501 local cur prev opt;
2502 COMPREPLY=();
2503 cur=`_get_cword`;
2504 prev=${COMP_WORDS[COMP_CWORD-1]};
2505 case "$prev" in
2506 -@(f|-frontend))
2507 opt=($( echo /usr/share/perl5/Debconf/FrontEnd/* ));
2508 opt=(${opt[@]##*/});
2509 opt=(${opt[@]%.pm});
2510 COMPREPLY=($( compgen -W '${opt[@]}' -- $cur ));
2511 return 0
2512 ;;
2513 -@(p|-priority))
2514 COMPREPLY=($( compgen -W 'low medium high critical' -- $cur ));
2515 return 0
2516 ;;
2517 esac;
2518 if [[ "$cur" == -* ]]; then
2519 COMPREPLY=($( compgen -W '-f --frontend -p --priority -a --all \
2520 -u --unseen-only -h --help -s --showold \
2521 --force --terse' -- $cur ));
2522 else
2523 COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
2524 fi
2525}
2526_dpkg_source ()
2527{
2528 local cur prev options work i action packopts unpackopts;
2529 packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR";
2530 unpackopts="-sp -sn -su";
2531 options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`;
2532 COMPREPLY=();
2533 if [ "$1" != "dpkg-source" ]; then
2534 return 1;
2535 fi;
2536 cur=`_get_cword`;
2537 prev=${COMP_WORDS[COMP_CWORD-1]};
2538 action="options";
2539 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
2540 do
2541 if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
2542 action=unpack;
2543 else
2544 if [[ ${COMP_WORDS[$i]} == "-b" ]]; then
2545 action=pack;
2546 else
2547 if [[ ${COMP_WORDS[$i]} == "-h" ]]; then
2548 action=help;
2549 fi;
2550 fi;
2551 fi;
2552 done;
2553 for i in $options;
2554 do
2555 if [ "$cur" = "$i" ]; then
2556 COMPREPLY=("$cur");
2557 return 0;
2558 fi;
2559 done;
2560 case "$action" in
2561 "unpack")
2562 if [ "$cur" = "-" -o "$cur" = "-s" ]; then
2563 COMPREPLY=($unpackopts);
2564 return 0;
2565 fi;
2566 case "$prev" in
2567 "-x")
2568 COMPREPLY=($( compgen -d -- "$cur" ) $( compgen -f -X '!*.dsc' -- "$cur" ));
2569 return 0
2570 ;;
2571 *)
2572 COMPREPLY=($unpackopts $(compgen -d -f -- "$cur" ));
2573 return 0
2574 ;;
2575 esac;
2576 return 0
2577 ;;
2578 "pack")
2579 if [ "$cur" = "-" ]; then
2580 COMPREPLY=($packopts);
2581 return 0;
2582 fi;
2583 if [ "$cur" = "-s" ]; then
2584 COMPREPLY=("-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" "-sA" "-sK" "-sP" "-sU" "-sR");
2585 return 0;
2586 fi;
2587 case "$prev" in
2588 "-b")
2589 COMPREPLY=($( compgen -d -- "$cur" ));
2590 return 0
2591 ;;
2592 "-c" | "-l" | "-T" | "-i" | "-I")
2593 COMPREPLY=($( compgen -d -f ));
2594 return 0
2595 ;;
2596 "-F")
2597 COMPREPLY=($( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ));
2598 return 0
2599 ;;
2600 "-V" | "-D")
2601 COMPREPLY=();
2602 return 0
2603 ;;
2604 "-D")
2605 if echo -- "$cur" | grep -q "="; then
2606 COMPREPLY=();
2607 return 0;
2608 else
2609 COMPREPLY=(Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files);
2610 return 0;
2611 fi
2612 ;;
2613 "-U")
2614 COMPREPLY=(Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files);
2615 return 0
2616 ;;
2617 *)
2618 COMPREPLY=($packopts);
2619 return 0
2620 ;;
2621 esac;
2622 return 0
2623 ;;
2624 *)
2625 if [ "$cur" = "-s" ]; then
2626 COMPREPLY=("-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" "-sA" "-sK" "-sP" "-sU" "-sR");
2627 return 0;
2628 fi;
2629 COMPREPLY=($options);
2630 return 0
2631 ;;
2632 esac
2633}
2634_dsniff ()
2635{
2636 local cur;
2637 COMPREPLY=();
2638 cur=`_get_cword`;
2639 prev=${COMP_WORDS[COMP_CWORD-1]};
2640 case "$prev" in
2641 -@(r|w|f))
2642 _filedir;
2643 return 0
2644 ;;
2645 -i)
2646 _interfaces;
2647 return 0
2648 ;;
2649 esac;
2650 if [[ "$cur" == -* ]]; then
2651 COMPREPLY=($( compgen -W '-c -d -m -n -i -s -f -t \
2652 -r -w' -- $cur ));
2653 fi
2654}
2655_dumpdb ()
2656{
2657 local cur;
2658 COMPREPLY=();
2659 cur=`_get_cword`;
2660 if [[ "$cur" == -* ]]; then
2661 COMPREPLY=($( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- $cur ));
2662 else
2663 _filedir;
2664 fi
2665}
2666_expand ()
2667{
2668 if [[ "$cur" == \~*/* ]]; then
2669 eval cur=$cur;
2670 else
2671 if [[ "$cur" == \~* ]]; then
2672 cur=${cur#\~};
2673 COMPREPLY=($( compgen -P '~' -u $cur ));
2674 [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]};
2675 return ${#COMPREPLY[@]};
2676 fi;
2677 fi
2678}
2679_export ()
2680{
2681 local cur;
2682 COMPREPLY=();
2683 cur=`_get_cword`;
2684 case "$COMP_LINE" in
2685 *=\$*)
2686 COMPREPLY=($( compgen -v -P '$' -- ${cur#*=\$} ))
2687 ;;
2688 *[^=])
2689 COMPREPLY=($( compgen -v -S '=' -- $cur ))
2690 ;;
2691 *=)
2692 COMPREPLY=("$( eval echo -n \"$`echo ${cur%=}`\" |
2693 ( echo -n \'
2694 sed -e 's/'\''/'\''\\\'\'''\''/g'
2695 echo -n \' ) )")
2696 ;;
2697 esac
2698}
2699_filedir ()
2700{
2701 local IFS='
2702' xspec;
2703 _expand || return 0;
2704 local -a toks;
2705 local tmp;
2706 toks=(${toks[@]-} $(
2707 compgen -d -- "$(quote_readline "$cur")" | {
2708 while read -r tmp; do
2709 echo $tmp
2710 done
2711 }
2712 ));
2713 if [[ "$1" != -d ]]; then
2714 xspec=${1:+"!*.$1"};
2715 toks=(${toks[@]-} $(
2716 compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
2717 while read -r tmp; do
2718 [ -n $tmp ] && echo $tmp
2719 done
2720 }
2721 ));
2722 fi;
2723 COMPREPLY=("${COMPREPLY[@]}" "${toks[@]}")
2724}
2725_filedir_xspec ()
2726{
2727 local IFS cur xspec;
2728 IFS='
2729';
2730 COMPREPLY=();
2731 cur=`_get_cword`;
2732 _expand || return 0;
2733 xspec=$( sed -ne '/^complete .*[ ]'${1##*/}'\([ ]\|$\)/{p;q;}' $BASH_COMPLETION );
2734 xspec=${xspec#*-X };
2735 xspec=${xspec%% *};
2736 local -a toks;
2737 local tmp;
2738 toks=(${toks[@]-} $(
2739 compgen -d -- "$(quote_readline "$cur")" | {
2740 while read -r tmp; do
2741 # see long TODO comment in _filedir() --David
2742 echo $tmp
2743 done
2744 }
2745 ));
2746 toks=(${toks[@]-} $(
2747 eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
2748 while read -r tmp; do
2749 [ -n $tmp ] && echo $tmp
2750 done
2751 }
2752 ));
2753 COMPREPLY=("${toks[@]}")
2754}
2755_filename_parts ()
2756{
2757 COMPREPLY=($( command ls -F /usr/src/ 2>/dev/null | grep -E '^'$1'/$' | sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" ))
2758}
2759_find ()
2760{
2761 local cur prev i exprfound onlyonce;
2762 COMPREPLY=();
2763 cur=`_get_cword`;
2764 prev=${COMP_WORDS[COMP_CWORD-1]};
2765 case "$prev" in
2766 -@(max|min)depth)
2767 COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ));
2768 return 0
2769 ;;
2770 -?(a|c)newer | -fls | -fprint?(0|f) | -?(i)?(l)name | -?(i)wholename)
2771 _filedir;
2772 return 0
2773 ;;
2774 -fstype)
2775 [ -e /proc/filesystems ] && COMPREPLY=($( cut -d' ' -f 2 /proc/filesystems | grep "^$cur" ));
2776 return 0
2777 ;;
2778 -gid)
2779 _gids;
2780 return 0
2781 ;;
2782 -group)
2783 if [ -n "$bash205" ]; then
2784 COMPREPLY=($( compgen -g -- $cur 2>/dev/null));
2785 fi;
2786 return 0
2787 ;;
2788 -?(x)type)
2789 COMPREPLY=($( compgen -W 'b c d p f l s' -- $cur ));
2790 return 0
2791 ;;
2792 -uid)
2793 _uids;
2794 return 0
2795 ;;
2796 -user)
2797 COMPREPLY=($( compgen -u -- $cur ));
2798 return 0
2799 ;;
2800 -exec | -ok)
2801 COMP_WORDS=(COMP_WORDS[0] $cur);
2802 COMP_CWORD=1;
2803 _command;
2804 return 0
2805 ;;
2806 -[acm]min | -[acm]time | -?(i)?(l)?(whole)name | -inum | -?(i)path | -?(i)regex | -links | -perm | -size | -used | -printf)
2807 return 0
2808 ;;
2809 esac;
2810 _expand || return 0;
2811 for i in ${COMP_WORDS[@]};
2812 do
2813 [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break;
2814 done;
2815 if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
2816 _filedir -d;
2817 return 0;
2818 fi;
2819 COMPREPLY=($( compgen -W '-daystart -depth -follow -help -maxdepth \
2820 -mindepth -mount -noleaf -version -xdev -amin -anewer \
2821 -atime -cmin -cnewer -ctime -empty -false -fstype \
2822 -gid -group -ilname -iname -inum -ipath -iregex \
2823 -wholename \
2824 -links -lname -mmin -mtime -name -newer -nouser \
2825 -nogroup -perm -regex -size -true -type -uid -used \
2826 -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
2827 -print -print0 -printf -prune -ls -wholename -iwholename' -- $cur ));
2828 onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
2829 -noleaf -version -xdev ';
2830 COMPREPLY=($( echo "${COMP_WORDS[@]}" | (while read -d ' ' i; do
2831 [ "$i" == "" ] ||
2832 [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
2833 continue
2834 # flatten array with spaces on either side,
2835 # otherwise we cannot grep on word boundaries of
2836 # first and last word
2837 COMPREPLY=" ${COMPREPLY[@]} "
2838 # remove word from list of completions
2839 COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
2840 done
2841 echo "${COMPREPLY[@]}")
2842 ));
2843 _filedir;
2844 return 0
2845}
2846_find_member ()
2847{
2848 local cur prev;
2849 COMPREPLY=();
2850 cur=`_get_cword`;
2851 prev=${COMP_WORDS[COMP_CWORD-1]};
2852 case "$prev" in
2853 -@(l|x|-listname=|-exclude=))
2854 _mailman_lists;
2855 return 0
2856 ;;
2857 esac;
2858 if [[ "$cur" == -* ]]; then
2859 COMPREPLY=($( compgen -W '-l --listname= -x \
2860 --exclude= --owners -w --help -h' -- $cur ));
2861 fi
2862}
2863_function ()
2864{
2865 local cur prev;
2866 COMPREPLY=();
2867 cur=`_get_cword`;
2868 prev=${COMP_WORDS[COMP_CWORD-1]};
2869 if [[ $1 == @(declare|typeset) ]]; then
2870 if [ "$prev" = -f ]; then
2871 COMPREPLY=($( compgen -A function -- $cur ));
2872 else
2873 if [[ "$cur" == -* ]]; then
2874 COMPREPLY=($( compgen -W '-a -f -F -i -r -x -p' -- $cur ));
2875 fi;
2876 fi;
2877 else
2878 if [ $COMP_CWORD -eq 1 ]; then
2879 COMPREPLY=($( compgen -A function -- $cur ));
2880 else
2881 COMPREPLY=("() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )");
2882 fi;
2883 fi
2884}
2885_gcc ()
2886{
2887 local cur cc backend;
2888 COMPREPLY=();
2889 cur=`_get_cword`;
2890 _expand || return 0;
2891 case "$1" in
2892 gcj)
2893 backend=jc1
2894 ;;
2895 gpc)
2896 backend=gpc1
2897 ;;
2898 *77)
2899 backend=f771
2900 ;;
2901 *)
2902 backend=cc1
2903 ;;
2904 esac;
2905 if [[ "$cur" == -* ]]; then
2906 cc=$( $1 -print-prog-name=$backend );
2907 COMPREPLY=($( $cc --help 2>/dev/null | tr '\t' ' ' | sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | command grep "^$cur" | sort -u ));
2908 else
2909 _filedir;
2910 fi
2911}
2912_gcl ()
2913{
2914 local cur;
2915 COMPREPLY=();
2916 cur=`_get_cword`;
2917 if [[ "$cur" == -* ]]; then
2918 COMPREPLY=($( compgen -W '-eval -load -f -batch -dir -libdir \
2919 -compile -o-file -c-file -h-file -data-file -system-p ' -- $cur ));
2920 else
2921 _filedir;
2922 fi;
2923 return 0
2924}
2925_gdb ()
2926{
2927 local cur prev;
2928 COMPREPLY=();
2929 cur=`_get_cword`;
2930 prev=${COMP_WORDS[COMP_CWORD-1]};
2931 if [ $COMP_CWORD -eq 1 ]; then
2932 local IFS;
2933 if [[ "$cur" == */* ]]; then
2934 IFS='
2935';
2936 COMPREPLY=($( PATH="$PATH:." compgen -d -c -- "$cur" ));
2937 else
2938 IFS=":";
2939 local path_array=($(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g'));
2940 IFS='
2941';
2942 COMPREPLY=($( compgen -d -W '$(find "${path_array[@]}" . \
2943 -mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n" 2>/dev/null)' -- "$cur" ));
2944 fi;
2945 else
2946 if [ $COMP_CWORD -eq 2 ]; then
2947 prev=${prev##*/};
2948 COMPREPLY=($( compgen -fW "$( command ps axo comm,pid | awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" -- "$cur" ));
2949 fi;
2950 fi
2951}
2952_genaliases ()
2953{
2954 local cur;
2955 COMPREPLY=();
2956 cur=`_get_cword`;
2957 if [[ "$cur" == -* ]]; then
2958 COMPREPLY=($( compgen -W '-q --quiet -h --help' -- $cur ));
2959 fi
2960}
2961_get_cword ()
2962{
2963 if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
2964 printf "%s" "${COMP_WORDS[COMP_CWORD]}";
2965 else
2966 local i;
2967 local cur="$COMP_LINE";
2968 local index="$COMP_POINT";
2969 for ((i = 0; i <= COMP_CWORD; ++i ))
2970 do
2971 while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
2972 cur="${cur:1}";
2973 index="$(( index - 1 ))";
2974 done;
2975 if [[ "$i" -lt "$COMP_CWORD" ]]; then
2976 local old_size="${#cur}";
2977 cur="${cur#${COMP_WORDS[i]}}";
2978 local new_size="${#cur}";
2979 index="$(( index - old_size + new_size ))";
2980 fi;
2981 done;
2982 if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
2983 printf "%s" "${COMP_WORDS[COMP_CWORD]}";
2984 else
2985 printf "%s" "${cur:0:$index}";
2986 fi;
2987 fi
2988}
2989_getent ()
2990{
2991 local cur prev;
2992 COMPREPLY=();
2993 cur=`_get_cword`;
2994 prev=${COMP_WORDS[COMP_CWORD-1]};
2995 case $prev in
2996 passwd)
2997 COMPREPLY=($( compgen -u $cur ));
2998 return 0
2999 ;;
3000 group)
3001 COMPREPLY=($( compgen -g $cur ));
3002 return 0
3003 ;;
3004 services)
3005 COMPREPLY=($( compgen -s $cur ));
3006 return 0
3007 ;;
3008 hosts)
3009 COMPREPLY=($( compgen -A hostname $cur ));
3010 return 0
3011 ;;
3012 protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc)
3013 COMPREPLY=($( getent $prev | sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ));
3014 return 0
3015 ;;
3016 aliases | shadow)
3017 COMPREPLY=($( getent $prev | sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ));
3018 return 0
3019 ;;
3020 esac;
3021 if [ $COMP_CWORD -eq 1 ]; then
3022 COMPREPLY=($( compgen -W 'passwd group hosts services \
3023 protocols networks ahosts ahostsv4 \
3024 ahostsv6 aliases ethers netgroup \
3025 rpc shadow' -- $cur ));
3026 fi
3027}
3028_gids ()
3029{
3030 if type getent &>/dev/null; then
3031 COMPREPLY=($( getent group | awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ));
3032 else
3033 if type perl &>/dev/null; then
3034 COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ));
3035 else
3036 COMPREPLY=($( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}' /etc/group ));
3037 fi;
3038 fi
3039}
3040_git ()
3041{
3042 local i c=1 command __git_dir;
3043 while [ $c -lt $COMP_CWORD ]; do
3044 i="${COMP_WORDS[c]}";
3045 case "$i" in
3046 --git-dir=*)
3047 __git_dir="${i#--git-dir=}"
3048 ;;
3049 --bare)
3050 __git_dir="."
3051 ;;
3052 --version | -p | --paginate)
3053
3054 ;;
3055 --help)
3056 command="help";
3057 break
3058 ;;
3059 *)
3060 command="$i";
3061 break
3062 ;;
3063 esac;
3064 c=$((++c));
3065 done;
3066 if [ -z "$command" ]; then
3067 case "${COMP_WORDS[COMP_CWORD]}" in
3068 --*)
3069 __gitcomp "
3070 --paginate
3071 --no-pager
3072 --git-dir=
3073 --bare
3074 --version
3075 --exec-path
3076 --html-path
3077 --work-tree=
3078 --help
3079 "
3080 ;;
3081 *)
3082 __gitcomp "$(__git_porcelain_commands) $(__git_aliases)"
3083 ;;
3084 esac;
3085 return;
3086 fi;
3087 local expansion=$(__git_aliased_command "$command");
3088 [ "$expansion" ] && command="$expansion";
3089 case "$command" in
3090 am)
3091 _git_am
3092 ;;
3093 add)
3094 _git_add
3095 ;;
3096 apply)
3097 _git_apply
3098 ;;
3099 archive)
3100 _git_archive
3101 ;;
3102 bisect)
3103 _git_bisect
3104 ;;
3105 bundle)
3106 _git_bundle
3107 ;;
3108 branch)
3109 _git_branch
3110 ;;
3111 checkout)
3112 _git_checkout
3113 ;;
3114 cherry)
3115 _git_cherry
3116 ;;
3117 cherry-pick)
3118 _git_cherry_pick
3119 ;;
3120 clean)
3121 _git_clean
3122 ;;
3123 clone)
3124 _git_clone
3125 ;;
3126 commit)
3127 _git_commit
3128 ;;
3129 config)
3130 _git_config
3131 ;;
3132 describe)
3133 _git_describe
3134 ;;
3135 diff)
3136 _git_diff
3137 ;;
3138 difftool)
3139 _git_difftool
3140 ;;
3141 fetch)
3142 _git_fetch
3143 ;;
3144 format-patch)
3145 _git_format_patch
3146 ;;
3147 fsck)
3148 _git_fsck
3149 ;;
3150 gc)
3151 _git_gc
3152 ;;
3153 grep)
3154 _git_grep
3155 ;;
3156 help)
3157 _git_help
3158 ;;
3159 init)
3160 _git_init
3161 ;;
3162 log)
3163 _git_log
3164 ;;
3165 ls-files)
3166 _git_ls_files
3167 ;;
3168 ls-remote)
3169 _git_ls_remote
3170 ;;
3171 ls-tree)
3172 _git_ls_tree
3173 ;;
3174 merge)
3175 _git_merge
3176 ;;
3177 mergetool)
3178 _git_mergetool
3179 ;;
3180 merge-base)
3181 _git_merge_base
3182 ;;
3183 mv)
3184 _git_mv
3185 ;;
3186 name-rev)
3187 _git_name_rev
3188 ;;
3189 pull)
3190 _git_pull
3191 ;;
3192 push)
3193 _git_push
3194 ;;
3195 rebase)
3196 _git_rebase
3197 ;;
3198 remote)
3199 _git_remote
3200 ;;
3201 reset)
3202 _git_reset
3203 ;;
3204 revert)
3205 _git_revert
3206 ;;
3207 rm)
3208 _git_rm
3209 ;;
3210 send-email)
3211 _git_send_email
3212 ;;
3213 shortlog)
3214 _git_shortlog
3215 ;;
3216 show)
3217 _git_show
3218 ;;
3219 show-branch)
3220 _git_show_branch
3221 ;;
3222 stash)
3223 _git_stash
3224 ;;
3225 stage)
3226 _git_add
3227 ;;
3228 submodule)
3229 _git_submodule
3230 ;;
3231 svn)
3232 _git_svn
3233 ;;
3234 tag)
3235 _git_tag
3236 ;;
3237 whatchanged)
3238 _git_log
3239 ;;
3240 *)
3241 COMPREPLY=()
3242 ;;
3243 esac
3244}
3245_git_add ()
3246{
3247 __git_has_doubledash && return;
3248 local cur="${COMP_WORDS[COMP_CWORD]}";
3249 case "$cur" in
3250 --*)
3251 __gitcomp "
3252 --interactive --refresh --patch --update --dry-run
3253 --ignore-errors --intent-to-add
3254 ";
3255 return
3256 ;;
3257 esac;
3258 COMPREPLY=()
3259}
3260_git_am ()
3261{
3262 local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)";
3263 if [ -d "$dir"/rebase-apply ]; then
3264 __gitcomp "--skip --resolved --abort";
3265 return;
3266 fi;
3267 case "$cur" in
3268 --whitespace=*)
3269 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}";
3270 return
3271 ;;
3272 --*)
3273 __gitcomp "
3274 --3way --committer-date-is-author-date --ignore-date
3275 --interactive --keep --no-utf8 --signoff --utf8
3276 --whitespace=
3277 ";
3278 return
3279 ;;
3280 esac;
3281 COMPREPLY=()
3282}
3283_git_apply ()
3284{
3285 local cur="${COMP_WORDS[COMP_CWORD]}";
3286 case "$cur" in
3287 --whitespace=*)
3288 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}";
3289 return
3290 ;;
3291 --*)
3292 __gitcomp "
3293 --stat --numstat --summary --check --index
3294 --cached --index-info --reverse --reject --unidiff-zero
3295 --apply --no-add --exclude=
3296 --whitespace= --inaccurate-eof --verbose
3297 ";
3298 return
3299 ;;
3300 esac;
3301 COMPREPLY=()
3302}
3303_git_archive ()
3304{
3305 local cur="${COMP_WORDS[COMP_CWORD]}";
3306 case "$cur" in
3307 --format=*)
3308 __gitcomp "$(git archive --list)" "" "${cur##--format=}";
3309 return
3310 ;;
3311 --remote=*)
3312 __gitcomp "$(__git_remotes)" "" "${cur##--remote=}";
3313 return
3314 ;;
3315 --*)
3316 __gitcomp "
3317 --format= --list --verbose
3318 --prefix= --remote= --exec=
3319 ";
3320 return
3321 ;;
3322 esac;
3323 __git_complete_file
3324}
3325_git_bisect ()
3326{
3327 __git_has_doubledash && return;
3328 local subcommands="start bad good skip reset visualize replay log run";
3329 local subcommand="$(__git_find_subcommand "$subcommands")";
3330 if [ -z "$subcommand" ]; then
3331 __gitcomp "$subcommands";
3332 return;
3333 fi;
3334 case "$subcommand" in
3335 bad | good | reset | skip)
3336 __gitcomp "$(__git_refs)"
3337 ;;
3338 *)
3339 COMPREPLY=()
3340 ;;
3341 esac
3342}
3343_git_branch ()
3344{
3345 local i c=1 only_local_ref="n" has_r="n";
3346 while [ $c -lt $COMP_CWORD ]; do
3347 i="${COMP_WORDS[c]}";
3348 case "$i" in
3349 -d | -m)
3350 only_local_ref="y"
3351 ;;
3352 -r)
3353 has_r="y"
3354 ;;
3355 esac;
3356 c=$((++c));
3357 done;
3358 case "${COMP_WORDS[COMP_CWORD]}" in
3359 --*)
3360 __gitcomp "
3361 --color --no-color --verbose --abbrev= --no-abbrev
3362 --track --no-track --contains --merged --no-merged
3363 "
3364 ;;
3365 *)
3366 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
3367 __gitcomp "$(__git_heads)";
3368 else
3369 __gitcomp "$(__git_refs)";
3370 fi
3371 ;;
3372 esac
3373}
3374_git_bundle ()
3375{
3376 local cmd="${COMP_WORDS[2]}";
3377 case "$COMP_CWORD" in
3378 2)
3379 __gitcomp "create list-heads verify unbundle"
3380 ;;
3381 3)
3382
3383 ;;
3384 *)
3385 case "$cmd" in
3386 create)
3387 __git_complete_revlist
3388 ;;
3389 esac
3390 ;;
3391 esac
3392}
3393_git_checkout ()
3394{
3395 __git_has_doubledash && return;
3396 __gitcomp "$(__git_refs)"
3397}
3398_git_cherry ()
3399{
3400 __gitcomp "$(__git_refs)"
3401}
3402_git_cherry_pick ()
3403{
3404 local cur="${COMP_WORDS[COMP_CWORD]}";
3405 case "$cur" in
3406 --*)
3407 __gitcomp "--edit --no-commit"
3408 ;;
3409 *)
3410 __gitcomp "$(__git_refs)"
3411 ;;
3412 esac
3413}
3414_git_clean ()
3415{
3416 __git_has_doubledash && return;
3417 local cur="${COMP_WORDS[COMP_CWORD]}";
3418 case "$cur" in
3419 --*)
3420 __gitcomp "--dry-run --quiet";
3421 return
3422 ;;
3423 esac;
3424 COMPREPLY=()
3425}
3426_git_clone ()
3427{
3428 local cur="${COMP_WORDS[COMP_CWORD]}";
3429 case "$cur" in
3430 --*)
3431 __gitcomp "
3432 --local
3433 --no-hardlinks
3434 --shared
3435 --reference
3436 --quiet
3437 --no-checkout
3438 --bare
3439 --mirror
3440 --origin
3441 --upload-pack
3442 --template=
3443 --depth
3444 ";
3445 return
3446 ;;
3447 esac;
3448 COMPREPLY=()
3449}
3450_git_commit ()
3451{
3452 __git_has_doubledash && return;
3453 local cur="${COMP_WORDS[COMP_CWORD]}";
3454 case "$cur" in
3455 --*)
3456 __gitcomp "
3457 --all --author= --signoff --verify --no-verify
3458 --edit --amend --include --only --interactive
3459 ";
3460 return
3461 ;;
3462 esac;
3463 COMPREPLY=()
3464}
3465_git_config ()
3466{
3467 local cur="${COMP_WORDS[COMP_CWORD]}";
3468 local prv="${COMP_WORDS[COMP_CWORD-1]}";
3469 case "$prv" in
3470 branch.*.remote)
3471 __gitcomp "$(__git_remotes)";
3472 return
3473 ;;
3474 branch.*.merge)
3475 __gitcomp "$(__git_refs)";
3476 return
3477 ;;
3478 remote.*.fetch)
3479 local remote="${prv#remote.}";
3480 remote="${remote%.fetch}";
3481 __gitcomp "$(__git_refs_remotes "$remote")";
3482 return
3483 ;;
3484 remote.*.push)
3485 local remote="${prv#remote.}";
3486 remote="${remote%.push}";
3487 __gitcomp "$(git --git-dir="$(__gitdir)" for-each-ref --format='%(refname):%(refname)' refs/heads)";
3488 return
3489 ;;
3490 pull.twohead | pull.octopus)
3491 __gitcomp "$(__git_merge_strategies)";
3492 return
3493 ;;
3494 color.branch | color.diff | color.interactive | color.status | color.ui)
3495 __gitcomp "always never auto";
3496 return
3497 ;;
3498 color.pager)
3499 __gitcomp "false true";
3500 return
3501 ;;
3502 color.*.*)
3503 __gitcomp "
3504 normal black red green yellow blue magenta cyan white
3505 bold dim ul blink reverse
3506 ";
3507 return
3508 ;;
3509 help.format)
3510 __gitcomp "man info web html";
3511 return
3512 ;;
3513 log.date)
3514 __gitcomp "$__git_log_date_formats";
3515 return
3516 ;;
3517 sendemail.aliasesfiletype)
3518 __gitcomp "mutt mailrc pine elm gnus";
3519 return
3520 ;;
3521 sendemail.confirm)
3522 __gitcomp "$__git_send_email_confirm_options";
3523 return
3524 ;;
3525 sendemail.suppresscc)
3526 __gitcomp "$__git_send_email_suppresscc_options";
3527 return
3528 ;;
3529 *.*)
3530 COMPREPLY=();
3531 return
3532 ;;
3533 esac;
3534 case "$cur" in
3535 --*)
3536 __gitcomp "
3537 --global --system --file=
3538 --list --replace-all
3539 --get --get-all --get-regexp
3540 --add --unset --unset-all
3541 --remove-section --rename-section
3542 ";
3543 return
3544 ;;
3545 branch.*.*)
3546 local pfx="${cur%.*}.";
3547 cur="${cur##*.}";
3548 __gitcomp "remote merge mergeoptions" "$pfx" "$cur";
3549 return
3550 ;;
3551 branch.*)
3552 local pfx="${cur%.*}.";
3553 cur="${cur#*.}";
3554 __gitcomp "$(__git_heads)" "$pfx" "$cur" ".";
3555 return
3556 ;;
3557 guitool.*.*)
3558 local pfx="${cur%.*}.";
3559 cur="${cur##*.}";
3560 __gitcomp "
3561 argprompt cmd confirm needsfile noconsole norescan
3562 prompt revprompt revunmerged title
3563 " "$pfx" "$cur";
3564 return
3565 ;;
3566 difftool.*.*)
3567 local pfx="${cur%.*}.";
3568 cur="${cur##*.}";
3569 __gitcomp "cmd path" "$pfx" "$cur";
3570 return
3571 ;;
3572 man.*.*)
3573 local pfx="${cur%.*}.";
3574 cur="${cur##*.}";
3575 __gitcomp "cmd path" "$pfx" "$cur";
3576 return
3577 ;;
3578 mergetool.*.*)
3579 local pfx="${cur%.*}.";
3580 cur="${cur##*.}";
3581 __gitcomp "cmd path trustExitCode" "$pfx" "$cur";
3582 return
3583 ;;
3584 pager.*)
3585 local pfx="${cur%.*}.";
3586 cur="${cur#*.}";
3587 __gitcomp "$(__git_all_commands)" "$pfx" "$cur";
3588 return
3589 ;;
3590 remote.*.*)
3591 local pfx="${cur%.*}.";
3592 cur="${cur##*.}";
3593 __gitcomp "
3594 url proxy fetch push mirror skipDefaultUpdate
3595 receivepack uploadpack tagopt
3596 " "$pfx" "$cur";
3597 return
3598 ;;
3599 remote.*)
3600 local pfx="${cur%.*}.";
3601 cur="${cur#*.}";
3602 __gitcomp "$(__git_remotes)" "$pfx" "$cur" ".";
3603 return
3604 ;;
3605 url.*.*)
3606 local pfx="${cur%.*}.";
3607 cur="${cur##*.}";
3608 __gitcomp "insteadof" "$pfx" "$cur";
3609 return
3610 ;;
3611 esac;
3612 __gitcomp "
3613 alias.
3614 apply.whitespace
3615 branch.autosetupmerge
3616 branch.autosetuprebase
3617 clean.requireForce
3618 color.branch
3619 color.branch.current
3620 color.branch.local
3621 color.branch.plain
3622 color.branch.remote
3623 color.diff
3624 color.diff.commit
3625 color.diff.frag
3626 color.diff.meta
3627 color.diff.new
3628 color.diff.old
3629 color.diff.plain
3630 color.diff.whitespace
3631 color.grep
3632 color.grep.external
3633 color.grep.match
3634 color.interactive
3635 color.interactive.header
3636 color.interactive.help
3637 color.interactive.prompt
3638 color.pager
3639 color.status
3640 color.status.added
3641 color.status.changed
3642 color.status.header
3643 color.status.nobranch
3644 color.status.untracked
3645 color.status.updated
3646 color.ui
3647 commit.template
3648 core.autocrlf
3649 core.bare
3650 core.compression
3651 core.createObject
3652 core.deltaBaseCacheLimit
3653 core.editor
3654 core.excludesfile
3655 core.fileMode
3656 core.fsyncobjectfiles
3657 core.gitProxy
3658 core.ignoreCygwinFSTricks
3659 core.ignoreStat
3660 core.logAllRefUpdates
3661 core.loosecompression
3662 core.packedGitLimit
3663 core.packedGitWindowSize
3664 core.pager
3665 core.preferSymlinkRefs
3666 core.preloadindex
3667 core.quotepath
3668 core.repositoryFormatVersion
3669 core.safecrlf
3670 core.sharedRepository
3671 core.symlinks
3672 core.trustctime
3673 core.warnAmbiguousRefs
3674 core.whitespace
3675 core.worktree
3676 diff.autorefreshindex
3677 diff.external
3678 diff.mnemonicprefix
3679 diff.renameLimit
3680 diff.renameLimit.
3681 diff.renames
3682 diff.suppressBlankEmpty
3683 diff.tool
3684 diff.wordRegex
3685 difftool.
3686 difftool.prompt
3687 fetch.unpackLimit
3688 format.attach
3689 format.cc
3690 format.headers
3691 format.numbered
3692 format.pretty
3693 format.signoff
3694 format.subjectprefix
3695 format.suffix
3696 format.thread
3697 gc.aggressiveWindow
3698 gc.auto
3699 gc.autopacklimit
3700 gc.packrefs
3701 gc.pruneexpire
3702 gc.reflogexpire
3703 gc.reflogexpireunreachable
3704 gc.rerereresolved
3705 gc.rerereunresolved
3706 gitcvs.allbinary
3707 gitcvs.commitmsgannotation
3708 gitcvs.dbTableNamePrefix
3709 gitcvs.dbdriver
3710 gitcvs.dbname
3711 gitcvs.dbpass
3712 gitcvs.dbuser
3713 gitcvs.enabled
3714 gitcvs.logfile
3715 gitcvs.usecrlfattr
3716 guitool.
3717 gui.blamehistoryctx
3718 gui.commitmsgwidth
3719 gui.copyblamethreshold
3720 gui.diffcontext
3721 gui.encoding
3722 gui.fastcopyblame
3723 gui.matchtrackingbranch
3724 gui.newbranchtemplate
3725 gui.pruneduringfetch
3726 gui.spellingdictionary
3727 gui.trustmtime
3728 help.autocorrect
3729 help.browser
3730 help.format
3731 http.lowSpeedLimit
3732 http.lowSpeedTime
3733 http.maxRequests
3734 http.noEPSV
3735 http.proxy
3736 http.sslCAInfo
3737 http.sslCAPath
3738 http.sslCert
3739 http.sslKey
3740 http.sslVerify
3741 i18n.commitEncoding
3742 i18n.logOutputEncoding
3743 imap.folder
3744 imap.host
3745 imap.pass
3746 imap.port
3747 imap.preformattedHTML
3748 imap.sslverify
3749 imap.tunnel
3750 imap.user
3751 instaweb.browser
3752 instaweb.httpd
3753 instaweb.local
3754 instaweb.modulepath
3755 instaweb.port
3756 interactive.singlekey
3757 log.date
3758 log.showroot
3759 mailmap.file
3760 man.
3761 man.viewer
3762 merge.conflictstyle
3763 merge.log
3764 merge.renameLimit
3765 merge.stat
3766 merge.tool
3767 merge.verbosity
3768 mergetool.
3769 mergetool.keepBackup
3770 mergetool.prompt
3771 pack.compression
3772 pack.deltaCacheLimit
3773 pack.deltaCacheSize
3774 pack.depth
3775 pack.indexVersion
3776 pack.packSizeLimit
3777 pack.threads
3778 pack.window
3779 pack.windowMemory
3780 pager.
3781 pull.octopus
3782 pull.twohead
3783 push.default
3784 rebase.stat
3785 receive.denyCurrentBranch
3786 receive.denyDeletes
3787 receive.denyNonFastForwards
3788 receive.fsckObjects
3789 receive.unpackLimit
3790 repack.usedeltabaseoffset
3791 rerere.autoupdate
3792 rerere.enabled
3793 sendemail.aliasesfile
3794 sendemail.aliasesfiletype
3795 sendemail.bcc
3796 sendemail.cc
3797 sendemail.cccmd
3798 sendemail.chainreplyto
3799 sendemail.confirm
3800 sendemail.envelopesender
3801 sendemail.multiedit
3802 sendemail.signedoffbycc
3803 sendemail.smtpencryption
3804 sendemail.smtppass
3805 sendemail.smtpserver
3806 sendemail.smtpserverport
3807 sendemail.smtpuser
3808 sendemail.suppresscc
3809 sendemail.suppressfrom
3810 sendemail.thread
3811 sendemail.to
3812 sendemail.validate
3813 showbranch.default
3814 status.relativePaths
3815 status.showUntrackedFiles
3816 tar.umask
3817 transfer.unpackLimit
3818 url.
3819 user.email
3820 user.name
3821 user.signingkey
3822 web.browser
3823 branch. remote.
3824 "
3825}
3826_git_describe ()
3827{
3828 local cur="${COMP_WORDS[COMP_CWORD]}";
3829 case "$cur" in
3830 --*)
3831 __gitcomp "
3832 --all --tags --contains --abbrev= --candidates=
3833 --exact-match --debug --long --match --always
3834 ";
3835 return
3836 ;;
3837 esac;
3838 __gitcomp "$(__git_refs)"
3839}
3840_git_diff ()
3841{
3842 __git_has_doubledash && return;
3843 local cur="${COMP_WORDS[COMP_CWORD]}";
3844 case "$cur" in
3845 --*)
3846 __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
3847 --base --ours --theirs
3848 $__git_diff_common_options
3849 ";
3850 return
3851 ;;
3852 esac;
3853 __git_complete_file
3854}
3855_git_difftool ()
3856{
3857 local cur="${COMP_WORDS[COMP_CWORD]}";
3858 case "$cur" in
3859 --tool=*)
3860 __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}";
3861 return
3862 ;;
3863 --*)
3864 __gitcomp "--tool=";
3865 return
3866 ;;
3867 esac;
3868 COMPREPLY=()
3869}
3870_git_fetch ()
3871{
3872 local cur="${COMP_WORDS[COMP_CWORD]}";
3873 case "$cur" in
3874 --*)
3875 __gitcomp "$__git_fetch_options";
3876 return
3877 ;;
3878 esac;
3879 __git_complete_remote_or_refspec
3880}
3881_git_format_patch ()
3882{
3883 local cur="${COMP_WORDS[COMP_CWORD]}";
3884 case "$cur" in
3885 --thread=*)
3886 __gitcomp "
3887 deep shallow
3888 " "" "${cur##--thread=}";
3889 return
3890 ;;
3891 --*)
3892 __gitcomp "
3893 --stdout --attach --no-attach --thread --thread=
3894 --output-directory
3895 --numbered --start-number
3896 --numbered-files
3897 --keep-subject
3898 --signoff
3899 --in-reply-to= --cc=
3900 --full-index --binary
3901 --not --all
3902 --cover-letter
3903 --no-prefix --src-prefix= --dst-prefix=
3904 --inline --suffix= --ignore-if-in-upstream
3905 --subject-prefix=
3906 ";
3907 return
3908 ;;
3909 esac;
3910 __git_complete_revlist
3911}
3912_git_fsck ()
3913{
3914 local cur="${COMP_WORDS[COMP_CWORD]}";
3915 case "$cur" in
3916 --*)
3917 __gitcomp "
3918 --tags --root --unreachable --cache --no-reflogs --full
3919 --strict --verbose --lost-found
3920 ";
3921 return
3922 ;;
3923 esac;
3924 COMPREPLY=()
3925}
3926_git_gc ()
3927{
3928 local cur="${COMP_WORDS[COMP_CWORD]}";
3929 case "$cur" in
3930 --*)
3931 __gitcomp "--prune --aggressive";
3932 return
3933 ;;
3934 esac;
3935 COMPREPLY=()
3936}
3937_git_grep ()
3938{
3939 __git_has_doubledash && return;
3940 local cur="${COMP_WORDS[COMP_CWORD]}";
3941 case "$cur" in
3942 --*)
3943 __gitcomp "
3944 --cached
3945 --text --ignore-case --word-regexp --invert-match
3946 --full-name
3947 --extended-regexp --basic-regexp --fixed-strings
3948 --files-with-matches --name-only
3949 --files-without-match
3950 --count
3951 --and --or --not --all-match
3952 ";
3953 return
3954 ;;
3955 esac;
3956 COMPREPLY=()
3957}
3958_git_help ()
3959{
3960 local cur="${COMP_WORDS[COMP_CWORD]}";
3961 case "$cur" in
3962 --*)
3963 __gitcomp "--all --info --man --web";
3964 return
3965 ;;
3966 esac;
3967 __gitcomp "$(__git_all_commands)
3968 attributes cli core-tutorial cvs-migration
3969 diffcore gitk glossary hooks ignore modules
3970 repository-layout tutorial tutorial-2
3971 workflows
3972 "
3973}
3974_git_init ()
3975{
3976 local cur="${COMP_WORDS[COMP_CWORD]}";
3977 case "$cur" in
3978 --shared=*)
3979 __gitcomp "
3980 false true umask group all world everybody
3981 " "" "${cur##--shared=}";
3982 return
3983 ;;
3984 --*)
3985 __gitcomp "--quiet --bare --template= --shared --shared=";
3986 return
3987 ;;
3988 esac;
3989 COMPREPLY=()
3990}
3991_git_log ()
3992{
3993 __git_has_doubledash && return;
3994 local cur="${COMP_WORDS[COMP_CWORD]}";
3995 local g="$(git rev-parse --git-dir 2>/dev/null)";
3996 local merge="";
3997 if [ -f "$g/MERGE_HEAD" ]; then
3998 merge="--merge";
3999 fi;
4000 case "$cur" in
4001 --pretty=*)
4002 __gitcomp "$__git_log_pretty_formats
4003 " "" "${cur##--pretty=}";
4004 return
4005 ;;
4006 --format=*)
4007 __gitcomp "$__git_log_pretty_formats
4008 " "" "${cur##--format=}";
4009 return
4010 ;;
4011 --date=*)
4012 __gitcomp "$__git_log_date_formats" "" "${cur##--date=}";
4013 return
4014 ;;
4015 --*)
4016 __gitcomp "
4017 $__git_log_common_options
4018 $__git_log_shortlog_options
4019 $__git_log_gitk_options
4020 --root --topo-order --date-order --reverse
4021 --follow
4022 --abbrev-commit --abbrev=
4023 --relative-date --date=
4024 --pretty= --format= --oneline
4025 --cherry-pick
4026 --graph
4027 --decorate
4028 --walk-reflogs
4029 --parents --children
4030 $merge
4031 $__git_diff_common_options
4032 --pickaxe-all --pickaxe-regex
4033 ";
4034 return
4035 ;;
4036 esac;
4037 __git_complete_revlist
4038}
4039_git_ls_files ()
4040{
4041 __git_has_doubledash && return;
4042 local cur="${COMP_WORDS[COMP_CWORD]}";
4043 case "$cur" in
4044 --*)
4045 __gitcomp "--cached --deleted --modified --others --ignored
4046 --stage --directory --no-empty-directory --unmerged
4047 --killed --exclude= --exclude-from=
4048 --exclude-per-directory= --exclude-standard
4049 --error-unmatch --with-tree= --full-name
4050 --abbrev --ignored --exclude-per-directory
4051 ";
4052 return
4053 ;;
4054 esac;
4055 COMPREPLY=()
4056}
4057_git_ls_remote ()
4058{
4059 __gitcomp "$(__git_remotes)"
4060}
4061_git_ls_tree ()
4062{
4063 __git_complete_file
4064}
4065_git_merge ()
4066{
4067 __git_complete_strategy && return;
4068 local cur="${COMP_WORDS[COMP_CWORD]}";
4069 case "$cur" in
4070 --*)
4071 __gitcomp "$__git_merge_options";
4072 return
4073 ;;
4074 esac;
4075 __gitcomp "$(__git_refs)"
4076}
4077_git_merge_base ()
4078{
4079 __gitcomp "$(__git_refs)"
4080}
4081_git_mergetool ()
4082{
4083 local cur="${COMP_WORDS[COMP_CWORD]}";
4084 case "$cur" in
4085 --tool=*)
4086 __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}";
4087 return
4088 ;;
4089 --*)
4090 __gitcomp "--tool=";
4091 return
4092 ;;
4093 esac;
4094 COMPREPLY=()
4095}
4096_git_mv ()
4097{
4098 local cur="${COMP_WORDS[COMP_CWORD]}";
4099 case "$cur" in
4100 --*)
4101 __gitcomp "--dry-run";
4102 return
4103 ;;
4104 esac;
4105 COMPREPLY=()
4106}
4107_git_name_rev ()
4108{
4109 __gitcomp "--tags --all --stdin"
4110}
4111_git_pull ()
4112{
4113 __git_complete_strategy && return;
4114 local cur="${COMP_WORDS[COMP_CWORD]}";
4115 case "$cur" in
4116 --*)
4117 __gitcomp "
4118 --rebase --no-rebase
4119 $__git_merge_options
4120 $__git_fetch_options
4121 ";
4122 return
4123 ;;
4124 esac;
4125 __git_complete_remote_or_refspec
4126}
4127_git_push ()
4128{
4129 local cur="${COMP_WORDS[COMP_CWORD]}";
4130 case "${COMP_WORDS[COMP_CWORD-1]}" in
4131 --repo)
4132 __gitcomp "$(__git_remotes)";
4133 return
4134 ;;
4135 esac;
4136 case "$cur" in
4137 --repo=*)
4138 __gitcomp "$(__git_remotes)" "" "${cur##--repo=}";
4139 return
4140 ;;
4141 --*)
4142 __gitcomp "
4143 --all --mirror --tags --dry-run --force --verbose
4144 --receive-pack= --repo=
4145 ";
4146 return
4147 ;;
4148 esac;
4149 __git_complete_remote_or_refspec
4150}
4151_git_rebase ()
4152{
4153 local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)";
4154 if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
4155 __gitcomp "--continue --skip --abort";
4156 return;
4157 fi;
4158 __git_complete_strategy && return;
4159 case "$cur" in
4160 --*)
4161 __gitcomp "--onto --merge --strategy --interactive";
4162 return
4163 ;;
4164 esac;
4165 __gitcomp "$(__git_refs)"
4166}
4167_git_remote ()
4168{
4169 local subcommands="add rename rm show prune update set-head";
4170 local subcommand="$(__git_find_subcommand "$subcommands")";
4171 if [ -z "$subcommand" ]; then
4172 __gitcomp "$subcommands";
4173 return;
4174 fi;
4175 case "$subcommand" in
4176 rename | rm | show | prune)
4177 __gitcomp "$(__git_remotes)"
4178 ;;
4179 update)
4180 local i c='' IFS='
4181';
4182 for i in $(git --git-dir="$(__gitdir)" config --list);
4183 do
4184 case "$i" in
4185 remotes.*)
4186 i="${i#remotes.}";
4187 c="$c ${i/=*/}"
4188 ;;
4189 esac;
4190 done;
4191 __gitcomp "$c"
4192 ;;
4193 *)
4194 COMPREPLY=()
4195 ;;
4196 esac
4197}
4198_git_reset ()
4199{
4200 __git_has_doubledash && return;
4201 local cur="${COMP_WORDS[COMP_CWORD]}";
4202 case "$cur" in
4203 --*)
4204 __gitcomp "--merge --mixed --hard --soft";
4205 return
4206 ;;
4207 esac;
4208 __gitcomp "$(__git_refs)"
4209}
4210_git_revert ()
4211{
4212 local cur="${COMP_WORDS[COMP_CWORD]}";
4213 case "$cur" in
4214 --*)
4215 __gitcomp "--edit --mainline --no-edit --no-commit --signoff";
4216 return
4217 ;;
4218 esac;
4219 __gitcomp "$(__git_refs)"
4220}
4221_git_rm ()
4222{
4223 __git_has_doubledash && return;
4224 local cur="${COMP_WORDS[COMP_CWORD]}";
4225 case "$cur" in
4226 --*)
4227 __gitcomp "--cached --dry-run --ignore-unmatch --quiet";
4228 return
4229 ;;
4230 esac;
4231 COMPREPLY=()
4232}
4233_git_send_email ()
4234{
4235 local cur="${COMP_WORDS[COMP_CWORD]}";
4236 case "$cur" in
4237 --confirm=*)
4238 __gitcomp "
4239 $__git_send_email_confirm_options
4240 " "" "${cur##--confirm=}";
4241 return
4242 ;;
4243 --suppress-cc=*)
4244 __gitcomp "
4245 $__git_send_email_suppresscc_options
4246 " "" "${cur##--suppress-cc=}";
4247 return
4248 ;;
4249 --smtp-encryption=*)
4250 __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}";
4251 return
4252 ;;
4253 --*)
4254 __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
4255 --compose --confirm= --dry-run --envelope-sender
4256 --from --identity
4257 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
4258 --no-suppress-from --no-thread --quiet
4259 --signed-off-by-cc --smtp-pass --smtp-server
4260 --smtp-server-port --smtp-encryption= --smtp-user
4261 --subject --suppress-cc= --suppress-from --thread --to
4262 --validate --no-validate";
4263 return
4264 ;;
4265 esac;
4266 COMPREPLY=()
4267}
4268_git_shortlog ()
4269{
4270 __git_has_doubledash && return;
4271 local cur="${COMP_WORDS[COMP_CWORD]}";
4272 case "$cur" in
4273 --*)
4274 __gitcomp "
4275 $__git_log_common_options
4276 $__git_log_shortlog_options
4277 --numbered --summary
4278 ";
4279 return
4280 ;;
4281 esac;
4282 __git_complete_revlist
4283}
4284_git_show ()
4285{
4286 __git_has_doubledash && return;
4287 local cur="${COMP_WORDS[COMP_CWORD]}";
4288 case "$cur" in
4289 --pretty=*)
4290 __gitcomp "$__git_log_pretty_formats
4291 " "" "${cur##--pretty=}";
4292 return
4293 ;;
4294 --format=*)
4295 __gitcomp "$__git_log_pretty_formats
4296 " "" "${cur##--format=}";
4297 return
4298 ;;
4299 --*)
4300 __gitcomp "--pretty= --format= --abbrev-commit --oneline
4301 $__git_diff_common_options
4302 ";
4303 return
4304 ;;
4305 esac;
4306 __git_complete_file
4307}
4308_git_show_branch ()
4309{
4310 local cur="${COMP_WORDS[COMP_CWORD]}";
4311 case "$cur" in
4312 --*)
4313 __gitcomp "
4314 --all --remotes --topo-order --current --more=
4315 --list --independent --merge-base --no-name
4316 --sha1-name --sparse --topics --reflog
4317 ";
4318 return
4319 ;;
4320 esac;
4321 __git_complete_revlist
4322}
4323_git_stash ()
4324{
4325 local subcommands='save list show apply clear drop pop create branch';
4326 local subcommand="$(__git_find_subcommand "$subcommands")";
4327 if [ -z "$subcommand" ]; then
4328 __gitcomp "$subcommands";
4329 else
4330 local cur="${COMP_WORDS[COMP_CWORD]}";
4331 case "$subcommand,$cur" in
4332 save,--*)
4333 __gitcomp "--keep-index"
4334 ;;
4335 apply,--*)
4336 __gitcomp "--index"
4337 ;;
4338 show,--* | drop,--* | pop,--* | branch,--*)
4339 COMPREPLY=()
4340 ;;
4341 show,* | apply,* | drop,* | pop,* | branch,*)
4342 __gitcomp "$(git --git-dir="$(__gitdir)" stash list | sed -n -e 's/:.*//p')"
4343 ;;
4344 *)
4345 COMPREPLY=()
4346 ;;
4347 esac;
4348 fi
4349}
4350_git_submodule ()
4351{
4352 __git_has_doubledash && return;
4353 local subcommands="add status init update summary foreach sync";
4354 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
4355 local cur="${COMP_WORDS[COMP_CWORD]}";
4356 case "$cur" in
4357 --*)
4358 __gitcomp "--quiet --cached"
4359 ;;
4360 *)
4361 __gitcomp "$subcommands"
4362 ;;
4363 esac;
4364 return;
4365 fi
4366}
4367_git_svn ()
4368{
4369 local subcommands="
4370 init fetch clone rebase dcommit log find-rev
4371 set-tree commit-diff info create-ignore propget
4372 proplist show-ignore show-externals branch tag blame
4373 migrate
4374 ";
4375 local subcommand="$(__git_find_subcommand "$subcommands")";
4376 if [ -z "$subcommand" ]; then
4377 __gitcomp "$subcommands";
4378 else
4379 local remote_opts="--username= --config-dir= --no-auth-cache";
4380 local fc_opts="
4381 --follow-parent --authors-file= --repack=
4382 --no-metadata --use-svm-props --use-svnsync-props
4383 --log-window-size= --no-checkout --quiet
4384 --repack-flags --use-log-author --localtime
4385 --ignore-paths= $remote_opts
4386 ";
4387 local init_opts="
4388 --template= --shared= --trunk= --tags=
4389 --branches= --stdlayout --minimize-url
4390 --no-metadata --use-svm-props --use-svnsync-props
4391 --rewrite-root= --prefix= --use-log-author
4392 --add-author-from $remote_opts
4393 ";
4394 local cmt_opts="
4395 --edit --rmdir --find-copies-harder --copy-similarity=
4396 ";
4397 local cur="${COMP_WORDS[COMP_CWORD]}";
4398 case "$subcommand,$cur" in
4399 fetch,--*)
4400 __gitcomp "--revision= --fetch-all $fc_opts"
4401 ;;
4402 clone,--*)
4403 __gitcomp "--revision= $fc_opts $init_opts"
4404 ;;
4405 init,--*)
4406 __gitcomp "$init_opts"
4407 ;;
4408 dcommit,--*)
4409 __gitcomp "
4410 --merge --strategy= --verbose --dry-run
4411 --fetch-all --no-rebase --commit-url
4412 --revision $cmt_opts $fc_opts
4413 "
4414 ;;
4415 set-tree,--*)
4416 __gitcomp "--stdin $cmt_opts $fc_opts"
4417 ;;
4418 create-ignore,--* | propget,--* | proplist,--* | show-ignore,--* | show-externals,--*)
4419 __gitcomp "--revision="
4420 ;;
4421 log,--*)
4422 __gitcomp "
4423 --limit= --revision= --verbose --incremental
4424 --oneline --show-commit --non-recursive
4425 --authors-file= --color
4426 "
4427 ;;
4428 rebase,--*)
4429 __gitcomp "
4430 --merge --verbose --strategy= --local
4431 --fetch-all --dry-run $fc_opts
4432 "
4433 ;;
4434 commit-diff,--*)
4435 __gitcomp "--message= --file= --revision= $cmt_opts"
4436 ;;
4437 info,--*)
4438 __gitcomp "--url"
4439 ;;
4440 branch,--*)
4441 __gitcomp "--dry-run --message --tag"
4442 ;;
4443 tag,--*)
4444 __gitcomp "--dry-run --message"
4445 ;;
4446 blame,--*)
4447 __gitcomp "--git-format"
4448 ;;
4449 migrate,--*)
4450 __gitcomp "
4451 --config-dir= --ignore-paths= --minimize
4452 --no-auth-cache --username=
4453 "
4454 ;;
4455 *)
4456 COMPREPLY=()
4457 ;;
4458 esac;
4459 fi
4460}
4461_git_tag ()
4462{
4463 local i c=1 f=0;
4464 while [ $c -lt $COMP_CWORD ]; do
4465 i="${COMP_WORDS[c]}";
4466 case "$i" in
4467 -d | -v)
4468 __gitcomp "$(__git_tags)";
4469 return
4470 ;;
4471 -f)
4472 f=1
4473 ;;
4474 esac;
4475 c=$((++c));
4476 done;
4477 case "${COMP_WORDS[COMP_CWORD-1]}" in
4478 -m | -F)
4479 COMPREPLY=()
4480 ;;
4481 -* | tag)
4482 if [ $f = 1 ]; then
4483 __gitcomp "$(__git_tags)";
4484 else
4485 COMPREPLY=();
4486 fi
4487 ;;
4488 *)
4489 __gitcomp "$(__git_refs)"
4490 ;;
4491 esac
4492}
4493_gitk ()
4494{
4495 __git_has_doubledash && return;
4496 local cur="${COMP_WORDS[COMP_CWORD]}";
4497 local g="$(__gitdir)";
4498 local merge="";
4499 if [ -f "$g/MERGE_HEAD" ]; then
4500 merge="--merge";
4501 fi;
4502 case "$cur" in
4503 --*)
4504 __gitcomp "
4505 $__git_log_common_options
4506 $__git_log_gitk_options
4507 $merge
4508 ";
4509 return
4510 ;;
4511 esac;
4512 __git_complete_revlist
4513}
4514_gkrellm ()
4515{
4516 local cur;
4517 COMPREPLY=();
4518 cur=`_get_cword`;
4519 prev=${COMP_WORDS[COMP_CWORD-1]};
4520 case "$prev" in
4521 -@(t|-theme))
4522 _filedir -d;
4523 return 0
4524 ;;
4525 -@(p|-plugin))
4526 _filedir 'so';
4527 return 0
4528 ;;
4529 -@(s|-server))
4530 _known_hosts;
4531 return 0
4532 ;;
4533 esac;
4534 if [[ "$cur" == -* ]]; then
4535 COMPREPLY=($( compgen -W '--help -t --theme -s --server \
4536 -g --geometry -wm -w --withdrawn -c --config -nc \
4537 -f --force-host-config -demo -p --plugin -P \
4538 --port' -- $cur ));
4539 fi
4540}
4541_gnatmake ()
4542{
4543 local cur;
4544 COMPREPLY=();
4545 cur=`_get_cword`;
4546 if [[ "$cur" == -* ]]; then
4547 COMPREPLY=($( compgen -W '-a -c -f -i -j -k -m -M -n -o \
4548 -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \
4549 -nostdlib -cargs -bargs -largs -fstack-check \
4550 -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \
4551 -gnatb -gnatc -gnatd -gnatD -gnate -gnatE \
4552 -gnatf -gnatF -gnatg -gnatG -gnath -gnati \
4553 -gnatk -gnatl -gnatL -gnatm -gnatn -gnato \
4554 -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
4555 -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
4556 -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
4557 -gnaty -gnatz -gnatZ -gnat83' -- $cur ));
4558 else
4559 _filedir '@(adb|ads)';
4560 fi
4561}
4562_gpg ()
4563{
4564 local cur prev;
4565 COMPREPLY=();
4566 cur=`_get_cword`;
4567 prev=${COMP_WORDS[COMP_CWORD-1]};
4568 case "$prev" in
4569 -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
4570 _filedir;
4571 return 0
4572 ;;
4573 --@(export|@(?(l|nr|nrl)sign|edit)-key))
4574 COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ));
4575 return 0
4576 ;;
4577 -@(r|-recipient))
4578 COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ));
4579 if [ -e ~/.gnupg/gpg.conf ]; then
4580 COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur"));
4581 fi;
4582 return 0
4583 ;;
4584 esac;
4585 if [[ "$cur" == -* ]]; then
4586 COMPREPLY=($( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
4587 -q -n -N $(gpg --dump-options)' -- $cur ));
4588 fi
4589}
4590_gzip ()
4591{
4592 local cur prev xspec helpopts;
4593 COMPREPLY=();
4594 cur=`_get_cword`;
4595 prev=${COMP_WORDS[COMP_CWORD-1]};
4596 helpopts=`_parse_help gzip`;
4597 if [[ "$cur" == -* ]]; then
4598 COMPREPLY=($( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" -- "$cur" ));
4599 return 0;
4600 fi;
4601 local IFS='
4602';
4603 xspec="*.?(t)gz";
4604 if [[ "$prev" == --* ]]; then
4605 [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec;
4606 [[ "$prev" == --force ]] && xspec=;
4607 else
4608 if [[ "$prev" == -* ]]; then
4609 [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec;
4610 [[ "$prev" == -*f* ]] && xspec=;
4611 else
4612 if [ "$prev" = '>' -o "$prev" = '>>' ]; then
4613 xspec=;
4614 else
4615 if [ "$prev" = '<' ]; then
4616 xspec=;
4617 fi;
4618 fi;
4619 fi;
4620 fi;
4621 _expand || return 0;
4622 COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
4623}
4624_iconv ()
4625{
4626 local cur prev;
4627 COMPREPLY=();
4628 cur=`_get_cword`;
4629 prev=${COMP_WORDS[COMP_CWORD-1]};
4630 case "$prev" in
4631 -@(f|t|-@(from|to)-code))
4632 COMPREPLY=($( compgen -W '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ));
4633 return 0
4634 ;;
4635 esac;
4636 if [[ "$cur" = -* ]]; then
4637 COMPREPLY=($( compgen -W '--from-code -f --to-code -t --list
4638 --output -o --verbose' -- "$cur" ));
4639 return 0;
4640 fi
4641}
4642_id ()
4643{
4644 local cur;
4645 COMPREPLY=();
4646 cur=`_get_cword`;
4647 if [[ "$cur" == -* ]]; then
4648 COMPREPLY=($( compgen -W '-a -g --group -G --groups -n --name\
4649 -r --real -u --user --help --version' -- $cur ));
4650 else
4651 COMPREPLY=($( compgen -u $cur ));
4652 fi
4653}
4654_ifupdown ()
4655{
4656 local cur;
4657 COMPREPLY=();
4658 cur=`_get_cword`;
4659 if [ $COMP_CWORD -eq 1 ]; then
4660 _configured_interfaces;
4661 COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur"));
4662 fi;
4663 return 0
4664}
4665_info ()
4666{
4667 local cur infopath;
4668 COMPREPLY=();
4669 cur=`_get_cword`;
4670 _expand || return 0;
4671 if [[ "$cur" == */* ]]; then
4672 _filedir;
4673 return 0;
4674 fi;
4675 infopath='/usr/share/info';
4676 if [ "${INFOPATH: -1:1}" == ':' ]; then
4677 infopath=${INFOPATH}${infopath};
4678 else
4679 if [ ${INFOPATH:+set} ]; then
4680 infopath=$INFOPATH;
4681 fi;
4682 fi;
4683 infopath=$infopath:;
4684 if [ -n "$cur" ]; then
4685 infopath="${infopath//://$cur* }";
4686 else
4687 infopath="${infopath//:// }";
4688 fi;
4689 COMPREPLY=($( eval command ls "$infopath" 2>/dev/null ));
4690 COMPREPLY=(${COMPREPLY[@]##*/?(:)});
4691 for ((i=0 ; i < ${#COMPREPLY[@]} ; ++i ))
4692 do
4693 if [ "${COMPREPLY[$i]}" == 'dir' ]; then
4694 unset COMPREPLY[$i];
4695 fi;
4696 done;
4697 COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|lzma)});
4698 COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ));
4699 return 0
4700}
4701_inject ()
4702{
4703 local cur prev;
4704 COMPREPLY=();
4705 cur=`_get_cword`;
4706 prev=${COMP_WORDS[COMP_CWORD-1]};
4707 case "$prev" in
4708 -@(l|-listname=))
4709 _mailman_lists;
4710 return 0
4711 ;;
4712 esac;
4713 if [[ "$cur" == -* ]]; then
4714 COMPREPLY=($( compgen -W '-l --listname= -q --queue= \
4715 -h --help' -- $cur ));
4716 else
4717 _filedir;
4718 fi
4719}
4720_insmod ()
4721{
4722 local cur prev modpath;
4723 COMPREPLY=();
4724 cur=`_get_cword`;
4725 prev=${COMP_WORDS[COMP_CWORD-1]};
4726 if [ $1 = "modprobe" ] && [ "${COMP_WORDS[1]}" = "-r" ]; then
4727 _installed_modules "$cur";
4728 return 0;
4729 fi;
4730 if [[ "$cur" == */* ]]; then
4731 _filedir '@(?(k)o?(.gz))';
4732 return 0;
4733 fi;
4734 if [ $COMP_CWORD -gt 1 ] && [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
4735 COMPREPLY=($( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \
4736 else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ));
4737 else
4738 _modules $(uname -r);
4739 fi;
4740 return 0
4741}
4742_insserv ()
4743{
4744 local cur prev sysvdir services options;
4745 cur=`_get_cword`;
4746 prev=${COMP_WORDS[COMP_CWORD-1]};
4747 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
4748 services=($(echo $sysvdir/!(README*|*.dpkg*|*.rpm@(orig|new|save))));
4749 services=(${services[@]#$sysvdir/});
4750 options=(-c --config -d -f -n -o --override -p --path -r -v);
4751 case "$prev" in
4752 -c | --config)
4753 _filedir
4754 ;;
4755 -o | --override | -p | --path)
4756 _filedir -d
4757 ;;
4758 *)
4759 COMPREPLY=($( compgen -W '${options[@]} ${services[@]}' -- $cur ))
4760 ;;
4761 esac;
4762 return 0
4763}
4764_installed_modules ()
4765{
4766 COMPREPLY=($( compgen -W "$( /sbin/lsmod | awk '{if (NR != 1) print $1}' )" -- $1 ))
4767}
4768_invoke_rc_d ()
4769{
4770 local cur prev sysvdir services options valid_options;
4771 cur=`_get_cword`;
4772 prev=${COMP_WORDS[COMP_CWORD-1]};
4773 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
4774 services=($(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))));
4775 services=(${services[@]#$sysvdir/});
4776 options=(--help --quiet --force --try-anyway --disclose-deny --query --no-fallback);
4777 if [[ ( $COMP_CWORD -eq 1 ) || ( "$prev" == --* ) ]]; then
4778 valid_options=($( echo ${COMP_WORDS[@]} ${options[@]} | tr " " "\n" | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" | sort | uniq -u ));
4779 COMPREPLY=($( compgen -W '${valid_options[@]} ${services[@]}' -- $cur ));
4780 else
4781 if [ -x $sysvdir/$prev ]; then
4782 COMPREPLY=($( compgen -W '`sed -ne "y/|/ /; \
4783 s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
4784 $sysvdir/$prev`' -- $cur ));
4785 else
4786 COMPREPLY=();
4787 fi;
4788 fi;
4789 return 0
4790}
4791_iptables ()
4792{
4793 local cur prev table chain;
4794 COMPREPLY=();
4795 cur=`_get_cword`;
4796 prev=${COMP_WORDS[COMP_CWORD-1]};
4797 chain='s/^Chain \([^ ]\+\).*$/\1/p';
4798 if [[ $COMP_LINE == *-t\ *filter* ]]; then
4799 table="-t filter";
4800 else
4801 if [[ $COMP_LINE == *-t\ *nat* ]]; then
4802 table="-t nat";
4803 else
4804 if [[ $COMP_LINE == *-t\ *mangle* ]]; then
4805 table="-t mangle";
4806 fi;
4807 fi;
4808 fi;
4809 case "$prev" in
4810 -*[AIDRPFXLZ])
4811 COMPREPLY=($( compgen -W '`iptables $table -nL | \
4812 sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ))
4813 ;;
4814 -*t)
4815 COMPREPLY=($( compgen -W 'nat filter mangle' -- $cur ))
4816 ;;
4817 -j)
4818 if [ "$table" = "-t filter" -o "$table" = "" ]; then
4819 COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
4820 `iptables $table -nL | sed -ne "$chain" \
4821 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- $cur ));
4822 else
4823 if [ "$table" = "-t nat" ]; then
4824 COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
4825 MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
4826 sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' -- $cur ));
4827 else
4828 if [ "$table" = "-t mangle" ]; then
4829 COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
4830 MARK TOS `iptables $table -nL | sed -ne "$chain" \
4831 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- $cur ));
4832 fi;
4833 fi;
4834 fi
4835 ;;
4836 *)
4837 if [[ "$cur" == -* ]]; then
4838 COMPREPLY=($( compgen -W '-i -o -s -d -p -f -m --append \
4839 --delete --insert --replace --list --flush --zero --new \
4840 --delete-chain --policy --rename-chain --proto --source \
4841 --destination --in-interface --jump --match --numeric \
4842 --out-interface --table --verbose --line-numbers --exact \
4843 --fragment --modprobe= --set-counters --version' -- "$cur"));
4844 fi
4845 ;;
4846 esac
4847}
4848_isql ()
4849{
4850 local cur;
4851 cur=`_get_cword`;
4852 [ -f "$ODBCINI" ] && COMPREPLY=($( grep \\[$cur "$ODBCINI" | tr -d \\[\\] ))
4853}
4854_iwconfig ()
4855{
4856 local cur prev;
4857 COMPREPLY=();
4858 cur=`_get_cword`;
4859 prev=${COMP_WORDS[COMP_CWORD-1]};
4860 case $prev in
4861 mode)
4862 COMPREPLY=($( compgen -W 'managed ad-hoc master \
4863 repeater secondary monitor' -- $cur ));
4864 return 0
4865 ;;
4866 essid)
4867 COMPREPLY=($( compgen -W 'on off any' -- $cur ));
4868 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
4869 COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} scan | awk -F '"' '/ESSID/ {print $2}' | grep "^$cur" ));
4870 fi;
4871 return 0
4872 ;;
4873 nwid)
4874 COMPREPLY=($( compgen -W 'on off' -- $cur ));
4875 return 0
4876 ;;
4877 channel)
4878 COMPREPLY=($( iwlist ${COMP_WORDS[1]} channel | awk '/^[[:space:]]*Channel/ {print $2}' | grep "^$cur" ));
4879 return 0
4880 ;;
4881 freq)
4882 COMPREPLY=($( iwlist ${COMP_WORDS[1]} channel | awk '/^[[:space:]]*Channel/ {print $4"G"}' | grep "^$cur" ));
4883 return 0
4884 ;;
4885 ap)
4886 COMPREPLY=($( compgen -W 'on off any' -- $cur ));
4887 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
4888 COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} scan | awk -F ': ' '/Address/ {print $2}' | grep "^$cur" ));
4889 fi;
4890 return 0
4891 ;;
4892 rate)
4893 COMPREPLY=($( compgen -W 'auto fixed' -- $cur ));
4894 COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} rate | awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | grep "^$cur" ));
4895 return 0
4896 ;;
4897 rts)
4898 COMPREPLY=($( compgen -W 'auto fixed off' -- $cur ));
4899 return 0
4900 ;;
4901 frag)
4902 COMPREPLY=($( compgen -W 'auto fixed off' -- $cur ));
4903 return 0
4904 ;;
4905 key)
4906 COMPREPLY=($( compgen -W 'off on open restricted' -- $cur ));
4907 return 0
4908 ;;
4909 enc)
4910 COMPREPLY=($( compgen -W 'off on open restricted' -- $cur ));
4911 return 0
4912 ;;
4913 power)
4914 COMPREPLY=($( compgen -W 'period timeout off on' -- $cur ));
4915 return 0
4916 ;;
4917 txpower)
4918 COMPREPLY=($( compgen -W 'off on auto' -- $cur ));
4919 return 0
4920 ;;
4921 retry)
4922 COMPREPLY=($( compgen -W 'limit lifetime' -- $cur ));
4923 return 0
4924 ;;
4925 esac;
4926 if [ $COMP_CWORD -eq 1 ]; then
4927 if [[ "$cur" == -* ]]; then
4928 COMPREPLY=($( compgen -W '--help --version' -- $cur ));
4929 else
4930 _available_interfaces -w;
4931 fi;
4932 else
4933 COMPREPLY=($( compgen -W 'essid nwid mode freq channel sens mode \
4934 ap nick rate rts frag enc key power txpower commit' -- $cur ));
4935 fi
4936}
4937_iwlist ()
4938{
4939 local cur prev;
4940 COMPREPLY=();
4941 cur=`_get_cword`;
4942 prev=${COMP_WORDS[COMP_CWORD-1]};
4943 if [ $COMP_CWORD -eq 1 ]; then
4944 if [[ "$cur" == -* ]]; then
4945 COMPREPLY=($( compgen -W '--help --version' -- $cur ));
4946 else
4947 _available_interfaces -w;
4948 fi;
4949 else
4950 COMPREPLY=($( compgen -W 'scan scanning freq frequency \
4951 channel rate bit bitrate key enc encryption power \
4952 txpower retry ap accesspoint peers event' -- $cur ));
4953 fi
4954}
4955_iwpriv ()
4956{
4957 local cur prev;
4958 COMPREPLY=();
4959 cur=`_get_cword`;
4960 prev=${COMP_WORDS[COMP_CWORD-1]};
4961 case "$prev" in
4962 roam)
4963 COMPREPLY=($( compgen -W 'on off' -- $cur ));
4964 return 0
4965 ;;
4966 port)
4967 COMPREPLY=($( compgen -W 'ad-hoc managed' -- $cur ));
4968 return 0
4969 ;;
4970 esac;
4971 if [ $COMP_CWORD -eq 1 ]; then
4972 if [[ "$cur" == -* ]]; then
4973 COMPREPLY=($( compgen -W '--help --version' -- $cur ));
4974 else
4975 _available_interfaces -w;
4976 fi;
4977 else
4978 COMPREPLY=($( compgen -W '--all roam port' -- $cur ));
4979 fi
4980}
4981_iwspy ()
4982{
4983 local cur;
4984 COMPREPLY=();
4985 cur=`_get_cword`;
4986 if [ $COMP_CWORD -eq 1 ]; then
4987 if [[ "$cur" == -* ]]; then
4988 COMPREPLY=($( compgen -W '--help --version' -- $cur ));
4989 else
4990 _available_interfaces -w;
4991 fi;
4992 else
4993 COMPREPLY=($( compgen -W 'setthr getthr off' -- $cur ));
4994 fi
4995}
4996_jar ()
4997{
4998 local cur;
4999 COMPREPLY=();
5000 cur=`_get_cword`;
5001 if [ $COMP_CWORD = 1 ]; then
5002 COMPREPLY=($( compgen -W 'c t x u' -- $cur ));
5003 return 0;
5004 fi;
5005 case "${COMP_WORDS[1]}" in
5006 *c*f)
5007 _filedir
5008 ;;
5009 *f)
5010 _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
5011 ;;
5012 *)
5013 _filedir
5014 ;;
5015 esac
5016}
5017_java ()
5018{
5019 local cur prev i;
5020 COMPREPLY=();
5021 cur=`_get_cword`;
5022 prev=${COMP_WORDS[COMP_CWORD-1]};
5023 for ((i=1; i < $COMP_CWORD; i++))
5024 do
5025 case ${COMP_WORDS[$i]} in
5026 -cp | -classpath)
5027 ((i++))
5028 ;;
5029 -*)
5030
5031 ;;
5032 *)
5033 _filedir;
5034 return 0
5035 ;;
5036 esac;
5037 done;
5038 case $prev in
5039 -@(cp|classpath))
5040 _java_path;
5041 return 0
5042 ;;
5043 esac;
5044 if [[ "$cur" == -* ]]; then
5045 COMPREPLY=($( compgen -W '-client -hotspot -server -classic \
5046 -cp -classpath -D -verbose -verbose:class \
5047 -verbose:gc -version:jni -version \
5048 -showversion -? -help -X -jar \
5049 -ea -enableassertions -da -disableassertions \
5050 -esa -enablesystemassertions \
5051 -dsa -disablesystemassertions ' -- $cur ));
5052 else
5053 if [[ "$prev" == -jar ]]; then
5054 _filedir jar;
5055 else
5056 _java_classes;
5057 fi;
5058 fi
5059}
5060_java_classes ()
5061{
5062 local classpath i;
5063 _java_find_classpath;
5064 cur=${cur//.//};
5065 for i in ${classpath//:/ };
5066 do
5067 if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
5068 if type zipinfo &>/dev/null; then
5069 COMPREPLY=("${COMPREPLY[@]}" $( zipinfo -1 "$i" | grep "^$cur" | grep '\.class$' | grep -v "\\$" ));
5070 else
5071 COMPREPLY=("${COMPREPLY[@]}" $( jar tf "$i" "$cur" | grep "\.class$" | grep -v "\\$" ));
5072 fi;
5073 else
5074 if [ -d $i ]; then
5075 i=${i%/};
5076 COMPREPLY=("${COMPREPLY[@]}" $( find "$i" -type f -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | grep -v "\\$" | sed -e "s|^$i/||" ));
5077 fi;
5078 fi;
5079 done;
5080 COMPREPLY=(${COMPREPLY[@]%.class});
5081 COMPREPLY=(${COMPREPLY[@]//\//.})
5082}
5083_java_find_classpath ()
5084{
5085 local i;
5086 for ((i=1; i < COMP_CWORD; i++ ))
5087 do
5088 if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
5089 classpath=${COMP_WORDS[i+1]};
5090 break;
5091 fi;
5092 done;
5093 [ -z "$classpath" ] && classpath=$CLASSPATH;
5094 [ -z "$classpath" ] && classpath=.
5095}
5096_java_find_sourcepath ()
5097{
5098 local i;
5099 for ((i=1; i < COMP_CWORD; i++ ))
5100 do
5101 if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
5102 sourcepath=${COMP_WORDS[i+1]};
5103 break;
5104 fi;
5105 done;
5106 if [ -z "$sourcepath" ]; then
5107 _java_find_classpath;
5108 sourcepath=$classpath;
5109 fi
5110}
5111_java_packages ()
5112{
5113 local sourcepath i;
5114 _java_find_sourcepath;
5115 cur=${cur//.//};
5116 for i in ${sourcepath//:/ };
5117 do
5118 if [ -d $i ]; then
5119 COMPREPLY=("${COMPREPLY[@]}" $( command ls -F -d $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ));
5120 fi;
5121 done;
5122 COMPREPLY=($( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ));
5123 COMPREPLY=(${COMPREPLY[@]%/});
5124 cur=${COMPREPLY[@]//\//.}
5125}
5126_java_path ()
5127{
5128 cur=${cur##*:};
5129 _filedir '@(jar|zip)'
5130}
5131_javac ()
5132{
5133 COMPREPLY=();
5134 local cur prev;
5135 cur=`_get_cword`;
5136 prev=${COMP_WORDS[COMP_CWORD-1]};
5137 case $prev in
5138 -d)
5139 _filedir -d;
5140 return 0
5141 ;;
5142 -@(classpath|bootclasspath|sourcepath|extdirs))
5143 _java_path;
5144 return 0
5145 ;;
5146 esac;
5147 if [[ "$cur" == -* ]]; then
5148 COMPREPLY=($( compgen -W '-g -g:none -g:lines -g:vars\
5149 -g:source -O -nowarn -verbose -deprecation -classpath\
5150 -sourcepath -bootclasspath -extdirs -d -encoding -source\
5151 -target -help' -- $cur ));
5152 else
5153 _filedir java;
5154 fi
5155}
5156_javadoc ()
5157{
5158 COMPREPLY=();
5159 local cur prev;
5160 cur=`_get_cword`;
5161 prev=${COMP_WORDS[COMP_CWORD-1]};
5162 case $prev in
5163 -@(overview|helpfile|stylesheetfile))
5164 _filedir;
5165 return 0
5166 ;;
5167 -d)
5168 _filedir -d;
5169 return 0
5170 ;;
5171 -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
5172 _java_path;
5173 return 0
5174 ;;
5175 esac;
5176 if [[ "$cur" == -* ]]; then
5177 COMPREPLY=($( compgen -W '-overview -public -protected \
5178 -package -private -help -doclet -docletpath \
5179 -sourcepath -classpath -exclude -subpackages \
5180 -breakiterator -bootclasspath -source -extdirs \
5181 -verbose -locale -encoding -J -d -use -version \
5182 -author -docfilessubdirs -splitindex \
5183 -windowtitle -doctitle -header -footer -bottom \
5184 -link -linkoffline -excludedocfilessubdir \
5185 -group -nocomment -nodeprecated -noqualifier \
5186 -nosince -nodeprecatedlist -notree -noindex \
5187 -nohelp -nonavbar -quiet -serialwarn -tag \
5188 -taglet -tagletpath -charset -helpfile \
5189 -linksource -stylesheetfile -docencoding' -- $cur ));
5190 else
5191 _filedir java;
5192 _java_packages;
5193 fi
5194}
5195_kernel_versions ()
5196{
5197 COMPREPLY=($( command ls /lib/modules | grep "^$cur" ))
5198}
5199_kernels ()
5200{
5201 COMPREPLY=($( cd /lib/modules && compgen -d -- "$cur" ))
5202}
5203_kill ()
5204{
5205 local cur;
5206 COMPREPLY=();
5207 cur=`_get_cword`;
5208 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
5209 _signals;
5210 else
5211 _pids;
5212 fi
5213}
5214_killall ()
5215{
5216 local cur;
5217 COMPREPLY=();
5218 cur=`_get_cword`;
5219 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
5220 _signals;
5221 else
5222 _pnames;
5223 fi;
5224 return 0
5225}
5226_known_hosts ()
5227{
5228 local configfile;
5229 local cur curd ocur user suffix aliases global_kh user_kh hosts i host;
5230 local -a kh khd config;
5231 COMPREPLY=();
5232 cur=`_get_cword`;
5233 ocur=$cur;
5234 local OPTIND=1;
5235 while getopts "acF:" flag "$@"; do
5236 case $flag in
5237 a)
5238 aliases='yes'
5239 ;;
5240 c)
5241 suffix=':'
5242 ;;
5243 F)
5244 configfile="$OPTARG"
5245 ;;
5246 esac;
5247 done;
5248 [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@};
5249 kh=();
5250 if [ -n "$configfile" ]; then
5251 [ -r "$configfile" ] && config=("${config[@]}" "$configfile");
5252 else
5253 [ -r /etc/ssh/ssh_config ] && config=("${config[@]}" "/etc/ssh/ssh_config");
5254 [ -r "${HOME}/.ssh/config" ] && config=("${config[@]}" "${HOME}/.ssh/config");
5255 [ -r "${HOME}/.ssh2/config" ] && config=("${config[@]}" "${HOME}/.ssh2/config");
5256 fi;
5257 if [ ${#config[@]} -gt 0 ]; then
5258 global_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" );
5259 user_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" );
5260 fi;
5261 [ -r "$global_kh" ] && kh=("${kh[@]}" "$global_kh");
5262 if [ -z "$configfile" ]; then
5263 [ -r /etc/ssh/ssh_known_hosts ] && kh=("${kh[@]}" /etc/ssh/ssh_known_hosts);
5264 [ -r /etc/ssh/ssh_known_hosts2 ] && kh=("${kh[@]}" /etc/ssh/ssh_known_hosts2);
5265 [ -r /etc/known_hosts ] && kh=("${kh[@]}" /etc/known_hosts);
5266 [ -r /etc/known_hosts2 ] && kh=("${kh[@]}" /etc/known_hosts2);
5267 [ -d /etc/ssh2/knownhosts ] && khd=("${khd[@]}" /etc/ssh2/knownhosts/*pub);
5268 fi;
5269 [ -r "$user_kh" ] && kh=("${kh[@]}" "$user_kh");
5270 if [ -z "$configfile" ]; then
5271 [ -r ~/.ssh/known_hosts ] && kh=("${kh[@]}" ~/.ssh/known_hosts);
5272 [ -r ~/.ssh/known_hosts2 ] && kh=("${kh[@]}" ~/.ssh/known_hosts2);
5273 [ -d ~/.ssh2/hostkeys ] && khd=("${khd[@]}" ~/.ssh2/hostkeys/*pub);
5274 fi;
5275 if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
5276 cur=${cur//\//\\\/};
5277 cur=${cur//\./\\\.};
5278 curd=$cur;
5279 if [[ "$cur" == [0-9]*.* ]]; then
5280 cur="^$cur.*";
5281 else
5282 if [[ "$cur" == [0-9]* ]]; then
5283 cur="^$cur.*\.";
5284 else
5285 if [ -z "$cur" ]; then
5286 cur="[a-z.]";
5287 else
5288 cur="^$cur";
5289 fi;
5290 fi;
5291 fi;
5292 if [ ${#kh[@]} -gt 0 ]; then
5293 COMPREPLY=($( awk 'BEGIN {FS=","}
5294 /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
5295 gsub(" .*$", "", $i); \
5296 if ($i ~ /'$cur'/) {print $i} \
5297 }}' "${kh[@]}" 2>/dev/null ));
5298 fi;
5299 if [ ${#khd[@]} -gt 0 ]; then
5300 for i in "${khd[@]}";
5301 do
5302 if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ]; then
5303 host=${i/#*key_22_/};
5304 host=${host/%.pub/};
5305 COMPREPLY=("${COMPREPLY[@]}" $host);
5306 fi;
5307 done;
5308 fi;
5309 if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
5310 local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" );
5311 hosts=$( compgen -W "$host_aliases" -- $ocur );
5312 COMPREPLY=("${COMPREPLY[@]}" $hosts);
5313 fi;
5314 COMPREPLY=("${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ));
5315 for ((i=0; i < ${#COMPREPLY[@]}; i++ ))
5316 do
5317 COMPREPLY[i]=$user${COMPREPLY[i]}$suffix;
5318 done;
5319 else
5320 if [ -z "$configfile" ]; then
5321 COMPREPLY=($( compgen -A hostname -S "$suffix" -- $cur ));
5322 fi;
5323 fi;
5324 return 0
5325}
5326_larch ()
5327{
5328 local cur prev;
5329 COMPREPLY=();
5330 cur=`_get_cword`;
5331 prev=${COMP_WORDS[COMP_CWORD-1]};
5332 if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
5333 COMPREPLY=($( compgen -W ' \
5334my-id my-default-archive register-archive whereis-archive archives \
5335init-tree tree-root tree-version set-tree-version inventory tagging-method \
5336tree-lint missing-tags add delete move explicit-default set-manifest \
5337manifest check-manifest mkpatch dopatch patch-report empty-patch \
5338make-archive make-category make-branch make-version categories \
5339branches versions revisions cat-archive-log archive-cache-revision \
5340archive-cached-revisions archive-uncache-revision category-readme \
5341branch-readme version-readme make-log logs add-log log-ls cat-log \
5342log-header-field changelog log-for-merge merge-points new-on-branch \
5343import commit get get-patch lock-branch lock-revision push-mirror \
5344build-config update-config replay-config record-config show-config \
5345config-history update replay delta-patch star-merge tag prepare-branch \
5346finish-branch join-branch whats-missing what-changed file-diffs pristines \
5347lock-pristine my-revision-library library-find library-add library-remove \
5348library-archives library-categories library-branches library-versions \
5349library-revisions library-log library-file touched-files-prereqs \
5350patch-set-web update-distributions distribution-name notify my-notifier \
5351mail-new-categories mail-new-branches mail-new-versions mail-new-revisions \
5352notify-library notify-browser push-new-revisions sendmail-mailx' $cur ));
5353 fi;
5354 return 0
5355}
5356_lftp ()
5357{
5358 local cur;
5359 COMPREPLY=();
5360 cur=`_get_cword`;
5361 if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
5362 COMPREPLY=($( compgen -W '$( sed -ne "s/^\(.*\)'' ''.*$/\1/p" \
5363 ~/.lftp/bookmarks )' -- $cur ));
5364 fi;
5365 return 0
5366}
5367_lisp ()
5368{
5369 local cur;
5370 COMPREPLY=();
5371 cur=`_get_cword`;
5372 if [[ "$cur" == -* ]]; then
5373 COMPREPLY=($( compgen -W '-core -lib -batch -quit -edit -eval -init \
5374 -dynamic-space-size -hinit -noinit -nositeinit -load \
5375 -slave ' -- $cur ));
5376 else
5377 _filedir;
5378 fi;
5379 return 0
5380}
5381_list_admins ()
5382{
5383 local cur;
5384 COMPREPLY=();
5385 cur=`_get_cword`;
5386 if [[ "$cur" == -* ]]; then
5387 COMPREPLY=($( compgen -W '--all-vhost= -v \
5388 --all -a -h --help' -- $cur ));
5389 else
5390 _mailman_lists;
5391 fi
5392}
5393_list_lists ()
5394{
5395 local cur;
5396 COMPREPLY=();
5397 cur=`_get_cword`;
5398 if [[ "$cur" == -* ]]; then
5399 COMPREPLY=($( compgen -W '-a --advertised \
5400 --virtual-host-overview= -V -b --bare \
5401 -h --help' -- $cur ));
5402 fi
5403}
5404_list_members ()
5405{
5406 local cur prev;
5407 COMPREPLY=();
5408 cur=`_get_cword`;
5409 prev=${COMP_WORDS[COMP_CWORD-1]};
5410 case "$prev" in
5411 -@(o|-output))
5412 _filedir;
5413 return 0
5414 ;;
5415 -@(d|-digest=))
5416 COMPREPLY=($( compgen -W 'mime plain' -- $cur));
5417 return 0
5418 ;;
5419 -@(n|-nomail=))
5420 COMPREPLY=($( compgen -W 'byadmin byuser bybounce unknown' -- $cur));
5421 return 0
5422 ;;
5423 esac;
5424 if [[ "$cur" == -* ]]; then
5425 COMPREPLY=($( compgen -W '--output -o --regular -r \
5426 --digest= -d --nomail= -n --fullnames -f \
5427 --preserve -p -h --help' -- $cur ));
5428 else
5429 _mailman_lists;
5430 fi
5431}
5432_list_owners ()
5433{
5434 local cur;
5435 COMPREPLY=();
5436 cur=`_get_cword`;
5437 if [[ "$cur" == -* ]]; then
5438 COMPREPLY=($( compgen -W '-w --with-listnames \
5439 -m --moderators -h --help' -- $cur ));
5440 else
5441 _mailman_lists;
5442 fi
5443}
5444_logicalvolumes ()
5445{
5446 COMPREPLY=($(compgen -W "$( lvscan 2>/dev/null | sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ))
5447}
5448_longopt ()
5449{
5450 local cur opt;
5451 cur=`_get_cword`;
5452 if [[ "$cur" == --*=* ]]; then
5453 opt=${cur%%=*};
5454 opt=${opt%\\*};
5455 cur=${cur#*=};
5456 _filedir;
5457 COMPREPLY=($( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur));
5458 return 0;
5459 fi;
5460 if [[ "$cur" == -* ]]; then
5461 COMPREPLY=($( $1 --help 2>&1 | sed -e '/--/!d' -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | command grep "^$cur" | sort -u ));
5462 else
5463 if [[ "$1" == rmdir ]]; then
5464 _filedir -d;
5465 else
5466 _filedir;
5467 fi;
5468 fi
5469}
5470_look ()
5471{
5472 local cur;
5473 COMPREPLY=();
5474 cur=`_get_cword`;
5475 if [ $COMP_CWORD = 1 ]; then
5476 COMPREPLY=($( compgen -W '$(look $cur 2>/dev/null)' ));
5477 fi
5478}
5479_lvchange ()
5480{
5481 local cur prev;
5482 COMPREPLY=();
5483 cur=`_get_cword`;
5484 prev=${COMP_WORDS[COMP_CWORD-1]};
5485 case "$prev" in
5486 -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
5487 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5488 return 0
5489 ;;
5490 -@(p|-permission))
5491 COMPREPLY=($( compgen -W 'r rw' -- $cur ));
5492 return 0
5493 ;;
5494 esac;
5495 if [[ "$cur" == -* ]]; then
5496 COMPREPLY=($( compgen -W '-A --autobackup -a --available \
5497 --addtag --alloc -C --contiguous -d --debug --deltag \
5498 -f --force -h --help --ignorelockingfailure -M \
5499 --persistent --major major --minor minor -P --partial \
5500 -p --permission -r --readahead --refresh -t --test \
5501 -v --verbose --version' -- $cur ));
5502 else
5503 _logicalvolumes;
5504 fi
5505}
5506_lvcreate ()
5507{
5508 local cur prev;
5509 COMPREPLY=();
5510 cur=`_get_cword`;
5511 prev=${COMP_WORDS[COMP_CWORD-1]};
5512 case "$prev" in
5513 -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
5514 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5515 return 0
5516 ;;
5517 -@(L|-size))
5518 _sizes;
5519 return 0
5520 ;;
5521 -@(p|-permission))
5522 COMPREPLY=($( compgen -W 'r rw' -- $cur ));
5523 return 0
5524 ;;
5525 -@(n|-name))
5526 _logicalvolumes;
5527 return 0
5528 ;;
5529 esac;
5530 if [[ "$cur" == -* ]]; then
5531 COMPREPLY=($( compgen -W '-A --autobackup --addtag --alloc \
5532 -C --contiguous -d --debug -h -? --help -i --stripes \
5533 -I --stripesize -l --extents -L --size -M --persistent \
5534 --major --minor -n --name -p --permission -r \
5535 --readahead -t --test --type -v --verbose -Z --zero \
5536 --version' -- $cur ));
5537 else
5538 _args;
5539 if [ $args -eq 0 ]; then
5540 _volumegroups;
5541 else
5542 _physicalvolumes;
5543 fi;
5544 fi
5545}
5546_lvdisplay ()
5547{
5548 local cur prev;
5549 COMPREPLY=();
5550 cur=`_get_cword`;
5551 prev=${COMP_WORDS[COMP_CWORD-1]};
5552 case "$prev" in
5553 --units)
5554 _units;
5555 return 0
5556 ;;
5557 esac;
5558 if [[ "$cur" == -* ]]; then
5559 COMPREPLY=($( compgen -W '-c --colon -C --columns --units \
5560 -P --partial -m --maps -v --verbose -d --debug -h \
5561 --help --version' -- $cur ));
5562 else
5563 _logicalvolumes;
5564 fi
5565}
5566_lvextend ()
5567{
5568 local cur prev;
5569 COMPREPLY=();
5570 cur=`_get_cword`;
5571 prev=${COMP_WORDS[COMP_CWORD-1]};
5572 case "$prev" in
5573 -@(A|-autobackup))
5574 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5575 return 0
5576 ;;
5577 -@(L|-size))
5578 _sizes;
5579 return 0
5580 ;;
5581 esac;
5582 if [[ "$cur" == -* ]]; then
5583 COMPREPLY=($( compgen -W '-A --autobackup --alloc -d \
5584 --debug -h --help -i --stripes -I --stripesize \
5585 -l --extents -L --size -n --nofsck -r --resizefs \
5586 -t --test --type -v --verbose --version' -- $cur ));
5587 else
5588 _args;
5589 if [ $args -eq 0 ]; then
5590 _logicalvolumes;
5591 else
5592 _physicalvolumes;
5593 fi;
5594 fi
5595}
5596_lvm ()
5597{
5598 local prev;
5599 COMPREPLY=();
5600 cur=`_get_cword`;
5601 if [ $COMP_CWORD -eq 1 ]; then
5602 COMPREPLY=($( compgen -W 'dumpconfig help lvchange \
5603 lvcreate lvdisplay lvextend lvmchange \
5604 lvmdiskscan lvmsadc lvmsar lvreduce \
5605 lvremove lvrename lvresize lvs lvscan \
5606 pvchange pvcreate pvdata pvdisplay pvmove \
5607 pvremove pvresize pvs pvscan vgcfgbackup \
5608 vgcfgrestore vgchange vgck vgconvert \
5609 vgcreate vgdisplay vgexport vgextend \
5610 vgimport vgmerge vgmknodes vgreduce \
5611 vgremove vgrename vgs vgscan vgsplit \
5612 version' -- $cur ));
5613 else
5614 case ${COMP_WORDS[1]} in
5615 pvchange)
5616 _pvchange
5617 ;;
5618 pvcreate)
5619 _pvcreate
5620 ;;
5621 pvdisplay)
5622 _pvdisplay
5623 ;;
5624 pvmove)
5625 _pvmove
5626 ;;
5627 pvremove)
5628 _pvremove
5629 ;;
5630 pvresize)
5631 _pvresize
5632 ;;
5633 pvs)
5634 _pvs
5635 ;;
5636 pvscan)
5637 _pvscan
5638 ;;
5639 vgcfgbackup)
5640 _vgcfgbackup
5641 ;;
5642 vgcfgrestore)
5643 _vgcfgrestore
5644 ;;
5645 vgchange)
5646 _vgchange
5647 ;;
5648 vgck)
5649 _vgck
5650 ;;
5651 vgconvert)
5652 _vgconvert
5653 ;;
5654 vgcreate)
5655 _vgcreate
5656 ;;
5657 vgdisplay)
5658 _vgdisplay
5659 ;;
5660 vgexport)
5661 _vgexport
5662 ;;
5663 vgextend)
5664 _vgextend
5665 ;;
5666 vgimport)
5667 _vgimport
5668 ;;
5669 vgmerge)
5670 _vgmerge
5671 ;;
5672 vgmknodes)
5673 _vgmknodes
5674 ;;
5675 vgreduce)
5676 _vgreduce
5677 ;;
5678 vgremove)
5679 _vgremove
5680 ;;
5681 vgrename)
5682 _vgrename
5683 ;;
5684 vgs)
5685 _vgs
5686 ;;
5687 vgscan)
5688 _vgscan
5689 ;;
5690 vgsplit)
5691 _vgsplit
5692 ;;
5693 lvchange)
5694 _lvchange
5695 ;;
5696 lvcreate)
5697 _lvcreate
5698 ;;
5699 lvdisplay)
5700 _lvdisplay
5701 ;;
5702 lvextend)
5703 _lvextend
5704 ;;
5705 lvreduce)
5706 _lvreduce
5707 ;;
5708 lvremove)
5709 _lvremove
5710 ;;
5711 lvrename)
5712 _lvrename
5713 ;;
5714 lvresize)
5715 _lvresize
5716 ;;
5717 lvs)
5718 _lvs
5719 ;;
5720 lvscan)
5721 _lvscan
5722 ;;
5723 esac;
5724 fi
5725}
5726_lvmdiskscan ()
5727{
5728 local cur;
5729 COMPREPLY=();
5730 cur=`_get_cword`;
5731 if [[ "$cur" == -* ]]; then
5732 COMPREPLY=($( compgen -W '-d --debug -h -? --help -l \
5733 --lvmpartition -v --verbose --version' -- $cur ));
5734 fi
5735}
5736_lvreduce ()
5737{
5738 local cur prev;
5739 COMPREPLY=();
5740 cur=`_get_cword`;
5741 prev=${COMP_WORDS[COMP_CWORD-1]};
5742 case "$prev" in
5743 -@(A|-autobackup))
5744 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5745 return 0
5746 ;;
5747 -@(L|-size))
5748 _sizes;
5749 return 0
5750 ;;
5751 esac;
5752 if [[ "$cur" == -* ]]; then
5753 COMPREPLY=($( compgen -W '-A --autobackup -d \
5754 --debug -f --force -h --help -l --extents \
5755 -L --size -n --nofsck -r --resizefs -t --test \
5756 -v --verbose --version' -- $cur ));
5757 else
5758 _logicalvolumes;
5759 fi
5760}
5761_lvremove ()
5762{
5763 local cur prev;
5764 COMPREPLY=();
5765 cur=`_get_cword`;
5766 prev=${COMP_WORDS[COMP_CWORD-1]};
5767 case "$prev" in
5768 -@(A|-autobackup))
5769 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5770 return 0
5771 ;;
5772 esac;
5773 if [[ "$cur" == -* ]]; then
5774 COMPREPLY=($( compgen -W '-A --autobackup -d --debug -f \
5775 --force -h -? --help -t --test -v --verbose \
5776 --version' -- $cur ));
5777 else
5778 _logicalvolumes;
5779 fi
5780}
5781_lvrename ()
5782{
5783 local cur prev;
5784 COMPREPLY=();
5785 cur=`_get_cword`;
5786 prev=${COMP_WORDS[COMP_CWORD-1]};
5787 case "$prev" in
5788 -@(A|-autobackup))
5789 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5790 return 0
5791 ;;
5792 esac;
5793 if [[ "$cur" == -* ]]; then
5794 COMPREPLY=($( compgen -W '-A --autobackup -d --debug -h \
5795 -? --help -t --test -v --verbose --version' -- $cur ));
5796 else
5797 _logicalvolumes;
5798 fi
5799}
5800_lvresize ()
5801{
5802 local cur prev;
5803 COMPREPLY=();
5804 cur=`_get_cword`;
5805 prev=${COMP_WORDS[COMP_CWORD-1]};
5806 case "$prev" in
5807 -@(A|-autobackup))
5808 COMPREPLY=($( compgen -W 'y n' -- $cur ));
5809 return 0
5810 ;;
5811 -@(L|-size))
5812 _sizes;
5813 return 0
5814 ;;
5815 esac;
5816 if [[ "$cur" == -* ]]; then
5817 COMPREPLY=($( compgen -W '-A --autobackup --alloc -d \
5818 --debug -h --help -i --stripes -I --stripesize \
5819 -l --extents -L --size -n --nofsck -r --resizefs \
5820 -t --test --type -v --verbose --version' -- $cur ));
5821 else
5822 _args;
5823 if [ $args -eq 0 ]; then
5824 _logicalvolumes;
5825 else
5826 _physicalvolumes;
5827 fi;
5828 fi
5829}
5830_lvs ()
5831{
5832 local cur prev;
5833 COMPREPLY=();
5834 cur=`_get_cword`;
5835 prev=${COMP_WORDS[COMP_CWORD-1]};
5836 case "$prev" in
5837 -@(o|O|-options|-sort))
5838 COMPREPLY=($( compgen -W 'lv_uuid lv_name \
5839 lv_attr lv_minor lv_size seg_count \
5840 origin snap_percent segtype stripes \
5841 stripesize chunksize seg_start \
5842 seg_size' -- $cur ));
5843 return 0
5844 ;;
5845 --units)
5846 _units;
5847 return 0
5848 ;;
5849 esac;
5850 if [[ "$cur" == -* ]]; then
5851 COMPREPLY=($( compgen -W '--aligned -d --debug \
5852 -h --help --ignorelockingfailure --noheadings \
5853 --nosuffix -o --options -O --sort -P --partial \
5854 --segments --separator --unbuffered --units \
5855 -v --verbose --version' -- $cur ));
5856 else
5857 _logicalvolumes;
5858 fi
5859}
5860_lvscan ()
5861{
5862 local cur;
5863 COMPREPLY=();
5864 cur=`_get_cword`;
5865 if [[ "$cur" == -* ]]; then
5866 COMPREPLY=($( compgen -W '-b --blockdevice -d --debug \
5867 -h -? --help --ignorelockingfailure -P \
5868 --partial -v --verbose --version' -- $cur ));
5869 fi
5870}
5871_lzma ()
5872{
5873 local cur prev xspec;
5874 COMPREPLY=();
5875 cur=`_get_cword`;
5876 prev=${COMP_WORDS[COMP_CWORD-1]};
5877 if [[ "$cur" == -* ]]; then
5878 COMPREPLY=($( compgen -W '-c -d -f -h -k -L -q -s \
5879 -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
5880 --help --decompress --compress --keep --force \
5881 --test --stdout --quiet --verbose --license \
5882 --version --small --fast --best --text' -- $cur ));
5883 return 0;
5884 fi;
5885 local IFS='
5886';
5887 xspec="*.lzma";
5888 if [[ "$prev" == --* ]]; then
5889 [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec;
5890 [[ "$prev" == --compress ]] && xspec=;
5891 else
5892 if [[ "$prev" == -* ]]; then
5893 [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec;
5894 [[ "$prev" == -*z* ]] && xspec=;
5895 fi;
5896 fi;
5897 _expand || return 0;
5898 COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
5899}
5900_macof ()
5901{
5902 local cur;
5903 COMPREPLY=();
5904 cur=`_get_cword`;
5905 prev=${COMP_WORDS[COMP_CWORD-1]};
5906 case "$prev" in
5907 -i)
5908 _interfaces;
5909 return 0
5910 ;;
5911 esac;
5912 if [[ "$cur" == -* ]]; then
5913 COMPREPLY=($( compgen -W '-i -s -d -e -x -y -n' -- $cur ));
5914 fi
5915}
5916_mailman_lists ()
5917{
5918 COMPREPLY=($( list_lists -b | grep "^$cur"))
5919}
5920_mailmanctl ()
5921{
5922 local cur;
5923 COMPREPLY=();
5924 cur=`_get_cword`;
5925 if [[ "$cur" == -* ]]; then
5926 COMPREPLY=($( compgen -W '-n --no-restart -u --run-as-user \
5927 -s --stale-lock-cleanup --quiet -q -h --help' -- $cur ));
5928 else
5929 COMPREPLY=($( compgen -W 'start stop restart reopen' -- $cur ));
5930 fi
5931}
5932_make ()
5933{
5934 local file makef makef_dir="." makef_inc cur prev i;
5935 COMPREPLY=();
5936 cur=`_get_cword`;
5937 prev=${COMP_WORDS[COMP_CWORD-1]};
5938 case $prev in
5939 -@(f|o|W))
5940 _filedir;
5941 return 0
5942 ;;
5943 -@(I|C))
5944 _filedir -d;
5945 return 0
5946 ;;
5947 esac;
5948 if [[ "$cur" == *=* ]]; then
5949 prev=${cur/=*/};
5950 cur=${cur/*=/};
5951 case "$prev" in
5952 --@(file|makefile))
5953 _filedir;
5954 return 0
5955 ;;
5956 --@(directory|include-dir))
5957 _filedir -d;
5958 return 0
5959 ;;
5960 esac;
5961 fi;
5962 if [[ "$cur" == -* ]]; then
5963 COMPREPLY=($( compgen -W '-b -m -B -C -d -e -f -h -i -I\
5964 -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
5965 --always-make --directory= --debug \
5966 --environment-overrides --file= --makefile= --help \
5967 --ignore-errors --include-dir= --jobs --load-average \
5968 --max-load --keep-going --just-print --dry-run \
5969 --recon --old-file= --assume-old= --print-data-base \
5970 --question --no-builtin-rules --no-builtin-variables \
5971 --silent --quiet --no-keep-goind --stop --touch \
5972 --version --print-directory --no-print-directory \
5973 --what-if= --new-file= --assume-new= \
5974 --warn-undefined-variables' -- $cur ));
5975 else
5976 for ((i=0; i < ${#COMP_WORDS[@]}; i++ ))
5977 do
5978 if [[ ${COMP_WORDS[i]} == -C ]]; then
5979 eval makef_dir=${COMP_WORDS[i+1]};
5980 break;
5981 fi;
5982 done;
5983 for ((i=0; i < ${#COMP_WORDS[@]}; i++ ))
5984 do
5985 if [[ ${COMP_WORDS[i]} == -f ]]; then
5986 eval makef=${COMP_WORDS[i+1]};
5987 break;
5988 fi;
5989 done;
5990 [ -n "$makef" ] && makef="-f ${makef}";
5991 [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}";
5992 COMPREPLY=($( make -qp $makef $makef_dir 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
5993 {split($1,A,/ /);for(i in A)print A[i]}' | command grep "^$cur" ));
5994 fi
5995}
5996_man ()
5997{
5998 local cur prev sect manpath manext mansect uname;
5999 manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))";
6000 mansect="@([0-9lnp]|[0-9][px])";
6001 COMPREPLY=();
6002 cur=`_get_cword`;
6003 prev=${COMP_WORDS[COMP_CWORD-1]};
6004 if [[ "$prev" == -l ]]; then
6005 _filedir $manext;
6006 return 0;
6007 fi;
6008 _expand || return 0;
6009 if [[ "$cur" == */* ]]; then
6010 _filedir $manext;
6011 return 0;
6012 fi;
6013 uname=$( uname -s );
6014 if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
6015 manpath=$( manpath 2>/dev/null || command man --path );
6016 else
6017 manpath=$MANPATH;
6018 fi;
6019 if [ -z "$manpath" ]; then
6020 COMPREPLY=($( compgen -c -- $cur ));
6021 return 0;
6022 fi;
6023 [[ "$prev" == $mansect ]] && sect=$prev || sect='*';
6024 manpath=$manpath:;
6025 if [ -n "$cur" ]; then
6026 manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }";
6027 else
6028 manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }";
6029 fi;
6030 COMPREPLY=($( eval command ls "$manpath" 2>/dev/null ));
6031 COMPREPLY=(${COMPREPLY[@]##*/?(:)});
6032 COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|lzma)});
6033 COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ));
6034 if [[ "$prev" != $mansect ]]; then
6035 local start=${#COMPREPLY[@]};
6036 _filedir $manext;
6037 for ((i=$start; i < ${#COMPREPLY[@]}; i++ ))
6038 do
6039 [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]};
6040 done;
6041 fi;
6042 return 0
6043}
6044_mcrypt ()
6045{
6046 local cur prev i decrypt;
6047 COMPREPLY=();
6048 cur=`_get_cword`;
6049 prev=${COMP_WORDS[COMP_CWORD-1]};
6050 case "$prev" in
6051 -@(g|-openpgp-z))
6052 COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ));
6053 return 0
6054 ;;
6055 -@(o|-keymode))
6056 COMPREPLY=($( mcrypt --list-keymodes 2> /dev/null |
6057 grep "^$cur" ));
6058 return 0
6059 ;;
6060 -@(m|-mode))
6061 COMPREPLY=($( mcrypt --list 2> /dev/null |
6062 sed -e 's/.*: //' -e 's/ $//' | sort |
6063 uniq | tr " " "\n" | grep "^$cur" ));
6064 return 0
6065 ;;
6066 -@(a|-algorithm))
6067 COMPREPLY=($( mcrypt --list 2> /dev/null |
6068 awk '{print $1}' | grep "^$cur" ));
6069 return 0
6070 ;;
6071 -@(h|-hash))
6072 COMPREPLY=($( mcrypt --list-hash 2> /dev/null |
6073 sed 1d | grep "^$cur" ));
6074 return 0
6075 ;;
6076 -@(k|s|-@(key?(size))))
6077 return 0
6078 ;;
6079 -@(f|c|-@(keyfile|config)))
6080 _filedir;
6081 return 0
6082 ;;
6083 --@(algorithm|mode)s-directory)
6084 _filedir -d;
6085 return 0
6086 ;;
6087 esac;
6088 if [[ "$cur" == -* ]]; then
6089 COMPREPLY=($( compgen -W '-g --openpgp --openpgp-z -d \
6090 --decrypt -s --keysize -o --keymode -f --keyfile \
6091 -c --config -a --algorithm --algorithms-directory \
6092 -m --mode --modes-directory -h --hash -k --key \
6093 --noiv -b --bare -z --gzip -p --bzip2 --flush -l \
6094 --doublecheck -u --unlink --nodelete -t --time -F \
6095 --force --echo -r --random --list --list-keymodes \
6096 --list-hash -V --verbose -q --quiet --help -v \
6097 --version -L --license' -- $cur ));
6098 else
6099 if [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
6100 _filedir '@(nc)';
6101 else
6102 decrypt=0;
6103 for ((i=1; i < ${#COMP_WORDS[@]}-1; i++ ))
6104 do
6105 if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
6106 _filedir '@(nc)';
6107 decrypt=1;
6108 break;
6109 fi;
6110 done;
6111 if [[ $decrypt -eq 0 ]]; then
6112 _filedir;
6113 fi;
6114 fi;
6115 fi
6116}
6117_mii_tool ()
6118{
6119 local cur prev;
6120 COMPREPLY=();
6121 cur=`_get_cword`;
6122 prev=${COMP_WORDS[COMP_CWORD-1]};
6123 case $prev in
6124 -F)
6125 COMPREPLY=($( compgen -W '100baseTx-FD 100baseTx-HD \
6126 10baseT-FD 10baseT-HD' -- $cur ));
6127 return 0
6128 ;;
6129 -A)
6130 COMPREPLY=($( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
6131 10baseT-FD 10baseT-HD' -- $cur ));
6132 return 0
6133 ;;
6134 esac;
6135 if [[ "$cur" == *=* ]]; then
6136 prev=${cur/=*/};
6137 cur=${cur/*=/};
6138 case "$prev" in
6139 --force)
6140 COMPREPLY=($( compgen -W '100baseTx-FD \
6141 100baseTx-HD 10baseT-FD \
6142 10baseT-HD' -- $cur ));
6143 return 0
6144 ;;
6145 --advertise)
6146 COMPREPLY=($( compgen -W '100baseT4 \
6147 100baseTx-FD 100baseTx-HD 10baseT-FD \
6148 10baseT-HD' -- $cur ));
6149 return 0
6150 ;;
6151 esac;
6152 fi;
6153 if [[ "$cur" == -* ]]; then
6154 COMPREPLY=($( compgen -W '-v --verbose -V --version -R \
6155 --reset -r --restart -w --watch -l --log -A \
6156 --advertise= -F --force=' -- $cur ));
6157 else
6158 _available_interfaces -a;
6159 fi
6160}
6161_mkisofs ()
6162{
6163 local cur prev;
6164 COMPREPLY=();
6165 cur=`_get_cword`;
6166 prev=${COMP_WORDS[COMP_CWORD-1]};
6167 case "$prev" in
6168 -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
6169 _filedir;
6170 return 0
6171 ;;
6172 -*-charset)
6173 COMPREPLY=($( mkisofs -input-charset help 2>&1 | tail +3 | grep "^$cur"));
6174 return 0
6175 ;;
6176 -uid)
6177 _uids;
6178 return 0
6179 ;;
6180 -gid)
6181 _gids;
6182 return 0
6183 ;;
6184 esac;
6185 if [[ "$cur" == -* ]]; then
6186 COMPREPLY=($( compgen -W '-abstract -A -allow-lowercase \
6187 -allow-multidot -biblio -cache-inodes \
6188 -no-cache-inodes -b -eltorito-alt-boot -B -G \
6189 -hard-disk-boot -no-emul-boot -no-boot \
6190 -boot-load-seg -boot-load-size \
6191 -boot-info-table -C -c -check-oldname \
6192 -check-session -copyright -d -D -dir-mode \
6193 -dvd-video -f -file-mode -gid -gui \
6194 -graft-points -hide -hide-list -hidden \
6195 -hidden-list -hide-joliet -hide-joliet-list \
6196 -hide-joliet-trans-tbl -hide-rr-moved \
6197 -input-charset -output-charset -iso-level -J \
6198 -joliet-long -jcharset -l -L -log-file -m \
6199 -exclude-list -max-iso9660-filenames -M -N \
6200 -new-dir-mode -nobak -no-bak -force-rr -no-rr \
6201 -no-split-symlink-components \
6202 -no-split-symlink-fields -o -pad -no-pad \
6203 -path-list -P -p -print-size -quiet -R -r \
6204 -relaxed-filenames -sort -split-output \
6205 -stream-media-size -stream-file-name -sysid -T\
6206 -table-name -ucs-level -udf -uid \
6207 -use-fileversion -U -no-iso-translate -V \
6208 -volset -volset-size -volset-seqno -v -x -z \
6209 -hfs -apple -map -magic -hfs-creator \
6210 -hfs-type -probe -no-desktop -mac-name \
6211 -boot-hfs-file -part -auto -cluster-size \
6212 -hide-hfs -hide-hfs-list -hfs-volid \
6213 -icon-position -root-info -prep-boot \
6214 -input-hfs-charset -output-hfs-charset \
6215 -hfs-unlock -hfs-bless -hfs-parms --cap \
6216 --netatalk --double --ethershare --ushare \
6217 --exchange --sgi --xinet --macbin --single \
6218 --dave --sfm --osx-double --osx-hfs' -- $cur ));
6219 else
6220 _filedir;
6221 fi
6222}
6223_mmsitepass ()
6224{
6225 local cur;
6226 COMPREPLY=();
6227 cur=`_get_cword`;
6228 if [[ "$cur" == -* ]]; then
6229 COMPREPLY=($( compgen -W '-c --listcreator -h --help' -- $cur ));
6230 fi
6231}
6232_modules ()
6233{
6234 local modpath;
6235 modpath=/lib/modules/$1;
6236 COMPREPLY=($( command ls -R $modpath | sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p'))
6237}
6238_mount ()
6239{
6240 local cur i sm host;
6241 COMPREPLY=();
6242 cur=`_get_cword`;
6243 [[ "$cur" == \\ ]] && cur="/";
6244 for i in {,/usr}/{,s}bin/showmount;
6245 do
6246 [ -x $i ] && sm=$i && break;
6247 done;
6248 if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
6249 COMPREPLY=($( $sm -e ${cur%%:*} | sed 1d | grep ^${cur#*:} | awk '{print $1}' ));
6250 else
6251 if [[ "$cur" == //* ]]; then
6252 host=${cur#//};
6253 host=${host%%/*};
6254 if [ -n "$host" ]; then
6255 COMPREPLY=($( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
6256 sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
6257 sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ));
6258 fi;
6259 else
6260 if [ -r /etc/vfstab ]; then
6261 COMPREPLY=($( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab | grep "^$cur" ));
6262 else
6263 if [ ! -e /etc/fstab ]; then
6264 COMPREPLY=($( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' | grep "^$cur" ));
6265 else
6266 COMPREPLY=($( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab | grep "^$cur" ));
6267 fi;
6268 fi;
6269 fi;
6270 fi;
6271 return 0
6272}
6273_mysqladmin ()
6274{
6275 local cur prev;
6276 COMPREPLY=();
6277 cur=`_get_cword`;
6278 prev=${COMP_WORDS[COMP_CWORD-1]};
6279 case "$prev" in
6280 -u)
6281 COMPREPLY=($( compgen -u -- $cur ));
6282 return 0
6283 ;;
6284 *)
6285
6286 ;;
6287 esac;
6288 COMPREPLY=($( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
6289 -v -V -w' -- $cur ));
6290 COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'create drop extended-status flush-hosts \
6291 flush-logs flush-status flush-tables \
6292 flush-threads flush-privileges kill \
6293 password ping processlist reload refresh \
6294 shutdown status variables version' -- $cur ))
6295}
6296_newlist ()
6297{
6298 local cur;
6299 COMPREPLY=();
6300 cur=`_get_cword`;
6301 if [[ "$cur" == -* ]]; then
6302 COMPREPLY=($( compgen -W '-l --language -q --quiet -h --help' -- $cur ));
6303 else
6304 _mailman_lists;
6305 fi
6306}
6307_nslookup ()
6308{
6309 local cur;
6310 COMPREPLY=();
6311 cur=${COMP_WORDS[COMP_CWORD]#-};
6312 COMPREPLY=($( compgen -P '-' -W 'all class= debug d2 domain= \
6313 srchlist= defname search port= querytype= \
6314 type= recurse retry root timeout vc \
6315 ignoretc' -- $cur ))
6316}
6317_ntpdate ()
6318{
6319 local cur prev;
6320 COMPREPLY=();
6321 cur=`_get_cword`;
6322 prev=${COMP_WORDS[COMP_CWORD-1]};
6323 case $prev in
6324 -k)
6325 _filedir;
6326 return 0
6327 ;;
6328 -U)
6329 COMPREPLY=($( compgen -u $cur ));
6330 return 0
6331 ;;
6332 esac;
6333 if [[ "$cur" == -* ]]; then
6334 COMPREPLY=($( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
6335 -e -k -p -o -r -t' -- $cur ));
6336 else
6337 _known_hosts;
6338 fi
6339}
6340_ooexp_ ()
6341{
6342 local c=${COMP_WORDS[COMP_CWORD]};
6343 local a="${COMP_LINE}";
6344 local e s g=0 cd dc t="";
6345 local IFS;
6346 shopt -q extglob && g=1;
6347 test $g -eq 0 && shopt -s extglob;
6348 cd='*-?(c)d*';
6349 dc='*-d?(c)*';
6350 case "${1##*/}" in
6351 oobase)
6352 e='!*.+(odb|ODB)'
6353 ;;
6354 oofromtemplate)
6355 e='!*.+(stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX)'
6356 ;;
6357 oodraw)
6358 e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG)'
6359 ;;
6360 oocalc)
6361 e='!*.+(sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX)'
6362 ;;
6363 oomath)
6364 e='!*.+(sxm|SXM|smf|SMF|mml|MML|odf|ODF)'
6365 ;;
6366 ooweb)
6367 e='!*.+(htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)'
6368 ;;
6369 ooffice)
6370 e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG|doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxm|SXM|smf|SMF|mml|MML|odf|ODF|sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX|odb|ODB|sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX|sxg|SXG|odm|ODM|sgl|SGL|stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX|htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)'
6371 ;;
6372 oowriter)
6373 e='!*.+(doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxg|SXG|odm|ODM|sgl|SGL)'
6374 ;;
6375 ooimpress)
6376 e='!*.+(sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX)'
6377 ;;
6378 unopkg)
6379 e='!*.+(oxt|OXT)'
6380 ;;
6381 *)
6382 e='!*'
6383 ;;
6384 esac;
6385 case "$(complete -p ${1##*/} 2> /dev/null)" in
6386 *-d*)
6387
6388 ;;
6389 *)
6390 s="-S/"
6391 ;;
6392 esac;
6393 IFS='
6394';
6395 case "$c" in
6396 \$\(*\))
6397 eval COMPREPLY=\(${c}\)
6398 ;;
6399 \$\(*)
6400 COMPREPLY=($(compgen -c -P '$(' -S ')' -- ${c#??}))
6401 ;;
6402 \`*\`)
6403 eval COMPREPLY=\(${c}\)
6404 ;;
6405 \`*)
6406 COMPREPLY=($(compgen -c -P '\`' -S '\`' -- ${c#?}))
6407 ;;
6408 \$\{*\})
6409 eval COMPREPLY=\(${c}\)
6410 ;;
6411 \$\{*)
6412 COMPREPLY=($(compgen -v -P '${' -S '}' -- ${c#??}))
6413 ;;
6414 \$*)
6415 COMPREPLY=($(compgen -v -P '$' -- ${c#?}))
6416 ;;
6417 \~*/*)
6418 COMPREPLY=($(compgen -f -X "$e" -- ${c}))
6419 ;;
6420 \~*)
6421 COMPREPLY=($(compgen -u ${s} -- ${c}))
6422 ;;
6423 *@*)
6424 COMPREPLY=($(compgen -A hostname -P '@' -S ':' -- ${c#*@}))
6425 ;;
6426 *[*?[]*)
6427 COMPREPLY=($(compgen -G "${c}"))
6428 ;;
6429 *[?*+\!@]\(*\)*)
6430 if test $g -eq 0; then
6431 COMPREPLY=($(compgen -f -X "$e" -- $c));
6432 test $g -eq 0 && shopt -u extglob;
6433 return;
6434 fi;
6435 COMPREPLY=($(compgen -G "${c}"))
6436 ;;
6437 *)
6438 if test "$c" = ".."; then
6439 COMPREPLY=($(compgen -d -X "$e" -S / ${_nosp} -- $c));
6440 else
6441 for s in $(compgen -f -X "$e" -- $c);
6442 do
6443 if test -d $s; then
6444 COMPREPLY=(${COMPREPLY[@]} $(compgen -f -X "$e" -S / -- $s));
6445 else
6446 if test -z "$t"; then
6447 COMPREPLY=(${COMPREPLY[@]} $s);
6448 else
6449 case "$(file -b $s 2> /dev/null)" in
6450 $t)
6451 COMPREPLY=(${COMPREPLY[@]} $s)
6452 ;;
6453 esac;
6454 fi;
6455 fi;
6456 done;
6457 fi
6458 ;;
6459 esac;
6460 test $g -eq 0 && shopt -u extglob
6461}
6462_openssl ()
6463{
6464 local cur prev;
6465 COMPREPLY=();
6466 cur=`_get_cword`;
6467 if [ $COMP_CWORD -eq 1 ]; then
6468 COMPREPLY=($( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \
6469 dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \
6470 genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \
6471 rsautl s_client s_server s_time sess_id smime speed \
6472 spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \
6473 sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \
6474 cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \
6475 des-cbc des-cfb des-ecb des-ede des-ede-cbc \
6476 des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \
6477 des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
6478 rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \
6479 rc4 rc4-40' -- $cur ));
6480 else
6481 prev=${COMP_WORDS[COMP_CWORD-1]};
6482 case ${COMP_WORDS[1]} in
6483 asn1parse)
6484 case $prev in
6485 -inform)
6486 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6487 return 0
6488 ;;
6489 -@(in|out|oid))
6490 _filedir;
6491 return 0
6492 ;;
6493 esac;
6494 if [[ "$cur" == -* ]]; then
6495 COMPREPLY=($( compgen -W '-inform -in -out -noout -offset \
6496 -length -i -oid -strparse' -- $cur ));
6497 fi
6498 ;;
6499 ca)
6500 case $prev in
6501 -@(config|revoke|cert|in|out|spkac|ss_cert))
6502 _filedir;
6503 return 0
6504 ;;
6505 -outdir)
6506 _filedir -d;
6507 return 0
6508 ;;
6509 -@(name|crlexts|extensions))
6510 _openssl_sections;
6511 return 0
6512 ;;
6513 esac;
6514 if [[ "$cur" == -* ]]; then
6515 COMPREPLY=($( compgen -W '-verbose -config -name \
6516 -gencrl -revoke -crldays -crlhours -crlexts \
6517 -startdate -enddate -days -md -policy -keyfile \
6518 -key -passin -cert -in -out -notext -outdir \
6519 -infiles -spkac -ss_cert -preserveDN -batch \
6520 -msie_hack -extensions' -- $cur ));
6521 fi
6522 ;;
6523 ciphers)
6524 if [[ "$cur" == -* ]]; then
6525 COMPREPLY=($( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ));
6526 fi
6527 ;;
6528 crl)
6529 case $prev in
6530 -@(in|out)form)
6531 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6532 return 0
6533 ;;
6534 -@(in|out|CAfile))
6535 _filedir;
6536 return 0
6537 ;;
6538 -CAPath)
6539 _filedir -d;
6540 return 0
6541 ;;
6542 esac;
6543 if [[ "$cur" == -* ]]; then
6544 COMPREPLY=($( compgen -W '-inform -outform -text -in -out -noout \
6545 -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ));
6546 fi
6547 ;;
6548 crl2pkcs7)
6549 case $prev in
6550 -@(in|out)form)
6551 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6552 return 0
6553 ;;
6554 -@(in|out))
6555 _filedir;
6556 return 0
6557 ;;
6558 esac;
6559 if [[ "$cur" == -* ]]; then
6560 COMPREPLY=($( compgen -W '-inform -outform -in -out -print_certs' -- $cur ));
6561 fi
6562 ;;
6563 dgst)
6564 case $prev in
6565 -@(out|sign|verify|prvrify|signature))
6566 _filedir;
6567 return 0
6568 ;;
6569 esac;
6570 if [[ "$cur" == -* ]]; then
6571 COMPREPLY=($( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
6572 -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ));
6573 else
6574 _filedir;
6575 fi
6576 ;;
6577 dsa)
6578 case $prev in
6579 -@(in|out)form)
6580 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6581 return 0
6582 ;;
6583 -@(in|out))
6584 _filedir;
6585 return 0
6586 ;;
6587 esac;
6588 if [[ "$cur" == -* ]]; then
6589 COMPREPLY=($( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
6590 -modulus -pubin -pubout' -- $cur ));
6591 fi
6592 ;;
6593 dsaparam)
6594 case $prev in
6595 -@(in|out)form)
6596 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6597 return 0
6598 ;;
6599 -@(in|out|rand))
6600 _filedir;
6601 return 0
6602 ;;
6603 esac;
6604 if [[ "$cur" == -* ]]; then
6605 COMPREPLY=($( compgen -W '-inform -outform -in -out -noout \
6606 -text -C -rand -genkey' -- $cur ));
6607 fi
6608 ;;
6609 enc)
6610 case $prev in
6611 -@(in|out|kfile))
6612 _filedir;
6613 return 0
6614 ;;
6615 esac;
6616 if [[ "$cur" == -* ]]; then
6617 COMPREPLY=($( compgen -W '-ciphername -in -out -pass \
6618 -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ));
6619 fi
6620 ;;
6621 dhparam)
6622 case $prev in
6623 -@(in|out)form)
6624 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6625 return 0
6626 ;;
6627 -@(in|out|rand))
6628 _filedir;
6629 return 0
6630 ;;
6631 esac;
6632 if [[ "$cur" == -* ]]; then
6633 COMPREPLY=($( compgen -W '-inform -outform -in -out -dsaparam -noout \
6634 -text -C -2 -5 -rand' -- $cur ));
6635 fi
6636 ;;
6637 gendsa)
6638 case $prev in
6639 -@(out|rand))
6640 _filedir;
6641 return 0
6642 ;;
6643 esac;
6644 if [[ "$cur" == -* ]]; then
6645 COMPREPLY=($( compgen -W '-out -des -des3 -idea -rand' -- $cur ));
6646 else
6647 _filedir;
6648 fi
6649 ;;
6650 genrsa)
6651 case $prev in
6652 -@(out|rand))
6653 _filedir;
6654 return 0
6655 ;;
6656 esac;
6657 if [[ "$cur" == -* ]]; then
6658 COMPREPLY=($( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ));
6659 fi
6660 ;;
6661 pkcs7)
6662 case $prev in
6663 -@(in|out)form)
6664 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6665 return 0
6666 ;;
6667 -@(in|out))
6668 _filedir;
6669 return 0
6670 ;;
6671 esac;
6672 if [[ "$cur" == -* ]]; then
6673 COMPREPLY=($( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ));
6674 fi
6675 ;;
6676 rand)
6677 case $prev in
6678 -@(out|rand))
6679 _filedir;
6680 return 0
6681 ;;
6682 esac;
6683 if [[ "$cur" == -* ]]; then
6684 COMPREPLY=($( compgen -W '-out -rand -base64' -- $cur ));
6685 fi
6686 ;;
6687 req)
6688 case "$prev" in
6689 -@(in|out|key)form)
6690 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6691 return 0
6692 ;;
6693 -@(in|out|rand|key|keyout|config))
6694 _filedir;
6695 return 0
6696 ;;
6697 -extensions)
6698 _openssl_sections;
6699 return 0
6700 ;;
6701 esac;
6702 if [[ "$cur" == -* ]]; then
6703 COMPREPLY=($( compgen -W '-inform -outform -in \
6704 -passin -out -passout -text -noout -verify \
6705 -modulus -new -rand -newkey -newkey -nodes \
6706 -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
6707 -config -x509 -days -asn1-kludge -newhdr \
6708 -extensions -reqexts section' -- $cur ));
6709 fi
6710 ;;
6711 rsa)
6712 case $prev in
6713 -@(in|out)form)
6714 COMPREPLY=($( compgen -W 'DER NET PEM' -- $cur ));
6715 return 0
6716 ;;
6717 -@(in|out))
6718 _filedir;
6719 return 0
6720 ;;
6721 esac;
6722 if [[ "$cur" == -* ]]; then
6723 COMPREPLY=($( compgen -W '-inform -outform -in -passin -out -passout \
6724 -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
6725 -pubout -engine' -- $cur ));
6726 fi
6727 ;;
6728 rsautl)
6729 case $prev in
6730 -@(in|out|inkey))
6731 _filedir;
6732 return 0
6733 ;;
6734 esac;
6735 if [[ "$cur" == -* ]]; then
6736 COMPREPLY=($( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
6737 -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ));
6738 fi
6739 ;;
6740 s_client)
6741 case $prev in
6742 -connect)
6743 _known_hosts;
6744 return 0
6745 ;;
6746 -@(cert|key|CAfile|rand))
6747 _filedir;
6748 return 0
6749 ;;
6750 -CApath)
6751 _filedir -d;
6752 return 0
6753 ;;
6754 esac;
6755 if [[ "$cur" == -* ]]; then
6756 COMPREPLY=($( compgen -W '-connect -verify -cert -key -CApath -CAfile \
6757 -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
6758 -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
6759 -bugs -cipher -starttls -engine -rand' -- $cur ));
6760 fi
6761 ;;
6762 s_server)
6763 case $prev in
6764 -@(cert|key|dcert|dkey|dhparam|CAfile|rand))
6765 _filedir;
6766 return 0
6767 ;;
6768 -CApath)
6769 _filedir -d;
6770 return 0
6771 ;;
6772 esac;
6773 if [[ "$cur" == -* ]]; then
6774 COMPREPLY=($( compgen -W '-accept -context -verify -Verify -cert -key \
6775 -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
6776 -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
6777 -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
6778 -rand' -- $cur ));
6779 fi
6780 ;;
6781 s_time)
6782 case $prev in
6783 -connect)
6784 _known_hosts;
6785 return 0
6786 ;;
6787 -@(cert|key|CAfile))
6788 _filedir;
6789 return 0
6790 ;;
6791 -CApath)
6792 _filedir -d;
6793 return 0
6794 ;;
6795 esac;
6796 if [[ "$cur" == -* ]]; then
6797 COMPREPLY=($( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
6798 -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ));
6799 fi
6800 ;;
6801 sess_id)
6802 case $prev in
6803 -@(in|out)form)
6804 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6805 return 0
6806 ;;
6807 -@(in|out))
6808 _filedir;
6809 return 0
6810 ;;
6811 esac;
6812 if [[ "$cur" == -* ]]; then
6813 COMPREPLY=($( compgen -W '-inform -outform -in -out -text -noout \
6814 -context ID' -- $cur ));
6815 fi
6816 ;;
6817 smime)
6818 case $prev in
6819 -@(in|out)form)
6820 COMPREPLY=($( compgen -W 'SMIME DER PEM' -- $cur ));
6821 return 0
6822 ;;
6823 -@(in|out|certfile|signer|recip|inkey|content|rand))
6824 _filedir;
6825 return 0
6826 ;;
6827 esac;
6828 if [[ "$cur" == -* ]]; then
6829 COMPREPLY=($( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
6830 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
6831 -recip -inform -passin -inkey -out -outform -content -to -from -subject \
6832 -text -rand' -- $cur ));
6833 else
6834 _filedir;
6835 fi
6836 ;;
6837 speed)
6838 if [[ "$cur" == -* ]]; then
6839 COMPREPLY=($( compgen -W '-engine' -- $cur ));
6840 else
6841 COMPREPLY=($( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
6842 rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
6843 rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ));
6844 fi
6845 ;;
6846 verify)
6847 case $prev in
6848 -@(CAfile|untrusted))
6849 _filedir;
6850 return 0
6851 ;;
6852 -CApath)
6853 _filedir -d;
6854 return 0
6855 ;;
6856 esac;
6857 if [[ "$cur" == -* ]]; then
6858 COMPREPLY=($( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
6859 -verbose -certificates' -- $cur ));
6860 else
6861 _filedir;
6862 fi
6863 ;;
6864 x509)
6865 case "$prev" in
6866 -@(in|out|CA|CAkey|CAserial|extfile))
6867 _filedir;
6868 return 0
6869 ;;
6870 -@(in|out)form)
6871 COMPREPLY=($( compgen -W 'DER PEM NET' -- $cur ));
6872 return 0
6873 ;;
6874 -@(key|CA|CAkey)form)
6875 COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
6876 return 0
6877 ;;
6878 -extensions)
6879 _openssl_sections;
6880 return 0
6881 ;;
6882 esac;
6883 if [[ "$cur" == -* ]]; then
6884 COMPREPLY=($( compgen -W '-inform -outform \
6885 -keyform -CAform -CAkeyform -in -out \
6886 -serial -hash -subject -issuer -nameopt \
6887 -email -startdate -enddate -purpose \
6888 -dates -modulus -fingerprint -alias \
6889 -noout -trustout -clrtrust -clrreject \
6890 -addtrust -addreject -setalias -days \
6891 -set_serial -signkey -x509toreq -req \
6892 -CA -CAkey -CAcreateserial -CAserial \
6893 -text -C -md2 -md5 -sha1 -mdc2 -clrext \
6894 -extfile -extensions -engine' -- $cur ));
6895 fi
6896 ;;
6897 @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
6898 if [[ "$cur" == -* ]]; then
6899 COMPREPLY=($( compgen -W '-c -d' -- $cur ));
6900 else
6901 _filedir;
6902 fi
6903 ;;
6904 esac;
6905 fi;
6906 return 0
6907}
6908_openssl_sections ()
6909{
6910 local config;
6911 config=/etc/ssl/openssl.cnf;
6912 [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf;
6913 for ((i=2; i < COMP_CWORD; i++ ))
6914 do
6915 if [[ "${COMP_WORDS[i]}" == -config ]]; then
6916 config=${COMP_WORDS[i+1]};
6917 break;
6918 fi;
6919 done;
6920 [ ! -f $config ] && return 0;
6921 COMPREPLY=($( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ))
6922}
6923_p4 ()
6924{
6925 local cur prev prev2 p4commands p4filetypes;
6926 COMPREPLY=();
6927 cur=`_get_cword`;
6928 prev=${COMP_WORDS[COMP_CWORD-1]};
6929 p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )";
6930 p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary uresource uxbinary xbinary xltext xtempobj xtext text binary resource";
6931 if [ $COMP_CWORD -eq 1 ]; then
6932 COMPREPLY=($( compgen -W "$p4commands" -- $cur ));
6933 else
6934 if [ $COMP_CWORD -eq 2 ]; then
6935 case "$prev" in
6936 help)
6937 COMPREPLY=($( compgen -W "simple commands environment filetypes jobview revisions usage views $p4commands" -- $cur ))
6938 ;;
6939 admin)
6940 COMPREPLY=($( compgen -W "checkpoint stop" -- $cur ))
6941 ;;
6942 *)
6943
6944 ;;
6945 esac;
6946 else
6947 if [ $COMP_CWORD -gt 2 ]; then
6948 prev2=${COMP_WORDS[COMP_CWORD-2]};
6949 case "$prev" in
6950 -t)
6951 case "$prev2" in
6952 add | edit | reopen)
6953 COMPREPLY=($( compgen -W "$p4filetypes" -- $cur))
6954 ;;
6955 *)
6956
6957 ;;
6958 esac
6959 ;;
6960 *)
6961
6962 ;;
6963 esac;
6964 fi;
6965 fi;
6966 fi;
6967 return 0
6968}
6969_parse_help ()
6970{
6971 local cmd;
6972 cmd=$1;
6973 $cmd --help | grep -- "^[[:space:]]*-" | tr "," " " | awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
6974}
6975_pci_ids ()
6976{
6977 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( lspci -n | awk '{print $3}')" -- $cur ))
6978}
6979_perl ()
6980{
6981 local cur prev prefix temp;
6982 local optPrefix optSuffix;
6983 COMPREPLY=();
6984 cur=`_get_cword`;
6985 prev=${COMP_WORDS[COMP_CWORD-1]};
6986 prefix="";
6987 if [[ "$cur" == -?* ]]; then
6988 temp=$cur;
6989 prev=${temp:0:2};
6990 cur=${temp:2};
6991 optPrefix=-P$prev;
6992 optSuffix=-S/;
6993 prefix=$prev;
6994 fi;
6995 case "$prev" in
6996 -I | -x)
6997 local IFS='
6998';
6999 COMPREPLY=($( compgen -d $optPrefix $optSuffix -- "$cur" ));
7000 return 0
7001 ;;
7002 -m | -M)
7003 _perlmodules;
7004 return 0
7005 ;;
7006 esac;
7007 if [[ "$cur" == -* ]]; then
7008 COMPREPLY=($( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
7009 -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ));
7010 else
7011 _filedir;
7012 fi
7013}
7014_perldoc ()
7015{
7016 local cur prev prefix temp;
7017 COMPREPLY=();
7018 cur=`_get_cword`;
7019 prev=${COMP_WORDS[COMP_CWORD-1]};
7020 prefix="";
7021 if [[ "$cur" == -?* ]]; then
7022 temp=$cur;
7023 prev=${temp:0:2};
7024 cur=${temp:2};
7025 prefix=$prev;
7026 fi;
7027 case $prev in
7028 -f)
7029 COMPREPLY=($( compgen -W 'chomp chop chr crypt hex index lc \
7030 lcfirst length oct ord pack q qq reverse rindex sprintf \
7031 substr tr uc ucfirst y m pos quotemeta s split study qr abs \
7032 atan2 cos exp hex int log oct rand sin sqrt srand pop push \
7033 shift splice unshift grep join map qw reverse sort unpack \
7034 delete each exists keys values binmode close closedir \
7035 dbmclose dbmopen die eof fileno flock format getc print \
7036 printf read readdir rewinddir seek seekdir select syscall \
7037 sysread sysseek syswrite tell telldir truncate warn write \
7038 pack read syscall sysread syswrite unpack vec -X chdir chmod \
7039 chown chroot fcntl glob ioctl link lstat mkdir open opendir \
7040 readlink rename rmdir stat symlink umask unlink utime caller \
7041 continue do dump eval exit goto last next redo return \
7042 sub wantarray caller import local my our package use defined \
7043 formline reset scalar undef \
7044 alarm exec fork getpgrp getppid getpriority kill pipe qx \
7045 setpgrp setpriority sleep system times wait waitpid \
7046 import no package require use bless dbmclose dbmopen package \
7047 ref tie tied untie use accept bind connect getpeername \
7048 getsockname getsockopt listen recv send setsockopt shutdown \
7049 socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
7050 semop shmctl shmget shmread shmwrite endgrent endhostent \
7051 endnetent endpwent getgrent getgrgid getgrnam getlogin \
7052 getpwent getpwnam getpwuid setgrent setpwent endprotoent \
7053 endservent gethostbyaddr gethostbyname gethostent \
7054 getnetbyaddr getnetbyname getnetent getprotobyname \
7055 getprotobynumber getprotoent getservbyname getservbyport \
7056 getservent sethostent setnetent setprotoent setservent \
7057 gmtime localtime time times' -- $cur ));
7058 return 0
7059 ;;
7060 esac;
7061 if [[ "$cur" == -* ]]; then
7062 COMPREPLY=($( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ));
7063 else
7064 if [[ "$cur" != */* ]]; then
7065 _perlmodules;
7066 COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ));
7067 fi;
7068 fi
7069}
7070_perlmodules ()
7071{
7072 COMPREPLY=($( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur ))
7073}
7074_pgids ()
7075{
7076 COMPREPLY=($( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur ))
7077}
7078_pgrep ()
7079{
7080 local cur;
7081 COMPREPLY=();
7082 cur=`_get_cword`;
7083 _pnames;
7084 return 0
7085}
7086_physicalvolumes ()
7087{
7088 COMPREPLY=($(compgen -W "$( pvscan 2>/dev/null | sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ))
7089}
7090_pids ()
7091{
7092 COMPREPLY=($( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ))
7093}
7094_pkg_config ()
7095{
7096 local cur;
7097 COMPREPLY=();
7098 cur=`_get_cword`;
7099 if [[ "$cur" == -* ]]; then
7100 COMPREPLY=($( compgen -W '-version --modversion \
7101 --atleast-pkgconfig-version= --libs --libs-only-l \
7102 --libs-only-other --libs-only-L --cflags \
7103 --cflags-only-I --cflags-only-other --variable= \
7104 --define-variable= --exists --uninstalled \
7105 --atleast-version= --exact-version= --max-version= \
7106 --list-all --debug --print-errors --silence-errors \
7107 --errors-to-stdout -? --help --usage' -- $cur));
7108 else
7109 COMPREPLY=($( pkg-config --list-all 2>/dev/null | awk '{print $1}' | grep "^$cur" ));
7110 fi
7111}
7112_pnames ()
7113{
7114 COMPREPLY=($( compgen -W '$( command ps axo command | \
7115 sed -e "1d; s/ .*//; s:.*/::; s/:$//;" \
7116 -e "s/^[[(-]//; s/[])]$//" \
7117 -e "s/^<defunct>$//")' -- $cur ))
7118}
7119_poff ()
7120{
7121 local prev cur conns;
7122 [ -r /etc/ppp/peers/ ] || return 0;
7123 COMPREPLY=();
7124 prev=${COMP_WORDS[COMP_CWORD-1]};
7125 cur=${COMP_WORDS[COMP_CWORD]};
7126 conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
7127 if [[ "$cur" == -* ]]; then
7128 COMPREPLY=($(compgen -W '-r -d -c -a -h -v' -- $cur));
7129 return 0;
7130 fi;
7131 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]]; then
7132 COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
7133 fi;
7134 return 0
7135}
7136_pon ()
7137{
7138 local cur conns;
7139 [ -r /etc/ppp/peers/ ] || return 0;
7140 COMPREPLY=();
7141 cur=${COMP_WORDS[COMP_CWORD]};
7142 conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
7143 if [ $COMP_CWORD -eq 1 ]; then
7144 COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
7145 fi;
7146 return 0
7147}
7148_povray ()
7149{
7150 local cur prev povcur pfx oext defoext;
7151 defoext=png;
7152 COMPREPLY=();
7153 povcur=`_get_cword`;
7154 prev=${COMP_WORDS[COMP_CWORD-1]};
7155 _expand || return 0;
7156 case $povcur in
7157 [-+]I*)
7158 cur="${povcur#[-+]I}";
7159 pfx="${povcur%"$cur"}";
7160 _filedir pov;
7161 COMPREPLY=(${COMPREPLY[@]/#/$pfx});
7162 return 0
7163 ;;
7164 [-+]O*)
7165 case $( ( IFS='
7166'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
7167 [-+]FN)
7168 oext=png
7169 ;;
7170 [-+]FP)
7171 oext=ppm
7172 ;;
7173 [-+]F[CT])
7174 oext=tga
7175 ;;
7176 *)
7177 oext=$defoext
7178 ;;
7179 esac;
7180 COMPREPLY=($( ( IFS='
7181'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ));
7182 COMPREPLY=(${COMPREPLY[@]#[-+]I});
7183 COMPREPLY=(${COMPREPLY[@]/%.pov/.$oext});
7184 cur="${povcur#[-+]O}";
7185 pfx="${povcur%"$cur"}";
7186 _filedir $oext;
7187 COMPREPLY=(${COMPREPLY[@]/#/$pfx});
7188 return 0
7189 ;;
7190 *.ini\[ | *.ini\[*[^]])
7191 cur="${povcur#*\[}";
7192 pfx="${povcur%\["$cur"}";
7193 [ -r "$pfx" ] || return 0;
7194 COMPREPLY=($(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' -e 't' -e 'd' -- "$pfx"));
7195 COMPREPLY=("${COMPREPLY[@]/#/$pfx[}");
7196 return 0
7197 ;;
7198 *)
7199 cur="$povcur";
7200 _filedir '?(ini|pov)';
7201 return 0
7202 ;;
7203 esac
7204}
7205_pvchange ()
7206{
7207 local cur prev;
7208 COMPREPLY=();
7209 cur=`_get_cword`;
7210 prev=${COMP_WORDS[COMP_CWORD-1]};
7211 case "$prev" in
7212 -@(A|x|-autobackup|--allocatable))
7213 COMPREPLY=($( compgen -W 'y n' -- $cur ));
7214 return 0
7215 ;;
7216 esac;
7217 if [[ "$cur" == -* ]]; then
7218 COMPREPLY=($( compgen -W '-a --all -A --autobackup \
7219 -d --debug -h --help -t --test -u --uuid -x \
7220 --allocatable -v --verbose --addtag --deltag \
7221 --version' -- $cur ));
7222 else
7223 _physicalvolumes;
7224 fi
7225}
7226_pvcreate ()
7227{
7228 local cur prev;
7229 COMPREPLY=();
7230 cur=`_get_cword`;
7231 prev=${COMP_WORDS[COMP_CWORD-1]};
7232 case "$prev" in
7233 --restorefile)
7234 _filedir;
7235 return 0
7236 ;;
7237 -@(M|-metadatatype))
7238 COMPREPLY=($( compgen -W '1 2' -- $cur ));
7239 return 0
7240 ;;
7241 --metadatacopies)
7242 COMPREPLY=($( compgen -W '0 1 2' -- $cur ));
7243 return 0
7244 ;;
7245 --@(metadatasize|setphysicalvolumesize))
7246 _sizes;
7247 return 0
7248 ;;
7249 esac;
7250 if [[ "$cur" == -* ]]; then
7251 COMPREPLY=($( compgen -W '--restorefile -d --debug -f \
7252 --force -h -? --help --labelsector -M --metadatatype \
7253 --metadatacopies --metadatasize \
7254 --setphysicalvolumesize -t --test -u --uuid uuid -v \
7255 --verbose -y --yes --version' -- $cur ));
7256 else
7257 _physicalvolumes;
7258 fi
7259}
7260_pvdisplay ()
7261{
7262 local cur prev;
7263 COMPREPLY=();
7264 cur=`_get_cword`;
7265 prev=${COMP_WORDS[COMP_CWORD-1]};
7266 case "$prev" in
7267 --units)
7268 _units;
7269 return 0
7270 ;;
7271 esac;
7272 if [[ "$cur" == -* ]]; then
7273 COMPREPLY=($( compgen -W '-c --colon -C --columns --units \
7274 -v --verbose -d --debug -h --help --version' -- $cur ));
7275 else
7276 _physicalvolumes;
7277 fi
7278}
7279_pvmove ()
7280{
7281 local cur prev;
7282 COMPREPLY=();
7283 cur=`_get_cword`;
7284 prev=${COMP_WORDS[COMP_CWORD-1]};
7285 case "$prev" in
7286 -@(A|-autobackup))
7287 COMPREPLY=($( compgen -W 'y n' -- $cur ));
7288 return 0
7289 ;;
7290 -@(n|-name))
7291 _logicalvolumes;
7292 return 0
7293 ;;
7294 esac;
7295 if [[ "$cur" == -* ]]; then
7296 COMPREPLY=($( compgen -W '--abort -A --autobackup \
7297 -b --background -d --debug -f --force -h -? \
7298 --help -i --interval -t --test -v --verbose \
7299 --version -n --name' -- $cur ));
7300 else
7301 _physicalvolumes;
7302 fi
7303}
7304_pvremove ()
7305{
7306 local cur;
7307 COMPREPLY=();
7308 cur=`_get_cword`;
7309 if [[ "$cur" == -* ]]; then
7310 COMPREPLY=($( compgen -W '-d --debug -f --force -h -? \
7311 --help -y --yes -t --test -v --verbose \
7312 --version' -- $cur ));
7313 else
7314 _physicalvolumes;
7315 fi
7316}
7317_pvs ()
7318{
7319 local cur prev;
7320 COMPREPLY=();
7321 cur=`_get_cword`;
7322 prev=${COMP_WORDS[COMP_CWORD-1]};
7323 case "$prev" in
7324 -@(o|O|-options|-sort))
7325 COMPREPLY=($( compgen -W 'pv_fmt pv_uuid \
7326 pv_size pv_free pv_used pv_name \
7327 pv_attr pv_pe_count \
7328 pv_pe_alloc_count' -- $cur ));
7329 return 0
7330 ;;
7331 --units)
7332 _units;
7333 return 0
7334 ;;
7335 esac;
7336 if [[ "$cur" == -* ]]; then
7337 COMPREPLY=($( compgen -W '--aligned -a --all -d --debug \
7338 -h -? --help --ignorelockingfailure --noheadings \
7339 --nosuffix -o --options -O --sort \
7340 --separator --unbuffered --units \
7341 -v --verbose --version' -- $cur ));
7342 else
7343 _physicalvolumes;
7344 fi
7345}
7346_pvscan ()
7347{
7348 local cur;
7349 COMPREPLY=();
7350 cur=`_get_cword`;
7351 if [[ "$cur" == -* ]]; then
7352 COMPREPLY=($( compgen -W '-d --debug -e \
7353 --exported -n --novolumegroup -h -? \
7354 --help --ignorelockingfailure -P \
7355 --partial -s --short -u --uuid -v \
7356 --verbose --version' -- $cur ));
7357 fi
7358}
7359_python ()
7360{
7361 local prev cur;
7362 COMPREPLY=();
7363 cur=`_get_cword`;
7364 prev=${COMP_WORDS[COMP_CWORD-1]##*/};
7365 case "$prev" in
7366 -Q)
7367 COMPREPLY=($( compgen -W "old new warn warnall" -- $cur ));
7368 return 0
7369 ;;
7370 -W)
7371 COMPREPLY=($( compgen -W "ignore default all module once error" -- $cur ));
7372 return 0
7373 ;;
7374 -c)
7375 _filedir '@(py|pyc|pyo)';
7376 return 0
7377 ;;
7378 !(python|-?))
7379 [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
7380 ;;
7381 esac;
7382 for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
7383 do
7384 if [[ ${COMP_WORDS[i]} == -c ]]; then
7385 _filedir;
7386 fi;
7387 done;
7388 if [[ "$cur" != -* ]]; then
7389 _filedir '@(py|pyc|pyo)';
7390 else
7391 COMPREPLY=($( compgen -W "- -d -E -h -i -O -Q -S -t -u -U -v -V -W -x -c" -- $cur ));
7392 fi;
7393 return 0
7394}
7395_qdbus ()
7396{
7397 local cur compstr;
7398 COMPREPLY=();
7399 cur=`_get_cword`;
7400 if [ -z "$cur" ]; then
7401 compstr=${COMP_WORDS[*]};
7402 else
7403 compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" );
7404 fi;
7405 COMPREPLY=($( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- "$cur" ))
7406}
7407_qemu ()
7408{
7409 local cur prev;
7410 COMPREPLY=();
7411 cur=`_get_cword`;
7412 prev=${COMP_WORDS[COMP_CWORD-1]};
7413 case $prev in
7414 -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm))
7415 _filedir;
7416 return 0
7417 ;;
7418 -@(tftp|smb|L))
7419 _filedir -d;
7420 return 0
7421 ;;
7422 -boot)
7423 COMPREPLY=($( compgen -W 'a c d n' -- $cur ));
7424 return 0
7425 ;;
7426 -k)
7427 COMPREPLY=($( compgen -W 'ar de-ch es fo fr-ca hu ja \
7428 mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\
7429 ru th de en-us fi fr-be hr it lv nl-be pt sl \
7430 tr' -- $cur ));
7431 return 0
7432 ;;
7433 -soundhw)
7434 COMPREPLY=($( compgen -W "$( qemu -soundhw ? | awk '/^[[:lower:]]/ {print $1}' ) all" -- $cur ));
7435 return 0
7436 ;;
7437 -M)
7438 COMPREPLY=($( compgen -W "$( qemu -M ? | awk '/^[[:lower:]]/ {print $1}' )" -- $cur ));
7439 return 0
7440 ;;
7441 -cpu)
7442 COMPREPLY=($( compgen -W "$( qemu -cpu ? | awk '{print $2}' )" -- $cur ));
7443 return 0
7444 ;;
7445 -usbdevice)
7446 COMPREPLY=($( compgen -W 'mouse tablet disk: host: \
7447 serial: braille net' -- $cur ));
7448 return 0
7449 ;;
7450 -net)
7451 COMPREPLY=($( compgen -W 'nic user tap socket vde none' -- $cur ));
7452 return 0
7453 ;;
7454 -@(serial|parallel|monitor))
7455 COMPREPLY=($( compgen -W 'vc pty none null /dev/ \
7456 file: stdio pipe: COM udp: tcp: telnet: unix: \
7457 mon: braille' -- $cur ));
7458 return 0
7459 ;;
7460 -redir)
7461 COMPREPLY=($( compgen -S":" -W 'tcp udp' -- $cur ));
7462 return 0
7463 ;;
7464 -bt)
7465 COMPREPLY=($( compgen -W 'hci vhci device' -- $cur ));
7466 return 0
7467 ;;
7468 -vga)
7469 COMPREPLY=($( compgen -W 'cirrus std vmware' -- $cur ));
7470 return 0
7471 ;;
7472 -drive)
7473 COMPREPLY=($( compgen -S"=" -W 'file if bus index media \
7474 cyls snapshot cache format' -- $cur ));
7475 return 0
7476 ;;
7477 esac;
7478 if [[ "$cur" == -* ]]; then
7479 COMPREPLY=($( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \
7480 -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \
7481 -k -audio-help -soundhw -localtime -full-screen -pidfile \
7482 -daemonize -win2k-hacks -option-rom -usb -usbdevice -net -tftp \
7483 -smb -redir -kernel -append -initrd -serial -parallel -monitor \
7484 -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \
7485 -semihosting -cpu -bt -vga -drive -startdate -name -curses \
7486 -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \
7487 -prom-env' -- $cur ));
7488 else
7489 _filedir;
7490 fi
7491}
7492_qrunner ()
7493{
7494 local cur;
7495 COMPREPLY=();
7496 cur=`_get_cword`;
7497 if [[ "$cur" == -* ]]; then
7498 COMPREPLY=($( compgen -W '-r --runner= --once -o \
7499 -l --list -v --verbose -s --subproc -h --help' -- $cur ));
7500 fi
7501}
7502_rake ()
7503{
7504 local cur prev rakef i;
7505 COMPREPLY=();
7506 cur=${COMP_WORDS[COMP_CWORD]};
7507 prev=${COMP_WORDS[COMP_CWORD-1]};
7508 rakef="Rakefile";
7509 if [[ "$prev" == "-f" ]]; then
7510 _filedir;
7511 return 0;
7512 fi;
7513 if [[ "$cur" == *=* ]]; then
7514 prev=${cur/=*/};
7515 cur=${cur/*=/};
7516 if [[ "$prev" == "--rakefile=" ]]; then
7517 _filedir -o nospace;
7518 return 0;
7519 fi;
7520 fi;
7521 if [[ "$cur" == -* ]]; then
7522 COMPREPLY=($( compgen -W '-n -H -I -N -P -q -f\
7523 -r -s -T -t -h -v -V\
7524 --dry-run --help '--libdir=' --nosearch --prereqs --quiet\
7525 '--rakefile=' '--require=' --silent --tasks --trace --usage\
7526 --verbose --version' -- $cur ));
7527 else
7528 for ((i=0; i < ${#COMP_WORDS[@]}; i++))
7529 do
7530 case "${COMP_WORDS[i]}" in
7531 -f)
7532 eval rakef=${COMP_WORDS[i+1]};
7533 break
7534 ;;
7535 --rakefile=* | --rakefile\=*)
7536 eval rakef=${COMP_WORDS[i]/*=/};
7537 break
7538 ;;
7539 esac;
7540 done;
7541 [ ! -f $rakef ] && return 0;
7542 COMPREPLY=($( rake -s -f "$rakef" -T | awk -F ' ' '/^rake / { print $2 }' | command grep "^$cur" ));
7543 fi
7544}
7545_rdesktop ()
7546{
7547 local cur prev;
7548 COMPREPLY=();
7549 cur=`_get_cword`;
7550 prev=${COMP_WORDS[COMP_CWORD-1]};
7551 case $prev in
7552 -k)
7553 COMPREPLY=($( command ls /usr/share/rdesktop/keymaps 2>/dev/null | egrep -v '(common|modifiers)' ));
7554 COMPREPLY=(${COMPREPLY[@]:-} $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ));
7555 COMPREPLY=(${COMPREPLY[@]:-} $( command ls ./keymaps 2>/dev/null ));
7556 COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur ));
7557 return 0
7558 ;;
7559 -a)
7560 COMPREPLY=($( compgen -W '8 15 16 24' -- $cur ));
7561 return 0
7562 ;;
7563 -x)
7564 COMPREPLY=($( compgen -W 'b broadband m modem l lan' -- $cur ));
7565 return 0
7566 ;;
7567 -r)
7568 COMPREPLY=($( compgen -W 'comport: disk: lptport: \
7569 printer: sound: lspci scard' -- $cur ));
7570 return 0
7571 ;;
7572 esac;
7573 if [[ "$cur" == -* ]]; then
7574 COMPREPLY=($( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
7575 -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
7576 -0 -4 -5' -- $cur ));
7577 else
7578 _known_hosts;
7579 fi
7580}
7581_realcommand ()
7582{
7583 type -P "$1" > /dev/null && {
7584 if type -p realpath > /dev/null; then
7585 realpath "$(type -P "$1")";
7586 else
7587 if type -p readlink > /dev/null; then
7588 readlink -f "$(type -P "$1")";
7589 else
7590 type -P "$1";
7591 fi;
7592 fi
7593 }
7594}
7595_remove_members ()
7596{
7597 local cur prev;
7598 COMPREPLY=();
7599 cur=`_get_cword`;
7600 prev=${COMP_WORDS[COMP_CWORD-1]};
7601 case "$prev" in
7602 -@(f|-file=))
7603 _filedir;
7604 return 0
7605 ;;
7606 esac;
7607 if [[ "$cur" == -* ]]; then
7608 COMPREPLY=($( compgen -W '--file= -f --all -a \
7609 --fromall --nouserack -n --noadminack -N \
7610 --help -h' -- $cur ));
7611 else
7612 _mailman_lists;
7613 fi
7614}
7615_renice ()
7616{
7617 local command cur curopt i;
7618 COMPREPLY=();
7619 cur=`_get_cword`;
7620 command=$1;
7621 i=0;
7622 while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
7623 curopt=${COMP_WORDS[COMP_CWORD-$i]};
7624 case "$curopt" in
7625 -u)
7626 COMPREPLY=($( compgen -u -- $cur ))
7627 ;;
7628 -g)
7629 _pgids
7630 ;;
7631 -p | $command)
7632 _pids
7633 ;;
7634 esac;
7635 i=$(( ++i ));
7636 done
7637}
7638_ri ()
7639{
7640 local cur class method prefix ri_path ri_version separator IFS;
7641 local -a classes;
7642 COMPREPLY=();
7643 cur=`_get_cword`;
7644 ri_path=$(type -p ri);
7645 ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated;
7646 [ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated;
7647 IFS=',
7648 ';
7649 if [[ "$cur" == [A-Z]*[#.]* ]]; then
7650 [[ "$cur" == *#* ]] && separator=# || separator=.;
7651 class=${cur%$separator*};
7652 method=${cur#*$separator};
7653 classes=($class);
7654 prefix="-P $class$separator";
7655 ri_get_methods;
7656 return 0;
7657 fi;
7658 if [ "$ri_version" = integrated ]; then
7659 classes=($( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
7660 if /, [A-Z]+/ then print; end; end' ));
7661 else
7662 if [ "$ri_version" = "ri 1.8a" ]; then
7663 classes=($( ruby -W0 $ri_path | ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
7664 if /^ .*[A-Z]/ then print; end; end' ));
7665 else
7666 classes=($( ruby -W0 $ri_path | ruby -ne 'if /^I have/..$stdin.eof then \
7667 if /^ .*[A-Z]/ then print; end; end' ));
7668 fi;
7669 fi;
7670 COMPREPLY=($( compgen -W '${classes[@]}' -- $cur ));
7671 if [[ "$cur" == [A-Z]* ]]; then
7672 return 0;
7673 fi;
7674 method=$cur;
7675 ri_get_methods
7676}
7677_rl_enabled ()
7678{
7679 [[ "$( bind -v )" = *$1+([[:space:]])on* ]]
7680}
7681_rmlist ()
7682{
7683 local cur;
7684 COMPREPLY=();
7685 cur=`_get_cword`;
7686 if [[ "$cur" == -* ]]; then
7687 COMPREPLY=($( compgen -W '--archives -a \
7688 -h --help' -- $cur ));
7689 else
7690 _mailman_lists;
7691 fi
7692}
7693_rmmod ()
7694{
7695 local cur;
7696 COMPREPLY=();
7697 cur=`_get_cword`;
7698 _installed_modules "$cur";
7699 return 0
7700}
7701_root_command ()
7702{
7703 PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
7704}
7705_route ()
7706{
7707 local cur prev;
7708 COMPREPLY=();
7709 cur=`_get_cword`;
7710 prev=${COMP_WORDS[COMP_CWORD-1]};
7711 if [ "$prev" = dev ]; then
7712 COMPREPLY=($( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ));
7713 return 0;
7714 fi;
7715 COMPREPLY=($( compgen -W 'add del -host -net netmask metric mss \
7716 window irtt reject mod dyn reinstate dev \
7717 default gw' -- $cur ));
7718 COMPREPLY=($( echo " ${COMP_WORDS[@]}" | (while read -d ' ' i; do
7719 [ "$i" == "" ] && continue
7720 # flatten array with spaces on either side,
7721 # otherwise we cannot grep on word
7722 # boundaries of first and last word
7723 COMPREPLY=" ${COMPREPLY[@]} "
7724 # remove word from list of completions
7725 COMPREPLY=( ${COMPREPLY/ $i / } )
7726 done
7727 echo "${COMPREPLY[@]}")
7728 ));
7729 return 0
7730}
7731_rsync ()
7732{
7733 local cur prev shell i userhost path;
7734 COMPREPLY=();
7735 cur=`_get_cword`;
7736 prev=${COMP_WORDS[COMP_CWORD-1]};
7737 _expand || return 0;
7738 case "$prev" in
7739 --@(config|password-file|include-from|exclude-from))
7740 _filedir;
7741 return 0
7742 ;;
7743 -@(T|-temp-dir|-compare-dest))
7744 _filedir -d;
7745 return 0
7746 ;;
7747 -@(e|-rsh))
7748 COMPREPLY=($( compgen -W 'rsh ssh' -- $cur ));
7749 return 0
7750 ;;
7751 esac;
7752 case "$cur" in
7753 -*)
7754 COMPREPLY=($( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
7755 -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
7756 -z -h -4 -6 --verbose --quiet --checksum \
7757 --archive --recursive --relative --backup \
7758 --backup-dir --suffix= --update --links \
7759 --copy-links --copy-unsafe-links --safe-links \
7760 --hard-links --perms --owner --group --devices\
7761 --times --sparse --dry-run --whole-file \
7762 --no-whole-file --one-file-system \
7763 --block-size= --rsh= --rsync-path= \
7764 --cvs-exclude --existing --ignore-existing \
7765 --delete --delete-excluded --delete-after \
7766 --ignore-errors --max-delete= --partial \
7767 --force --numeric-ids --timeout= \
7768 --ignore-times --size-only --modify-window= \
7769 --temp-dir= --compare-dest= --compress \
7770 --exclude= --exclude-from= --include= \
7771 --include-from= --version --daemon --no-detach\
7772 --address= --config= --port= --blocking-io \
7773 --no-blocking-io --stats --progress \
7774 --log-format= --password-file= --bwlimit= \
7775 --write-batch= --read-batch= --help' -- $cur ))
7776 ;;
7777 *:*)
7778 shell=ssh;
7779 for ((i=1; i < COMP_CWORD; i++ ))
7780 do
7781 if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
7782 shell=${COMP_WORDS[i+1]};
7783 break;
7784 fi;
7785 done;
7786 if [[ "$shell" == ssh ]]; then
7787 cur=${cur/\\:/:};
7788 userhost=${cur%%?(\\):*};
7789 path=${cur#*:};
7790 path=${path//\\\\\\\\ / };
7791 if [ -z "$path" ]; then
7792 path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null);
7793 fi;
7794 COMPREPLY=($( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ));
7795 fi
7796 ;;
7797 *)
7798 _known_hosts -c -a;
7799 _filedir
7800 ;;
7801 esac;
7802 return 0
7803}
7804_sbcl ()
7805{
7806 local cur;
7807 COMPREPLY=();
7808 cur=`_get_cword`;
7809 if [[ "$cur" == -* ]]; then
7810 COMPREPLY=($( compgen -W '--core --noinform --help --version \
7811 --sysinit --userinit --eval --noprint --disable-debugger \
7812 --end-runtime-options --end-toplevel-options ' -- $cur ));
7813 else
7814 _filedir;
7815 fi;
7816 return 0
7817}
7818_scp ()
7819{
7820 local cur userhost path;
7821 local optconfigfile;
7822 COMPREPLY=();
7823 cur=`_get_cword ":"`;
7824 _expand || return 0;
7825 if [[ "$cur" == *:* ]]; then
7826 local IFS='
7827';
7828 cur=${cur/\\:/:};
7829 userhost=${cur%%?(\\):*};
7830 path=${cur#*:};
7831 path=${path//\\\\\\\\ / };
7832 if [ -z "$path" ]; then
7833 path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null);
7834 fi;
7835 COMPREPLY=($( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ));
7836 return 0;
7837 fi;
7838 set -- "${COMP_WORDS[@]}";
7839 while [ $# -gt 0 ]; do
7840 if [ "${1:0:2}" = -F ]; then
7841 if [ ${#1} -gt 2 ]; then
7842 optconfigfile="$(dequote "$1")";
7843 else
7844 shift;
7845 [ "$1" ] && optconfigfile="$(dequote "-F$1")";
7846 fi;
7847 break;
7848 fi;
7849 shift;
7850 done;
7851 [[ "$cur" == */* ]] || _known_hosts -c -a "$optconfigfile";
7852 local IFS='
7853';
7854 COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ));
7855 return 0
7856}
7857_screen ()
7858{
7859 local cur prev preprev;
7860 COMPREPLY=();
7861 cur=`_get_cword`;
7862 prev=${COMP_WORDS[COMP_CWORD-1]};
7863 [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]};
7864 if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o "$prev" = "-R" ]; then
7865 COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*$|\1|p' ));
7866 else
7867 case "$prev" in
7868 -[rR])
7869 COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*Detached.*$|\1|p' ))
7870 ;;
7871 -[dDx])
7872 COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*Attached.*$|\1|p' ))
7873 ;;
7874 -s)
7875 COMPREPLY=($( grep ^${cur:-[^#]} /etc/shells ))
7876 ;;
7877 *)
7878
7879 ;;
7880 esac;
7881 fi;
7882 return 0
7883}
7884_service ()
7885{
7886 local cur sysvdir;
7887 COMPREPLY=();
7888 prev=${COMP_WORDS[COMP_CWORD-1]};
7889 cur=`_get_cword`;
7890 [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0;
7891 [ $COMP_CWORD -gt 2 ] && return 0;
7892 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
7893 if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
7894 _services;
7895 else
7896 COMPREPLY=($( compgen -W '`sed -ne "y/|/ /; \
7897 s/^.*Usage.*{\(.*\)}.*$/\1/p" \
7898 $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ));
7899 fi;
7900 return 0
7901}
7902_services ()
7903{
7904 local sysvdir famdir;
7905 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
7906 famdir=/etc/xinetd.d;
7907 COMPREPLY=($( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)));
7908 if [ -d $famdir ]; then
7909 COMPREPLY=("${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)));
7910 fi;
7911 COMPREPLY=($( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ))
7912}
7913_signals ()
7914{
7915 local i;
7916 COMPREPLY=($( compgen -A signal SIG${cur#-} ));
7917 for ((i=0; i < ${#COMPREPLY[@]}; i++ ))
7918 do
7919 COMPREPLY[i]=-${COMPREPLY[i]#SIG};
7920 done
7921}
7922_sitecopy ()
7923{
7924 local cur;
7925 COMPREPLY=();
7926 cur=`_get_cword`;
7927 case "$cur" in
7928 --*)
7929 COMPREPLY=($( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ))
7930 ;;
7931 -*)
7932 COMPREPLY=($( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- $cur ))
7933 ;;
7934 *)
7935 if [ -r ~/.sitecopyrc ]; then
7936 COMPREPLY=($( compgen -W "$(grep '^["$'\t '"]*site' ~/.sitecopyrc | awk '{print $2}')" -- $cur ));
7937 fi
7938 ;;
7939 esac;
7940 return 0
7941}
7942_sizes ()
7943{
7944 COMPREPLY=($( compgen -W 'k K m M g G t T' -- $cur ))
7945}
7946_snarf ()
7947{
7948 local cur;
7949 COMPREPLY=();
7950 cur=`_get_cword`;
7951 prev=${COMP_WORDS[COMP_CWORD-1]};
7952 case "$prev" in
7953 -i)
7954 _interfaces;
7955 return 0
7956 ;;
7957 esac;
7958 if [[ "$cur" == -* ]]; then
7959 COMPREPLY=($( compgen -W '-i -v' -- $cur ));
7960 fi
7961}
7962_snownews ()
7963{
7964 local cur;
7965 COMPREPLY=();
7966 cur=`_get_cword`;
7967 if [[ "$cur" == -* ]]; then
7968 COMPREPLY=($( compgen -W '--update --help --version \
7969 --disable-versioncheck -u -h -V' -- $cur));
7970 fi
7971}
7972_ssh ()
7973{
7974 local cur prev;
7975 local optconfigfile;
7976 local -a config;
7977 COMPREPLY=();
7978 cur=`_get_cword`;
7979 prev=${COMP_WORDS[COMP_CWORD-1]};
7980 case "$prev" in
7981 -F)
7982 _filedir
7983 ;;
7984 -*c)
7985 COMPREPLY=($( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
7986 arcfour cast128-cbc' -- $cur ))
7987 ;;
7988 -*i)
7989 _filedir
7990 ;;
7991 -*l)
7992 COMPREPLY=($( compgen -u -- $cur ))
7993 ;;
7994 *)
7995 set -- "${COMP_WORDS[@]}";
7996 while [ $# -gt 0 ]; do
7997 if [ "${1:0:2}" = -F ]; then
7998 if [ ${#1} -gt 2 ]; then
7999 optconfigfile="$(dequote "$1")";
8000 else
8001 shift;
8002 [ "$1" ] && optconfigfile="$(dequote "-F$1")";
8003 fi;
8004 break;
8005 fi;
8006 shift;
8007 done;
8008 _known_hosts -a "$optconfigfile";
8009 [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || COMPREPLY=("${COMPREPLY[@]}" $( compgen -c -- $cur ))
8010 ;;
8011 esac;
8012 return 0
8013}
8014_ssh_copy_id ()
8015{
8016 local cur prev;
8017 COMPREPLY=();
8018 cur=`_get_cword`;
8019 prev=${COMP_WORDS[COMP_CWORD-1]};
8020 case "$prev" in
8021 -*i)
8022 _filedir
8023 ;;
8024 *)
8025 _known_hosts -a;
8026 [ $COMP_CWORD -eq 1 ] || COMPREPLY=("${COMPREPLY[@]}" $( compgen -- $cur ))
8027 ;;
8028 esac;
8029 return 0
8030}
8031_sshmitm ()
8032{
8033 local cur;
8034 COMPREPLY=();
8035 cur=`_get_cword`;
8036 if [[ "$cur" == -* ]]; then
8037 COMPREPLY=($( compgen -W '-d -I -p' -- $cur ));
8038 else
8039 _known_hosts;
8040 fi
8041}
8042_sshow ()
8043{
8044 local cur;
8045 COMPREPLY=();
8046 cur=`_get_cword`;
8047 prev=${COMP_WORDS[COMP_CWORD-1]};
8048 case "$prev" in
8049 -i)
8050 _interfaces;
8051 return 0
8052 ;;
8053 esac;
8054 if [[ "$cur" == -* ]]; then
8055 COMPREPLY=($( compgen -W '-d -i' -- $cur ));
8056 fi
8057}
8058_subdirectories ()
8059{
8060 COMPREPLY=($( cd $1 && compgen -d -- "$cur" ))
8061}
8062_svk ()
8063{
8064 local cur prev commands options command;
8065 COMPREPLY=();
8066 cur=`_get_cword`;
8067 commands='add admin annotate ann blame praise cat checkout co cleanup \
8068 cmerge cm commit ci copy cp delete del remove rm depotmap \
8069 depot describe desc diff di help h ? import info list ls log \
8070 merge mirror mi mkdir move mv ren rename patch propdel pd pdel \
8071 propedit pe pedit propget pg pget proplist pl plist propset ps \
8072 pset pull push resolved revert smerge sm status st stat switch \
8073 sw sync sy update up verify';
8074 if [[ $COMP_CWORD -eq 1 ]]; then
8075 if [[ "$cur" == -* ]]; then
8076 COMPREPLY=($( compgen -W '--version' -- $cur ));
8077 else
8078 COMPREPLY=($( compgen -W "$commands" -- $cur ));
8079 fi;
8080 else
8081 prev=${COMP_WORDS[COMP_CWORD-1]};
8082 case $prev in
8083 -@(F|-file|-targets))
8084 _filedir;
8085 return 0
8086 ;;
8087 --encoding)
8088 COMPREPLY=($( compgen -W '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ));
8089 return 0
8090 ;;
8091 esac;
8092 command=${COMP_WORDS[1]};
8093 if [[ "$cur" == -* ]]; then
8094 case $command in
8095 add)
8096 options=' --non-recursive -N -q --quiet'
8097 ;;
8098 @(blame|annotate|ann|praise))
8099 options='-r --revisions -x --cross'
8100 ;;
8101 cat)
8102 options='-r --revision'
8103 ;;
8104 @(checkout|co))
8105 options='-r --revision -q --quiet -N \
8106 --non-recursive -l --list -d \
8107 --detach --export --relocate \
8108 --purge'
8109 ;;
8110 cleanup)
8111 options='-a --all'
8112 ;;
8113 @(cmerge|cm))
8114 options='-c --change -l --log -r \
8115 --revision -a --auto \
8116 --verbatim --no-ticket -m \
8117 --message -F --file --template \ --encoding -P --patch -S \
8118 --sign -C --check-only --direct'
8119 ;;
8120 @(commit|ci))
8121 options='--import -m --message -F \
8122 --file --encoding --template \
8123 -P --patch -S --sign -C \
8124 --check-only -N \
8125 --non-recursive --direct'
8126 ;;
8127 @(copy|cp))
8128 options='-r --revision -p --parent -q \
8129 --quiet -m --message -F --file \
8130 --template --encoding -P \
8131 --patch -S --sign -C \
8132 --check-only --direct'
8133 ;;
8134 @(delete|del|remove|rm))
8135 options='-k --keep-local -m --message \
8136 -F --file --encoding \
8137 --template -P --patch -S \
8138 --sign -C --check-only --direct'
8139 ;;
8140 @(depotmap|depot))
8141 options='-i --init -l --list -d \
8142 --detach --relocate'
8143 ;;
8144 @(diff|di))
8145 options='-r --revision -s --summarize \
8146 -b --verbose -N --non-recursive'
8147 ;;
8148 import)
8149 options='-f --from-checkout -t \
8150 --to-checkout -m --message -F \
8151 --file --template --encoding \
8152 -P --patch -S --sign -C \
8153 --check-only -N \
8154 --non-recursive --direct'
8155 ;;
8156 @(list|ls))
8157 options='-r --revision -v --verbose -R \
8158 --recursive -d --depth -f \
8159 --full-path'
8160 ;;
8161 log)
8162 options='-r --revision -l --limit -q \
8163 --quiet -x --cross -v --verbose'
8164 ;;
8165 merge)
8166 options='-r --revision -c --change -I \
8167 --incremental -a --auto -l \
8168 --log -s --sync -t --to -f \
8169 --from --verbatim --no-ticket \
8170 --track-rename -m --message \
8171 -F --file --template \
8172 --encoding -P --patch -S \
8173 --sign -C --check-only --direct'
8174 ;;
8175 @(mirror|mi))
8176 options='-l --list -d --detach \
8177 --relocate --recover --unlock \
8178 --upgrade'
8179 ;;
8180 mkdir)
8181 options='-p --parent -m --message -F \
8182 --file --template --encoding \
8183 -P --patch -S --sign -C \
8184 --check-only --direct'
8185 ;;
8186 @(move|mv|rename|ren))
8187 options='-r --revision -p --parent -q \
8188 --quiet -m --message -F --file \
8189 --encoding --template -P \
8190 --patch -S --sign -C \
8191 --check-only --direct'
8192 ;;
8193 patch)
8194 options='--depot'
8195 ;;
8196 @(propdel|propset|pdel|pset|pd|ps))
8197 options='-R --recursive -r --revision \
8198 --revprop -m --message -F \
8199 --file --template --encoding \
8200 -P --patch -S --sign -C \
8201 --check-only -q --quiet \
8202 --direct'
8203 ;;
8204 @(propedit|pedit|pe))
8205 options='-R --recursive -r --revision \
8206 --revprop -m --message -F \
8207 --file --template --encoding \
8208 -P --patch -S --sign -C \
8209 --check-only --direct'
8210 ;;
8211 @(propget|pget|pg))
8212 options='-R --recursive -r --revision \
8213 --revprop --strict'
8214 ;;
8215 @(proplist|plist|pl))
8216 options='-R --recursive -v --verbose \
8217 -r --revision --revprop'
8218 ;;
8219 pull)
8220 options='-a --all -l --lump'
8221 ;;
8222 push)
8223 options='-f --from -l --lump -C \
8224 --check -P --patch -S --sign \
8225 --verbatim'
8226 ;;
8227 resolved)
8228 options='-R --recursive'
8229 ;;
8230 revert)
8231 options='-R --recursive -q --quiet'
8232 ;;
8233 @(smerge|sm))
8234 options='-I --incremental -l --log -B \
8235 --baseless -b --base -s --sync \
8236 -t --to -f --from --verbatim \
8237 --no-ticket --track-rename \
8238 --host --remoterev -m \
8239 --message -F --file --template \
8240 --encoding -P --patch -S \
8241 --sign -C --check-only --direct'
8242 ;;
8243 @(status|stat|st))
8244 options='-q --quiet --no-ignore -N \
8245 --non-recursive -v --verbose'
8246 ;;
8247 @(switch|sw))
8248 options='-r --revision -d --detach -q \
8249 --quiet'
8250 ;;
8251 @(sync|sy))
8252 options='-a --all -s --skipto -t \
8253 --torev'
8254 ;;
8255 @(update|up))
8256 options='-r --revision -N \
8257 --non-recursive -C \
8258 --check-only -s --sync -m \
8259 --merge -q --quiet'
8260 ;;
8261 esac;
8262 options="$options --help -h";
8263 COMPREPLY=($( compgen -W "$options" -- $cur ));
8264 else
8265 case $command in
8266 @(help|h|\?))
8267 COMPREPLY=($( compgen -W "$commands environment commands intro" -- $cur ))
8268 ;;
8269 admin)
8270 COMPREPLY=($( compgen -W 'help \
8271 deltify dump hotcopy \
8272 list-dblogs list-unused-dblogs \
8273 load lstxns recover rmtxns \
8274 setlog verify rmcache' -- $cur ))
8275 ;;
8276 patch)
8277 COMPREPLY=($( compgen -W '--ls --list \
8278 --cat --view --regen \
8279 --regenerate --up --update \
8280 --apply --rm --delete' -- $cur ))
8281 ;;
8282 sync)
8283 COMPREPLY=($( compgen -W "$( svk mirror --list 2>/dev/null | awk '/^\//{print $1}' )" -- $cur ))
8284 ;;
8285 @(co|checkout|push|pull))
8286 if [[ "$cur" == //*/* ]]; then
8287 path=${cur%/*}/;
8288 else
8289 path=//;
8290 fi;
8291 COMPREPLY=($( compgen -W "$( svk list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ))
8292 ;;
8293 *)
8294 _filedir
8295 ;;
8296 esac;
8297 fi;
8298 fi;
8299 return 0
8300}
8301_sync_members ()
8302{
8303 local cur prev;
8304 COMPREPLY=();
8305 cur=`_get_cword`;
8306 prev=${COMP_WORDS[COMP_CWORD-1]};
8307 case "$prev" in
8308 -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
8309 COMPREPLY=($( compgen -W 'y n' -- $cur));
8310 return 0
8311 ;;
8312 -@(d|-file))
8313 _filedir;
8314 return 0
8315 ;;
8316 esac;
8317 if [[ "$cur" == -* ]]; then
8318 COMPREPLY=($( compgen -W '--no-change -n --welcome-msg= -w \
8319 --goodbye-msg= -g --digest= -d --notifyadmin= -a \
8320 -f --file -h --help' -- $cur ));
8321 else
8322 _mailman_lists;
8323 fi
8324}
8325_sysctl ()
8326{
8327 local cur;
8328 COMPREPLY=();
8329 cur=`_get_cword`;
8330 COMPREPLY=($( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ));
8331 return 0
8332}
8333_tar ()
8334{
8335 local cur ext regex tar untar;
8336 COMPREPLY=();
8337 cur=`_get_cword`;
8338 if [ $COMP_CWORD -eq 1 ]; then
8339 COMPREPLY=($( compgen -W 'c t x u r d A' -- $cur ));
8340 return 0;
8341 fi;
8342 case "${COMP_WORDS[1]}" in
8343 ?(-)[cr]*f)
8344 _filedir;
8345 return 0
8346 ;;
8347 +([^IZzJjy])f)
8348 ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))';
8349 regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\)\)\?\|gz\|bz2\?\|lzma\)'
8350 ;;
8351 *[Zz]*f)
8352 ext='t?(ar.)@(gz|Z)';
8353 regex='t\(ar\.\)\?\(gz\|Z\)'
8354 ;;
8355 *[Ijy]*f)
8356 ext='t?(ar.)bz?(2)';
8357 regex='t\(ar\.\)\?bz2\?'
8358 ;;
8359 *[J]*f)
8360 ext='t?(ar.)lz?(ma)';
8361 regex='t\(ar\.\)\?lzma\?'
8362 ;;
8363 *)
8364 _filedir;
8365 return 0
8366 ;;
8367 esac;
8368 if [[ "$COMP_LINE" == *$ext' ' ]]; then
8369 tar=$( echo "$COMP_LINE" | sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' );
8370 untar=t${COMP_WORDS[1]//[^Izjyf]/};
8371 COMPREPLY=($( compgen -W "$( echo $( tar $untar $tar 2>/dev/null ) )" -- "$cur" ));
8372 return 0;
8373 fi;
8374 _filedir "$ext";
8375 return 0
8376}
8377_tcpdump ()
8378{
8379 local cur;
8380 COMPREPLY=();
8381 cur=`_get_cword`;
8382 prev=${COMP_WORDS[COMP_CWORD-1]};
8383 case "$prev" in
8384 -@(r|w|F))
8385 _filedir;
8386 return 0
8387 ;;
8388 -i)
8389 _available_interfaces -a;
8390 return 0
8391 ;;
8392 esac;
8393 if [[ "$cur" == -* ]]; then
8394 COMPREPLY=($( compgen -W '-a -d -e -f -l -n -N -O -p \
8395 -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
8396 -E' -- $cur ));
8397 fi
8398}
8399_tcpkill ()
8400{
8401 local cur;
8402 COMPREPLY=();
8403 cur=`_get_cword`;
8404 prev=${COMP_WORDS[COMP_CWORD-1]};
8405 case "$prev" in
8406 -i)
8407 _interfaces;
8408 return 0
8409 ;;
8410 esac;
8411 if [[ "$cur" == -* ]]; then
8412 COMPREPLY=($( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- $cur ));
8413 fi
8414}
8415_tcpnice ()
8416{
8417 local cur;
8418 COMPREPLY=();
8419 cur=`_get_cword`;
8420 prev=${COMP_WORDS[COMP_CWORD-1]};
8421 case "$prev" in
8422 -i)
8423 _interfaces;
8424 return 0
8425 ;;
8426 esac;
8427 if [[ "$cur" == -* ]]; then
8428 COMPREPLY=($( compgen -W '-A -I -M -i' -- $cur ));
8429 fi
8430}
8431_tightvncviewer ()
8432{
8433 local cur prev;
8434 COMPREPLY=();
8435 cur=`_get_cword`;
8436 prev=${COMP_WORDS[COMP_CWORD-1]};
8437 case $prev in
8438 -passwd)
8439 _filedir;
8440 return 0
8441 ;;
8442 -encodings)
8443 COMPREPLY=($( compgen -W 'copyrect tight hextile zlib \
8444 corre rre raw' -- $cur ));
8445 return 0
8446 ;;
8447 -via)
8448 _known_hosts;
8449 return 0
8450 ;;
8451 esac;
8452 if [[ "$cur" == -* ]]; then
8453 COMPREPLY=($( compgen -W '-help -listen -via -shared -noshared\
8454 -viewonly -fullscreen -noraiseonbeep -passwd -encodings\
8455 -bgr233 -owncmap -truecolour -truecolor -depth \
8456 -compresslevel -quality -nojpeg -nocursorshape \
8457 -x11cursor' -- $cur ));
8458 else
8459 _known_hosts;
8460 fi
8461}
8462_ufw ()
8463{
8464 cur=${COMP_WORDS[COMP_CWORD]};
8465 prev=${COMP_WORDS[COMP_CWORD-1]};
8466 if [ $COMP_CWORD -eq 1 ]; then
8467 COMPREPLY=($( compgen -W "$(_ufw_commands)" $cur ));
8468 else
8469 if [ $COMP_CWORD -eq 2 ]; then
8470 case "$prev" in
8471 app)
8472 COMPREPLY=($( compgen -W "$(_ufw_app_commands)" $cur ))
8473 ;;
8474 status)
8475 COMPREPLY=($( compgen -W "$(_ufw_status_commands)" $cur ))
8476 ;;
8477 delete)
8478 COMPREPLY=($( compgen -W "$(_ufw_rule_commands)" $cur ))
8479 ;;
8480 logging)
8481 COMPREPLY=($( compgen -W "$(_ufw_logging_commands)" $cur ))
8482 ;;
8483 show)
8484 COMPREPLY=($( compgen -W "$(_ufw_show_commands)" $cur ))
8485 ;;
8486 default)
8487 COMPREPLY=($( compgen -W "$(_ufw_default_commands)" $cur ))
8488 ;;
8489 esac;
8490 fi;
8491 fi
8492}
8493_ufw_app_commands ()
8494{
8495 ufw --help | sed -e '1,/^Application profile commands:/d' -e '/^ [^ ]/!d' -e 's/[ \t]\+app[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g'
8496}
8497_ufw_commands ()
8498{
8499 commands=$(ufw --help | sed -e '1,/^Commands:/d' -e '/^Application profile commands:/Q' -e 's/^[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g' -e 's/|/ /g' | uniq);
8500 echo "$commands app"
8501}
8502_ufw_default_commands ()
8503{
8504 echo "allow deny reject"
8505}
8506_ufw_logging_commands ()
8507{
8508 echo "off on low medium high full"
8509}
8510_ufw_rule_commands ()
8511{
8512 echo "`_ufw_default_commands` limit"
8513}
8514_ufw_show_commands ()
8515{
8516 echo "raw"
8517}
8518_ufw_status_commands ()
8519{
8520 echo "numbered verbose"
8521}
8522_uids ()
8523{
8524 if type getent &>/dev/null; then
8525 COMPREPLY=($( getent passwd | awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ));
8526 else
8527 if type perl &>/dev/null; then
8528 COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ));
8529 else
8530 COMPREPLY=($( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}' /etc/passwd ));
8531 fi;
8532 fi
8533}
8534_umount ()
8535{
8536 local cur IFS='
8537';
8538 COMPREPLY=();
8539 cur=`_get_cword`;
8540 COMPREPLY=($( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ));
8541 return 0
8542}
8543_unace ()
8544{
8545 local cur;
8546 COMPREPLY=();
8547 cur=`_get_cword`;
8548 case "$cur" in
8549 -*)
8550 COMPREPLY=($( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- $cur ))
8551 ;;
8552 *)
8553 if [ $COMP_CWORD -eq 1 ]; then
8554 COMPREPLY=($( compgen -W 'e l t v x' -- $cur ));
8555 else
8556 _filedir '@(ace|ACE)';
8557 fi
8558 ;;
8559 esac;
8560 return 0
8561}
8562_units ()
8563{
8564 COMPREPLY=($( compgen -W 'h s b k m g t H K M G T' -- $cur ))
8565}
8566_unrar ()
8567{
8568 local cur;
8569 COMPREPLY=();
8570 cur=`_get_cword`;
8571 case "$cur" in
8572 -*)
8573 COMPREPLY=($( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
8574 -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
8575 -tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ))
8576 ;;
8577 *)
8578 if [ $COMP_CWORD -eq 1 ]; then
8579 COMPREPLY=($( compgen -W 'e l lb lt p t v vb vt x' -- $cur ));
8580 else
8581 _filedir '@(rar|RAR)';
8582 fi
8583 ;;
8584 esac;
8585 return 0
8586}
8587_unshunt ()
8588{
8589 local cur;
8590 COMPREPLY=();
8591 cur=`_get_cword`;
8592 if [[ "$cur" == -* ]]; then
8593 COMPREPLY=($( compgen -W '-h --help' -- $cur ));
8594 else
8595 _filedir -d;
8596 fi
8597}
8598_update_alternatives ()
8599{
8600 local cur prev mode args i;
8601 COMPREPLY=();
8602 cur=`_get_cword`;
8603 prev=${COMP_WORDS[COMP_CWORD-1]};
8604 case "$prev" in
8605 --@(altdir|admindir))
8606 _filedir -d;
8607 return 0
8608 ;;
8609 --@(help|version))
8610 return 0
8611 ;;
8612 esac;
8613 for ((i=1; i < COMP_CWORD; i++ ))
8614 do
8615 if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
8616 mode=${COMP_WORDS[i]};
8617 args=$(($COMP_CWORD - i));
8618 break;
8619 fi;
8620 done;
8621 case $mode in
8622 --install)
8623 case $args in
8624 1)
8625 _filedir
8626 ;;
8627 2)
8628 installed_alternatives
8629 ;;
8630 3)
8631 _filedir
8632 ;;
8633 esac
8634 ;;
8635 --remove)
8636 case $args in
8637 1)
8638 installed_alternatives
8639 ;;
8640 2)
8641 _filedir
8642 ;;
8643 esac
8644 ;;
8645 --auto)
8646 installed_alternatives
8647 ;;
8648 --remove-all)
8649 installed_alternatives
8650 ;;
8651 --display)
8652 installed_alternatives
8653 ;;
8654 --config)
8655 installed_alternatives
8656 ;;
8657 *)
8658 COMPREPLY=($( compgen -W '--verbose --quiet --help --version \
8659 --altdir --admindir' -- $cur ) $( compgen -W '--install --remove --auto --display \
8660 --config' -- $cur ))
8661 ;;
8662 esac
8663}
8664_update_rc_d ()
8665{
8666 local cur prev sysvdir services options valid_options;
8667 cur=`_get_cword`;
8668 prev=${COMP_WORDS[COMP_CWORD-1]};
8669 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
8670 services=($(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))));
8671 services=(${services[@]#$sysvdir/});
8672 options=(-f -n);
8673 if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
8674 valid_options=($( echo "${COMP_WORDS[@]} ${options[@]}" | tr " " "\n" | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" | sort | uniq -u ));
8675 COMPREPLY=($( compgen -W '${options[@]} ${services[@]}' -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ));
8676 else
8677 if [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
8678 COMPREPLY=($( compgen -W 'remove defaults start stop' -- $cur ));
8679 else
8680 if [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
8681 COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
8682 else
8683 if [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
8684 COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
8685 else
8686 if [[ "$prev" == defaults && -z "$cur" ]]; then
8687 COMPREPLY=(0 1 2 3 4 5 6 7 8 9 s k);
8688 else
8689 if [[ "$prev" == ?(start|stop) ]]; then
8690 if [[ "$cur" == [0-9] || -z "$cur" ]]; then
8691 COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
8692 else
8693 if [[ "$cur" == [0-9][0-9] ]]; then
8694 COMPREPLY=($cur);
8695 else
8696 COMPREPLY=();
8697 fi;
8698 fi;
8699 else
8700 if [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
8701 if [[ -z "$cur" ]]; then
8702 if [[ $prev == [0-9][0-9] ]]; then
8703 COMPREPLY=(0 1 2 3 4 5 6 S);
8704 else
8705 COMPREPLY=(0 1 2 3 4 5 6 S .);
8706 fi;
8707 else
8708 if [[ "$cur" == [0-6S.] ]]; then
8709 COMPREPLY=($cur);
8710 else
8711 COMPREPLY=();
8712 fi;
8713 fi;
8714 else
8715 if [[ "$prev" == "." ]]; then
8716 COMPREPLY=($(compgen -W "start stop" -- $cur));
8717 else
8718 COMPREPLY=();
8719 fi;
8720 fi;
8721 fi;
8722 fi;
8723 fi;
8724 fi;
8725 fi;
8726 fi;
8727 return 0
8728}
8729_urlsnarf ()
8730{
8731 local cur;
8732 COMPREPLY=();
8733 cur=`_get_cword`;
8734 prev=${COMP_WORDS[COMP_CWORD-1]};
8735 case "$prev" in
8736 -i)
8737 _interfaces;
8738 return 0
8739 ;;
8740 esac;
8741 if [[ "$cur" == -* ]]; then
8742 COMPREPLY=($( compgen -W '-n -i -v' -- $cur ));
8743 fi
8744}
8745_usb_ids ()
8746{
8747 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( lsusb | awk '{print $6}')" -- $cur ))
8748}
8749_user_at_host ()
8750{
8751 local cur;
8752 COMPREPLY=();
8753 cur=`_get_cword`;
8754 if [[ $cur == *@* ]]; then
8755 _known_hosts;
8756 else
8757 COMPREPLY=($( compgen -u -- "$cur" ));
8758 fi;
8759 return 0
8760}
8761_usergroup ()
8762{
8763 local IFS='
8764';
8765 cur=${cur//\\\\ / };
8766 if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
8767 user=${cur%%*([^:.])};
8768 COMPREPLY=($(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}));
8769 else
8770 if [[ $cur = *:* ]] && [ -n "$bash205" ]; then
8771 COMPREPLY=($( compgen -g -- ${cur##*[.:]} ));
8772 else
8773 COMPREPLY=($( compgen -S : -u -- $cur ));
8774 fi;
8775 fi
8776}
8777_vgcfgbackup ()
8778{
8779 local cur prev;
8780 COMPREPLY=();
8781 cur=`_get_cword`;
8782 prev=${COMP_WORDS[COMP_CWORD-1]};
8783 case "$prev" in
8784 -@(f|-file))
8785 _filedir;
8786 return 0
8787 ;;
8788 esac;
8789 if [[ "$cur" == -* ]]; then
8790 COMPREPLY=($( compgen -W '-d --debug -f --file -h --help \
8791 --ignorelockingfailure -P --partial -v --verbose \
8792 --version' -- $cur ));
8793 else
8794 _volumegroups;
8795 fi
8796}
8797_vgcfgrestore ()
8798{
8799 local cur prev;
8800 COMPREPLY=();
8801 cur=`_get_cword`;
8802 prev=${COMP_WORDS[COMP_CWORD-1]};
8803 case "$prev" in
8804 -@(f|-file))
8805 _filedir;
8806 return 0
8807 ;;
8808 -@(M|-metadatatype))
8809 COMPREPLY=($( compgen -W '1 2' -- $cur ));
8810 return 0
8811 ;;
8812 -@(n|-name))
8813 _volumegroups;
8814 return 0
8815 ;;
8816 esac;
8817 if [[ "$cur" == -* ]]; then
8818 COMPREPLY=($( compgen -W '-d --debug -f --file -l --list \
8819 -h --help -M --Metadatatype -n --name -t --test \
8820 -v --verbose --version' -- $cur ));
8821 else
8822 _volumegroups;
8823 fi
8824}
8825_vgchange ()
8826{
8827 local cur prev;
8828 COMPREPLY=();
8829 cur=`_get_cword`;
8830 prev=${COMP_WORDS[COMP_CWORD-1]};
8831 case "$prev" in
8832 -@(a|A|x|-available|-autobackup|-resizeable))
8833 COMPREPLY=($( compgen -W 'y n' -- $cur ));
8834 return 0
8835 ;;
8836 esac;
8837 if [[ "$cur" == -* ]]; then
8838 COMPREPLY=($( compgen -W '-A --autobackup --alloc -P \
8839 --partial -d --debug -h --help --ignorelockingfailure \
8840 -t --test -u --uuid -v --verbose --version -a \
8841 --available -x --resizeable -l --logicalvolume \
8842 --addtag --deltag' -- $cur ));
8843 else
8844 _volumegroups;
8845 fi
8846}
8847_vgck ()
8848{
8849 local cur prev;
8850 COMPREPLY=();
8851 cur=`_get_cword`;
8852 if [[ "$cur" == -* ]]; then
8853 COMPREPLY=($( compgen -W '-d --debug -h \
8854 -? --help -v --verbose --version' -- $cur ));
8855 else
8856 _volumegroups;
8857 fi
8858}
8859_vgconvert ()
8860{
8861 local cur prev;
8862 COMPREPLY=();
8863 cur=`_get_cword`;
8864 prev=${COMP_WORDS[COMP_CWORD-1]};
8865 case "$prev" in
8866 -@(M|-metadatatype))
8867 COMPREPLY=($( compgen -W '1 2' -- $cur ));
8868 return 0
8869 ;;
8870 --metadatacopies)
8871 COMPREPLY=($( compgen -W '0 1 2' -- $cur ));
8872 return 0
8873 ;;
8874 --metadatasize)
8875 _sizes;
8876 return 0
8877 ;;
8878 esac;
8879 if [[ "$cur" == -* ]]; then
8880 COMPREPLY=($( compgen -W '-d --debug -h --help --labelsector \
8881 -M --metadatatype --metadatacopies --metadatasize \
8882 -t --test -v --verbose --version' -- $cur ));
8883 else
8884 _volumegroups;
8885 fi
8886}
8887_vgcreate ()
8888{
8889 local cur prev;
8890 COMPREPLY=();
8891 cur=`_get_cword`;
8892 prev=${COMP_WORDS[COMP_CWORD-1]};
8893 case "$prev" in
8894 -@(A|-autobackup))
8895 COMPREPLY=($( compgen -W 'y n' -- $cur ));
8896 return 0
8897 ;;
8898 -@(M|-metadatatype))
8899 COMPREPLY=($( compgen -W '1 2' -- $cur ));
8900 return 0
8901 ;;
8902 -@(s|-physicalextentsize))
8903 _sizes;
8904 return 0
8905 ;;
8906 esac;
8907 if [[ "$cur" == -* ]]; then
8908 COMPREPLY=($( compgen -W '-A --autobackup --addtag \
8909 --alloc -d --debug -h --help -l --maxlogicalvolumes \
8910 -M --metadatatype -p --maxphysicalvolumes -s \
8911 --physicalextentsize -t --test -v --verbose \
8912 --version' -- $cur ));
8913 else
8914 _args;
8915 if [ $args -eq 0 ]; then
8916 _volumegroups;
8917 else
8918 _physicalvolumes;
8919 fi;
8920 fi
8921}
8922_vgdisplay ()
8923{
8924 local cur prev;
8925 COMPREPLY=();
8926 cur=`_get_cword`;
8927 prev=${COMP_WORDS[COMP_CWORD-1]};
8928 case "$prev" in
8929 --units)
8930 _units;
8931 return 0
8932 ;;
8933 esac;
8934 if [[ "$cur" == -* ]]; then
8935 COMPREPLY=($( compgen -W '-c --colon -C --columns --units \
8936 -P --partial -A --activevolumegroups -v --verbose \
8937 -d --debug -h --help --version' -- $cur ));
8938 else
8939 _volumegroups;
8940 fi
8941}
8942_vgextend ()
8943{
8944 local cur prev;
8945 COMPREPLY=();
8946 cur=`_get_cword`;
8947 prev=${COMP_WORDS[COMP_CWORD-1]};
8948 case "$prev" in
8949 -@(A|-autobackup))
8950 COMPREPLY=($( compgen -W 'y n' -- $cur ));
8951 return 0
8952 ;;
8953 -@(L|-size))
8954 _sizes;
8955 return 0
8956 ;;
8957 esac;
8958 if [[ "$cur" == -* ]]; then
8959 COMPREPLY=($( compgen -W '-A --autobackup -d --debug -h \
8960 -? --help -t --test -v --verbose --version' -- $cur ));
8961 else
8962 _args;
8963 if [ $args -eq 0 ]; then
8964 _volumegroups;
8965 else
8966 _physicalvolumes;
8967 fi;
8968 fi
8969}
8970_vgmerge ()
8971{
8972 local cur prev;
8973 COMPREPLY=();
8974 cur=`_get_cword`;
8975 prev=${COMP_WORDS[COMP_CWORD-1]};
8976 case "$prev" in
8977 -@(A|-autobackup))
8978 COMPREPLY=($( compgen -W 'y n' -- $cur ));
8979 return 0
8980 ;;
8981 esac;
8982 if [[ "$cur" == -* ]]; then
8983 COMPREPLY=($( compgen -W '-A --autobackup -d --debug \
8984 -h --help -l --list -t --test -v --verbose \
8985 --version' -- $cur ));
8986 else
8987 _volumegroups;
8988 fi
8989}
8990_vgmknodes ()
8991{
8992 local cur;
8993 COMPREPLY=();
8994 cur=`_get_cword`;
8995 if [[ "$cur" == -* ]]; then
8996 COMPREPLY=($( compgen -W '-d --debug -h --help -v --verbose \
8997 --version' -- $cur ));
8998 else
8999 _volumegroups;
9000 fi
9001}
9002_vgport ()
9003{
9004 local cur prev;
9005 COMPREPLY=();
9006 cur=`_get_cword`;
9007 if [[ "$cur" == -* ]]; then
9008 COMPREPLY=($( compgen -W '-a --all -d --debug -h \
9009 -? --help -v --verbose --version' -- $cur ));
9010 else
9011 _volumegroups;
9012 fi
9013}
9014_vgreduce ()
9015{
9016 local cur prev;
9017 COMPREPLY=();
9018 cur=`_get_cword`;
9019 prev=${COMP_WORDS[COMP_CWORD-1]};
9020 case "$prev" in
9021 -@(A|-autobackup))
9022 COMPREPLY=($( compgen -W 'y n' -- $cur ));
9023 return 0
9024 ;;
9025 esac;
9026 if [[ "$cur" == -* ]]; then
9027 COMPREPLY=($( compgen -W '-a --all -A --autobackup -d \
9028 --debug -h --help --removemissing -t --test -v \
9029 --verbose --version' -- $cur ));
9030 else
9031 _args;
9032 if [ $args -eq 0 ]; then
9033 _volumegroups;
9034 else
9035 _physicalvolumes;
9036 fi;
9037 fi
9038}
9039_vgremove ()
9040{
9041 local cur;
9042 COMPREPLY=();
9043 cur=`_get_cword`;
9044 if [[ "$cur" == -* ]]; then
9045 COMPREPLY=($( compgen -W '-d --debug -h --help -t --test \
9046 -v --verbose --version' -- $cur ));
9047 else
9048 _volumegroups;
9049 fi
9050}
9051_vgrename ()
9052{
9053 local cur prev;
9054 COMPREPLY=();
9055 cur=`_get_cword`;
9056 prev=${COMP_WORDS[COMP_CWORD-1]};
9057 case "$prev" in
9058 -@(A|-autobackup))
9059 COMPREPLY=($( compgen -W 'y n' -- $cur ));
9060 return 0
9061 ;;
9062 esac;
9063 if [[ "$cur" == -* ]]; then
9064 COMPREPLY=($( compgen -W '-A --autobackup -d --debug -h \
9065 -? --help -t --test -v --verbose --version' -- $cur ));
9066 else
9067 _volumegroups;
9068 fi
9069}
9070_vgs ()
9071{
9072 local cur prev;
9073 COMPREPLY=();
9074 cur=`_get_cword`;
9075 prev=${COMP_WORDS[COMP_CWORD-1]};
9076 case "$prev" in
9077 -@(o|O|-options|-sort))
9078 COMPREPLY=($( compgen -W 'vg_fmt vg_uuid vg_name \
9079 vg_attr vg_size vg_free vg_sysid \
9080 vg_extent_size vg_extent_count vg_free_count \
9081 max_lv max_pv pv_count lv_count snap_count \
9082 vg_seqno' -- $cur ));
9083 return 0
9084 ;;
9085 --units)
9086 _units;
9087 return 0
9088 ;;
9089 esac;
9090 if [[ "$cur" == -* ]]; then
9091 COMPREPLY=($( compgen -W '--aligned -d --debug \
9092 -h --help --ignorelockingfailure --noheadings \
9093 --nosuffix -o --options -O --sort -P --partial \
9094 --separator --unbuffered --units \
9095 -v --verbose --version' -- $cur ));
9096 else
9097 _volumegroups;
9098 fi
9099}
9100_vgscan ()
9101{
9102 local cur;
9103 COMPREPLY=();
9104 cur=`_get_cword`;
9105 if [[ "$cur" == -* ]]; then
9106 COMPREPLY=($( compgen -W '-d --debug -h --help \
9107 --ignorelockingfailure --mknodes -P \
9108 --partial -v --verbose --version' -- $cur ));
9109 fi
9110}
9111_vgsplit ()
9112{
9113 local cur prev;
9114 COMPREPLY=();
9115 cur=`_get_cword`;
9116 prev=${COMP_WORDS[COMP_CWORD-1]};
9117 case "$prev" in
9118 -@(A|-autobackup))
9119 COMPREPLY=($( compgen -W 'y n' -- $cur ));
9120 return 0
9121 ;;
9122 -@(M|-metadatatype))
9123 COMPREPLY=($( compgen -W '1 2' -- $cur ));
9124 return 0
9125 ;;
9126 esac;
9127 if [[ "$cur" == -* ]]; then
9128 COMPREPLY=($( compgen -W '-A --autobackup -d --debug \
9129 -h --help -l --list -M --metadatatype -t --test \
9130 -v --verbose --version' -- $cur ));
9131 else
9132 _args;
9133 if [ $args -eq 0 -o $args -eq 1 ]; then
9134 _volumegroups;
9135 else
9136 _physicalvolumes;
9137 fi;
9138 fi
9139}
9140_vncviewer_bootstrap ()
9141{
9142 local fname;
9143 case "$(_realcommand vncviewer)" in
9144 '')
9145 _filedir `_get_cword`
9146 ;;
9147 *xvnc4viewer)
9148 fname=_xvnc4viewer
9149 ;;
9150 *tightvncviewer | *)
9151 fname=_tightvncviewer
9152 ;;
9153 esac;
9154 if [ $fname ]; then
9155 complete -F $fname vncviewer;
9156 $fname;
9157 unset -f _vncviewer_bootstrap;
9158 fi
9159}
9160_volumegroups ()
9161{
9162 COMPREPLY=($(compgen -W "$( vgscan 2>/dev/null | sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ))
9163}
9164_webmitm ()
9165{
9166 local cur;
9167 COMPREPLY=();
9168 cur=`_get_cword`;
9169 if [[ "$cur" == -* ]]; then
9170 COMPREPLY=($( compgen -W '-d' -- $cur ));
9171 else
9172 _known_hosts;
9173 fi
9174}
9175_withlist ()
9176{
9177 local cur;
9178 COMPREPLY=();
9179 cur=`_get_cword`;
9180 if [[ "$cur" == -* ]]; then
9181 COMPREPLY=($( compgen -W '-l --lock -i --interactive \
9182 -r --run -a --all -q --quiet -h --help' -- $cur ));
9183 else
9184 _mailman_lists;
9185 fi
9186}
9187_wvdial ()
9188{
9189 local cur prev config i IFS='
9190';
9191 COMPREPLY=();
9192 cur=`_get_cword`;
9193 prev=${COMP_WORDS[COMP_CWORD-1]};
9194 case $prev in
9195 --config)
9196 _filedir;
9197 return 0
9198 ;;
9199 esac;
9200 case $cur in
9201 -*)
9202 COMPREPLY=($( compgen -W '--config --chat \
9203 --remotename --help --version --no-syslog' -- $cur ))
9204 ;;
9205 *)
9206 config="/etc/wvdial.conf"' '"$HOME/.wvdialrc";
9207 for ((i=1; i < COMP_CWORD; i++ ))
9208 do
9209 if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
9210 config=${COMP_WORDS[i+1]};
9211 break;
9212 fi;
9213 done;
9214 COMPREPLY=($( sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config 2>/dev/null |grep -v '^Defaults$'));
9215 COMPREPLY=${COMPREPLY// /\\ }
9216 ;;
9217 esac
9218}
9219_xrandr ()
9220{
9221 local cur prev output modes;
9222 COMPREPLY=();
9223 cur=`_get_cword`;
9224 prev=${COMP_WORDS[COMP_CWORD-1]};
9225 case "$prev" in
9226 --output)
9227 local outputs=$(xrandr|grep 'connected'|awk '{print $1}');
9228 COMPREPLY=($(compgen -W "$outputs" -- $cur));
9229 return 0
9230 ;;
9231 --mode)
9232 for ((i = 1; i < COMP_CWORD; i++ ))
9233 do
9234 if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
9235 output=${COMP_WORDS[i+1]};
9236 break;
9237 fi;
9238 done;
9239 modes=$(xrandr|sed -e "1,/$output/ d" -e "/connected/,$ d"|awk '{print $1}');
9240 COMPREPLY=($( compgen -W "$modes" -- $cur));
9241 return 0
9242 ;;
9243 esac;
9244 case "$cur" in
9245 *)
9246 COMPREPLY=($(compgen -W '-d -display -help -o \
9247 --orientation -q --query -s --size\
9248 -r --rate -v --version -x -y --screen \
9249 --verbose --dryrun --prop --fb --fbmm --dpi \
9250 --output --auto --mode --preferred --pos \
9251 --reflect --rotate --left-of --right-of \
9252 --above --below --same-as --set --off --crtc \
9253 --newmode --rmmode --addmode --delmode' -- $cur));
9254 return 0
9255 ;;
9256 esac;
9257 return 0
9258}
9259_xvnc4viewer ()
9260{
9261 local cur prev;
9262 COMPREPLY=();
9263 cur=`_get_cword`;
9264 prev=${COMP_WORDS[COMP_CWORD-1]};
9265 case ${prev/#--/-} in
9266 -[pP][aA][sS][sS][wW][dD] | -[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE])
9267 _filedir;
9268 return 0
9269 ;;
9270 -[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG])
9271 COMPREPLY=($( compgen -W 'zrle hextile raw' -- $cur ));
9272 return 0
9273 ;;
9274 -[vV][iI][aA])
9275 _known_hosts;
9276 return 0
9277 ;;
9278 esac;
9279 if [[ "$cur" == -* || "$cur" == --* ]]; then
9280 local dash options=(AcceptClipboard AutoSelect DebugDelay display DotWhenNoCursor FullColor FullColour FullScreen geometry help listen Log LowColourLevel MenuKey name Parent passwd PasswordFile PointerEventInterval PreferredEncoding SendClipboard SendPrimary Shared UseLocalCursor via ViewOnly WMDecorationHeight WMDecorationWidth ZlibLevel);
9281 [[ "$cur" == --* ]] && dash=-- || dash=-;
9282 if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then
9283 local option oldNoCaseMatch=$(shopt -p nocasematch);
9284 shopt -s nocasematch;
9285 COMPREPLY=($( for option in "${options[@]}"; do
9286 [[ $dash$option == "$cur"* ]] && echo $dash$option
9287 done ));
9288 eval "$oldNoCaseMatch" 2> /dev/null;
9289 else
9290 COMPREPLY=($( compgen -W "$(
9291 echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
9292 )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ));
9293 fi;
9294 else
9295 _known_hosts;
9296 fi
9297}
9298command_not_found_handle ()
9299{
9300 if [ -x /usr/lib/command-not-found ]; then
9301 /usr/bin/python /usr/lib/command-not-found -- $1;
9302 return $?;
9303 else
9304 return 127;
9305 fi
9306}
9307dequote ()
9308{
9309 eval echo "$1"
9310}
9311get_entries ()
9312{
9313 local IFS='
9314';
9315 [ -r ${prefix:-}CVS/Entries ] && entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
9316}
9317get_modules ()
9318{
9319 if [ -n "$prefix" ]; then
9320 COMPREPLY=($( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ));
9321 else
9322 COMPREPLY=($( command ls -d ${cvsroot}/!(CVSROOT) ));
9323 fi
9324}
9325installed_alternatives ()
9326{
9327 local admindir;
9328 for i in alternatives dpkg/alternatives rpm/alternatives;
9329 do
9330 [ -d /var/lib/$i ] && admindir=/var/lib/$i && break;
9331 done;
9332 for ((i=1; i < COMP_CWORD; i++ ))
9333 do
9334 if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
9335 admindir=${COMP_WORDS[i+1]};
9336 break;
9337 fi;
9338 done;
9339 COMPREPLY=($( command ls $admindir | grep "^$cur" ))
9340}
9341quote ()
9342{
9343 echo \'${1//\'/\'\\\'\'}\'
9344}
9345quote_readline ()
9346{
9347 if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
9348 echo "${1}";
9349 return;
9350 fi;
9351 local t="${1//\\/\\\\}";
9352 echo \'${t//\'/\'\\\'\'}\'
9353}
9354ri_get_methods ()
9355{
9356 local regex;
9357 if [ "$ri_version" = integrated ]; then
9358 if [ -z "$separator" ]; then
9359 regex="(Instance|Class)";
9360 else
9361 if [ "$separator" = "#" ]; then
9362 regex=Instance;
9363 else
9364 regex=Class;
9365 fi;
9366 fi;
9367 COMPREPLY=(${COMPREPLY[@]} "$( ri ${classes[@]} 2>/dev/null | ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
9368 /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
9369 end' | sort -u )");
9370 else
9371 COMPREPLY=(${COMPREPLY[@]} "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
9372 ! /^-/ and ! /^ +(class|module): / then \
9373 print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
9374 end' | sort -u )");
9375 fi;
9376 COMPREPLY=($( compgen $prefix -W '${COMPREPLY[@]}' -- $method ))
9377}
9378set_prefix ()
9379{
9380 [ -z ${prefix:-} ] || prefix=${cur%/*}/;
9381 [ -r ${prefix:-}CVS/Entries ] || prefix=""
9382}