summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Paleino <d.paleino@gmail.com>2009-10-10 17:15:58 +0200
committerDavid Paleino <d.paleino@gmail.com>2009-10-10 17:15:58 +0200
commite5a9b6220e93ca656fd9774c6aefa78241edca6f (patch)
tree4a65aa19b18fe2e8dcec24a1c97ce9746a6f91ff
parent96d00c3d7f1912d4f3f76f8ea21ef68d179b8b30 (diff)
downloadbash-completion-e5a9b6220e93ca656fd9774c6aefa78241edca6f.tar.gz
Imported Upstream version 1.1upstream/1.1
-rw-r--r--CHANGES384
-rw-r--r--Makefile.am112
-rw-r--r--Makefile.in277
-rw-r--r--README10
-rw-r--r--aclocal.m4125
-rwxr-xr-xautogen.sh4
-rw-r--r--bash_completion9991
-rw-r--r--bash_completion.sh12
-rwxr-xr-xconfigure1576
-rw-r--r--configure.ac2
-rw-r--r--contrib/_subversion13
-rw-r--r--contrib/_yum180
-rw-r--r--contrib/ant74
-rw-r--r--contrib/apache2ctl30
-rw-r--r--contrib/apt155
-rw-r--r--contrib/apt-build67
-rw-r--r--contrib/aptitude96
-rw-r--r--contrib/aspell98
-rw-r--r--contrib/autorpm23
-rw-r--r--contrib/bash-builtins133
-rw-r--r--contrib/bind-utils23
-rw-r--r--contrib/bitkeeper17
-rw-r--r--contrib/bittorrent64
-rw-r--r--contrib/bluez-utils452
-rw-r--r--contrib/brctl74
-rw-r--r--contrib/bzip247
-rw-r--r--contrib/cardctl24
-rw-r--r--contrib/cfengine93
-rw-r--r--contrib/chkconfig45
-rw-r--r--contrib/chsh27
-rw-r--r--contrib/cksfv56
-rw-r--r--contrib/clisp23
-rw-r--r--contrib/configure32
-rw-r--r--contrib/cowsay36
-rw-r--r--contrib/cpan2dist78
-rw-r--r--contrib/cpio101
-rw-r--r--contrib/cups21
-rw-r--r--contrib/cvs266
-rw-r--r--contrib/dcop26
-rw-r--r--contrib/dd39
-rw-r--r--contrib/dhclient37
-rw-r--r--contrib/dict78
-rw-r--r--contrib/dpkg268
-rw-r--r--contrib/dselect42
-rw-r--r--contrib/dsniff363
-rw-r--r--contrib/findutils122
-rw-r--r--contrib/freeciv95
-rw-r--r--contrib/gcc59
-rw-r--r--contrib/gcl23
-rw-r--r--contrib/gdb43
-rw-r--r--contrib/genisoimage79
-rw-r--r--contrib/getent56
-rw-r--r--contrib/gkrellm61
-rw-r--r--contrib/gnatmake57
-rw-r--r--contrib/gpg49
-rw-r--r--contrib/gpg283
-rw-r--r--contrib/gzip48
-rw-r--r--contrib/harbour8
-rw-r--r--contrib/heimdal134
-rw-r--r--contrib/iconv35
-rw-r--r--contrib/imagemagick532
-rw-r--r--contrib/info58
-rw-r--r--contrib/ipmitool39
-rw-r--r--contrib/iptables70
-rw-r--r--contrib/isql23
-rw-r--r--contrib/jar36
-rw-r--r--contrib/java260
-rw-r--r--contrib/kldload38
-rw-r--r--contrib/larch74
-rw-r--r--contrib/ldapvi73
-rw-r--r--contrib/lftp26
-rw-r--r--contrib/lilo61
-rw-r--r--contrib/lilypond6
-rw-r--r--contrib/links43
-rw-r--r--contrib/lisp25
-rw-r--r--contrib/lvm1128
-rw-r--r--contrib/lzma77
-rw-r--r--contrib/lzop113
-rw-r--r--contrib/mailman796
-rw-r--r--contrib/make79
-rw-r--r--contrib/man83
-rw-r--r--contrib/mc50
-rw-r--r--contrib/mcrypt151
-rw-r--r--contrib/mdadm187
-rw-r--r--contrib/minicom78
-rw-r--r--contrib/mkinitrd60
-rw-r--r--contrib/mock85
-rw-r--r--contrib/modules57
-rw-r--r--contrib/monodevelop153
-rw-r--r--contrib/mplayer242
-rw-r--r--contrib/msynctool55
-rw-r--r--contrib/mtx52
-rw-r--r--contrib/munin-node103
-rw-r--r--contrib/mutt146
-rw-r--r--contrib/mysqladmin38
-rw-r--r--contrib/ncftp26
-rw-r--r--contrib/net-tools178
-rw-r--r--contrib/ntpdate38
-rw-r--r--contrib/openldap273
-rw-r--r--contrib/openssl251
-rw-r--r--contrib/p497
-rw-r--r--contrib/perl127
-rw-r--r--contrib/pine22
-rw-r--r--contrib/pkg-config52
-rw-r--r--contrib/pkg_install31
-rw-r--r--contrib/pkgtools22
-rw-r--r--contrib/portupgrade59
-rw-r--r--contrib/postfix236
-rw-r--r--contrib/postgresql171
-rw-r--r--contrib/povray107
-rw-r--r--contrib/python59
-rw-r--r--contrib/qdbus34
-rw-r--r--contrib/qemu210
-rw-r--r--contrib/quota-tools473
-rw-r--r--contrib/rcs44
-rw-r--r--contrib/rdesktop89
-rw-r--r--contrib/repomanage29
-rw-r--r--contrib/reportbug127
-rw-r--r--contrib/resolvconf31
-rw-r--r--contrib/rfkill38
-rw-r--r--contrib/ri151
-rw-r--r--contrib/rpcdebug58
-rw-r--r--contrib/rpm297
-rw-r--r--contrib/rpmcheck34
-rw-r--r--contrib/rrdtool18
-rw-r--r--contrib/rsync101
-rw-r--r--contrib/samba305
-rw-r--r--contrib/sbcl24
-rw-r--r--contrib/screen69
-rw-r--r--contrib/shadow501
-rw-r--r--contrib/sitecopy51
-rw-r--r--contrib/smartctl149
-rw-r--r--contrib/snownews30
-rw-r--r--contrib/ssh235
-rw-r--r--contrib/strace103
-rw-r--r--contrib/svk466
-rw-r--r--contrib/sysctl23
-rw-r--r--contrib/sysv-rc113
-rw-r--r--contrib/tar72
-rw-r--r--contrib/tcpdump38
-rw-r--r--contrib/unace51
-rw-r--r--contrib/unrar54
-rw-r--r--contrib/update-alternatives99
-rw-r--r--contrib/vncviewer208
-rw-r--r--contrib/vpnc50
-rw-r--r--contrib/wireless-tools183
-rw-r--r--contrib/wodim85
-rw-r--r--contrib/wvdial53
-rw-r--r--contrib/xhost24
-rw-r--r--contrib/xm231
-rw-r--r--contrib/xmllint56
-rw-r--r--contrib/xmlwf40
-rw-r--r--contrib/xmms30
-rw-r--r--contrib/xrandr56
-rw-r--r--contrib/xz103
-rw-r--r--contrib/yp-tools35
-rw-r--r--contrib/yum-arch30
-rwxr-xr-xinstall-sh5
-rwxr-xr-xmissing49
159 files changed, 16291 insertions, 12556 deletions
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index 14d7669a..00000000
--- a/CHANGES
+++ /dev/null
@@ -1,384 +0,0 @@
-bash-completion (1.0)
-
- [ Guillaume Rousse ]
- * Make bibtex complete on .aux files
- * Add .xvid and .XVID to player completion
- * Added cowsay/cowthink completion
- * Added brctl completion
- * Added cpan2dist completion
- * Added qemu completion
- * Added net-tools (mii-tool and mii-diag) completions
- * Added minicom completion
- * Added quota-tools completion
- * Added rdesktop completion
- * Added tightvncviewer completion
- * Cleanup screen completion, and make it completes on options
-
- [ David Paleino ]
- * Added .kar to Timidity completion.
- * Fix killall completion, remove trailing ":" on certain process
- names
- * Fix man -l completing filenames (Debian: #497074)
- * (Partly) fixed java classes completion (Debian: #496828). Look for
- FIXME in source.
- * Dump to /dev/null error message from look(1) with no arguments
- (Debian: #495142)
- * Set ssh as default for rsync (was rsh) (Debian: #492328)
- * Added .oga, .ogv, .ogx to mplayer completion (Debian: #496162)
- * Added .epub to unzip|zipinfo completion (Debian: #492476)
- * Added ssh-copy-id completion (Debian: #491856)
- * Moved ssh completion to separate file (Debian: #360628)
- * Bogus completion when mounting subdirs fixed (Debian: #322238)
- * Fix `apt-cache showsrc` completing only on source package names
- (Debian: #361535)
- * Fixed bugs with gdb completion:
- - when an empty directory is in $PATH (thanks to Morita Sho)
- (Debian: #497597)
- - when a non-existing directory is in $PATH (Debian: #499780)
- * Fix missing completion for "-n" and "-e" (we were using echo, now
- using printf) (thanks to Morita Sho) (Debian: #498105)
- * Fixed gpg completion:
- - --@(export|@(?(l|nr|nrl)sign|edit)-key)) (Debian: #500316)
- - -@(r|-recipient))
- * Fixed .cb[rz] completion for evince (Debian: #502885)
- * Added gksudo, gksu, kdesudo completion
- * Added apache2ctl completion
- * Added gpg2 completion (Debian: #489927)
- * Fixed mplayer -skin completion (Debian: #501473)
- * Fixed errors with POSIX enabled (Debian: #502804)
- * Fixed dpkg-source wrong exit() with return() (Debian: #)
- * Added --schedule-only to aptitude's completion (Debian: #502664)
- * Added build-dep to aptitude's completion (Debian: #495883)
- * Added support for `-F configfile' to _known_hosts(), ssh, scp and
- sftp, thanks to Freddy Vulto (Debian: #504141)
- * Fixed sed quoting bug in _known_hosts(), thanks to Freddy Vulto
- (Debian: #504650)
- * Allow `Host(Name)' in ssh config file to be indented
- * Allow `Host(Name)' in ssh config file to have trailing comment.
- * Allow for comments in known_hosts files (Debian: #511789)
- * Fixed perl -I/-x completion, thanks to Freddy Vulto
- (Debian: #504547)
- * README updated: explain how to use bash-completion correctly.
- (Debian: #506560)
- * TODO updated: the Alioth team is now upstream.
- * Added qdbus completion, thanks to Terence Simpson (Ubuntu: #257903)
- * Added monodevelop and mdtool completions.
- * Split subversion-related completions to contrib/_subversion
- (prefixed with _ to avoid file conflicts with upstream's one)
- * Fixed completion of environment variables, thanks to Morita Sho
- (Debian: #272660)
- * Fix dpkg completion bug: it listed only non-Essential packages
- (Debian: #511790)
- * Fixed _dpkg_source completion (Debian: #503317)
- * Added _parse_help() to try to parse options listed in $command
- --help
- * Fixed gzip completion to use _parse_help(), since the available
- options vary with distributions
- * Added to_review/ directory, where completions needing a review would
- go. After it gets accepted, the completion would go into contrib/.
- * Remove unused UNAME local variable in _info() (Debian: #501843)
- * AUTHORS added
- * Make _alias() use _get_cword
- * Added .zip to jar completions (Debian: #521041)
- * Merge from Gentoo:
- - fix 'find' completion so that it properly completes on -?(i)whilename.
- Patch by Ciaran McCreesh.
- - use make -qp to parse the Makefile for us, so we get proper completion
- on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>.
- - complete on gkrellm2 as well. Patch by Aaron Walker.
- - fix CVS completion
- * Merge from Ubuntu:
- - consume error messages in configure completion (Ubuntu: #223882)
- (Mika Fischer)
- - quote $xspec in _filedir_xspec in case it is empty, which would
- cause errors if there was no match under failglob. (Ubuntu: #194419)
- (Mika Fischer)
- * debian/links fixed (Debian: #494292)
- * debian/control:
- - fixed typo in the long description
- - added Vcs-* fields
- * debian/install:
- - correctly install contrib/* under /etc/bash_completion.d/
- * debian/copyright updated
- * extra/dh_bash-completion:
- - updated to support a list of files in debian/<package>.bash-completion
- (Debian: #512917)
-
- [ Ville Skyttä ]
- * Added JPEG 2000 files to display completion, thanks to Bastien Nocera
- (RedHat: #304771)
- * Improved rpm macro completion.
- * Added -E to rpm completion.
- * Improved rpm backup file avoidance.
- * Improved /var/log/rpmpkgs based rpm installed package completion.
- * Improved performance of rpm -qa based rpm installed package completion.
- * Improved features and performance of yum completion.
- * Added support for p (POSIX) and x (x.org) man sections.
- * Improved filename based man page completion.
- * Added minimal sqlite3 completion.
- * Improved getent completion (Ville Skyttä, Guillaume Rousse).
- * (Re)fix gzip and bzip2 options completion.
- * Improved svn filename completion (RedHat: #430059).
- * Add lzma completion (Per Øyvind Karlsen, Ville Skyttä).
- * Add .mp2 and .vdr to mplayer completion (RedHat: #444467).
- * Add .mkv, .mp2 and .vdr to *xine completion (RedHat: #444467).
- * Added lzop completion.
- * Fix scp metacharacter escaping.
- * Remove duplicate cpio completion, thanks to Freddy Vulto (Debian: #512823)
- * Fix awk error in "modprobe -r /" completion (Debian: #512556).
- * Expand ~foo to dir name more eagerly to avoid quoting issues.
- * Fix -sourcepath handling in javadoc packages completion.
- * Extract process name completion from _killall to _pnames, make it work
- for others than Linux and FreeBSD.
- * Fix process name completion with relative paths (RedHat: #484578).
- * Use improved process name completion in pgrep in addition to killall.
- * Enable pgrep and pkill completion if the commands are available, not just
- on Linux and FreeBSD.
- * Drop hg completion, an improved version is shipped with Mercurial
- (contrib/bash_completion in the tarball).
- * Make okular complete on same files as evince, thanks to Mary Ellen Foster
- (RedHat: #486998).
- * Apply ps2pdf completion to ps2pdf{12,13,14,wr} too.
- * Simplify bash_completion.sh, return earlier in non-applicable environments.
- * Remove obsolete --buildarch and --buildos rpm(build) completions.
- * Add rpmbuild --target completion.
- * Use "-profile help" to get mplayer and friends -profile completions.
- * Fix local array initialization under bash 3.0, prevents "()" occurring in
- file and dir name completions.
-
- [ Freddy Vulto ]
- * Restored `_display()' completion for `display' by removing
- completion-by-extension for `display' (Alioth#311429)
- * Removed duplicate completion option `-borderwidth' for `display'
- * Prevent completion dir from being sourced twice if
- BASH_COMPLETION_DIR and BASH_COMPLETION_COMPAT_DIR are equal (Alioth#311433)
- * Make `_mii-tool()' and `_mii-diag()' POSIX-compliant
- * Fix _isql completion waiting for grep input if $ODBCINI not set; handle
- whitespace in $ODBCINI.
- * Split vncviewer completion in _tightvncviewer() and _xvnc4viewer()
- Added _realcommand() global function.
-
- [ Jakob Unterwurzacher ]
- * ps2pdf can run on .pdf files as well. (Debian: #516614, Ubuntu: #316943)
-
- [ Santiago M. Mola ]
- * Add .ape to mplayer supported extensions (Alioth#311510).
-
- -- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100
-
-bash-completion (20080705) unstable; urgency=low
-
- [ David Paleino ]
- * Added more completions to imagemagick (thanks to Nelson A. de
- Oliveira) (Debian: #487786)
- * Added xrandr completion (thanks to Anton Khirnov) (Debian: #487825)
- * Improving _gdb completion:
- - $filenames to $default (Debian: #463969)
- - also show directory names (i.e. compgen -d) in COMPREPLY.
- - added . to $PATH, to allow debugging "local" executables.
- - do not complete Bash's builtins (thanks to Morita Sho)
-
- [ Luk Claes ]
- * Remove use of ucf for /etc/bash-completion (Debian: #488171).
-
- -- Luk Claes <luk@debian.org> Sat, 05 Jul 2008 16:14:15 +0200
-
-bash-completion (20080617.5) unstable; urgency=medium
-
- * Revert way of setting environment variables (Debian: #487774).
- * Add equals sign to _get_cword for mutt_aliases (Debian: #482635).
- * Enhance mlayer completion (Debian: #487826, #487838).
-
- -- Luk Claes <luk@debian.org> Tue, 24 Jun 2008 19:50:57 +0200
-
-bash-completion (20080617.4) experimental; urgency=low
-
- [ David Paleino ]
- * Merged Ubuntu changes:
- - added quote(), quote_readline(), dequote() helper functions.
- - added _remove_word()
- - fixed _get_cword()
- - refactored _filedir using quote_readline()
- - refactored _filedir_xspec using quote_readline()
- - fixed COMPREPLY's in _iwconfig
- - fixed _cvs()
- - _known_hosts(): use files from UserKnownHostsFile options in
- addition to standard ones.
- - fixed _command() to correctly prune the command line
- - disabled completion of PostgreSQL users and databases
- - fixed _java_packages()
- - fixed _muttquery()
- - added flv/FLV completion to mplayer
- - added --installed to apt-cache
- - only complete on filenames for aspell
- - fixed code for exclusions compspecs
- - added code to gracefully handle debug options (set +/-v)
-
- -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 19:25:25 +0200
-
-bash-completion (20080617.3) unstable; urgency=low
-
- [ David Paleino ]
- * Fixed IFS for filedir_xspec - Thanks to Stefan Lippers-Hollmann
- (Debian: #487571)
-
- [ Luk Claes ]
- * Install dh-bash-completion to ease installation of completions.
-
- -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 07:24:21 +0200
-
-bash-completion (20080617.2) unstable; urgency=low
-
- [ David Paleino ]
- * New upstream release
- - provide a manpage for extra/dh_bash-completion
- - fix semi-serious problem with _filedir() (Debian: #487449)
- * debian/rules:
- - added rule to generate dh_bash-completion's manpage
- * debian/install, debian/dirs:
- - installing dh_bash-completion into /usr/bin
- * debian/control:
- - new package dh-bash-completion
-
- [ Luk Claes ]
- * Comment new package to make sure current fix gets in the archive first.
- * Add compression completion for vi(m).
-
- -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 19:47:23 +0200
-
-bash-completion (20080617.1) unstable; urgency=medium
-
- [ David Paleino ]
- * Urgency set to medium because the package is currently unusable.
- * New upstream sub-release
- - fixed some typos here and there which prevented bash completions
- at all (Debian: #487441).
- - really closing Debian bug #455510.
-
- -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 00:22:53 +0200
-
-bash-completion (20080617) unstable; urgency=low
-
- [ David Paleino ]
- * New upstream release
- - add more completions to aptitude (Debian: #432289)
- - fixed UTF-8 problem with _get_cword(), thanks to
- Andrei Paskevich (Debian: #472132)
- - fixed autoremove completion, thanks to Flavio Visentin
- (Debian: #474974)
- - cmf and CMF added to playmidi completion (Debian: #365658)
- - added rrdtool completion, thanks to Justin Pryzby (Debian: #428641)
- - added OpenDocument completion for unzip/zipinfo (.od{f,g,p,s,t})
- (Debian: #472940)
- - fixed escaping problems with job control (i.e. disown, jobs, bg,
- fg): the argument is now surrounded by "" (Debian: #347316)
- - make mkdir complete also on filenames (Debian: #376433)
- - {bz,z}{cat,cmp,diff,egrep,fgrep,grep,less,more} now should complete
- on all filenames, not just compressed archives (just commented out)
- (Debian: #455510)
- - fixes Perl completion (Debian: #470742)
- - fixes get_cword -> _get_cword typo (Debian: #478596)
- - fixes _get_cword() function to properly handle filenames with
- whitespaces (Debian: #394636, #468254, #474094)
- - added .pdf.bz2 completion to evince (Debian: #424736)
- - added .svg completion to display (Debian: #441017)
- - added .m2ts completion to mplayer (Debian: #480879)
- - added extra/dh_bash-completion to ease future rewrite of bc.
- * debian/copyright - now in a fancier machine-parsable format.
- * debian/control:
- - added myself to Uploaders
- - debhelper Build-Depends updated to >= 6.
- * debian/watch:
- - improved current watch line regex
- - added (commented out) probable future watch line
- * debian/compat bumped to 6
- * debian/dirs, debian/install and debian/links added
- * debian/rules:
- - refactored to make use of debian/{dirs,install,links}
-
- [ Steve Kemp ]
- * Applied patch to fix completion of umount command.
- (Debian: #470539)
- * Fixed the completion of Perl manpages.
- (Debian: #404976)
- * Added 'aif' to the filenames offed for completion for mplayer.
- (Debian: #474517)
- * Allow tsocks completion.
- (Debian: #409423)
- * Update mutt completion to handle local usernames.
- (Debian: #416655)
- * Update apt-get completion to include the flag "--no-install-recommends"
- (Debian: #475242)
-
- -- Luk Claes <luk@debian.org> Sat, 21 Jun 2008 21:59:43 +0200
-
-bash-completion (20060301-4) unstable; urgency=low
-
- * Add some fixes from Ubuntu:
- * Fix completion of filenames with spaces (Debian: #468254).
- * Fix parsing of SSH config files (Debian: #435117).
- * Change priority to standard (Debian: #471666).
- * Add some more completions for xine (Debian: #452083, #471249).
- * Fix completion of gzip (Debian: #351913).
- * Also use $HOSTFILE in hostname completion (Debian: #400380).
-
- -- Luk Claes <luk@debian.org> Sat, 22 Mar 2008 23:10:30 +0000
-
-bash-completion (20060301-3) unstable; urgency=low
-
- * Fix kpdf completion (Debian: #468163, #413374).
- * Fix completion of - or -- with _command (Debian: #415276).
- * Add sux to the complete -u list (Debian: #466089).
- * Add dvipdfm to the list of dvi programs (Debian: #396644).
- * Add --purge-unused option completion for aptitude (Debian: #438471).
- * Add divx extension completion for mplayer (Debian: #444294).
- * Add pdf.gz completion for evince (Debian: #456887).
- * Add --remove-all completion for update-alternatives (Debian: #269173).
-
- -- Luk Claes <luk@debian.org> Wed, 05 Mar 2008 22:57:27 +0100
-
-bash-completion (20060301-2) unstable; urgency=low
-
- * Take over the package.
-
- -- Luk Claes <luk@debian.org> Wed, 27 Feb 2008 19:22:03 +0100
-
-bash-completion (20060301-1) unstable; urgency=low
-
- * Upload to unstable.
-
- -- Matthias Klose <doko@debian.org> Sat, 09 Feb 2008 23:18:20 +0100
-
-bash-completion (20060301-0ubuntu2) hardy; urgency=low
-
- * Replace bash (<< 3.1dfsg-9), handle upgrade in preinst.
- * Exclude hashed hostnames from ssh host completion results. Debian: #428085.
- * Fix: ifup/down don't really complete. Debian: #463756.
- * Allow perl completion to complete filenames, complete -I and -x arguments.
- Debian: #443394.
- * Add find -wholename completion. Debian: #431220.
- * Handle whitespaces in $HOME for _known_hosts() completion. Debian: #414821.
- * dpkg -L: complete for removed-but-not-purged packages. Debian: #372156.
- * Complete for apt-get autoremove. Debian: #433542, #443816, #445332.
- * Update completion for mplayer (mka/flac). Debian: #340452.
- * Add ping6/fping6 completion. Debian: #413170.
- * Handle whitespace in paths for mount/umount completion. Debian: #367957.
- * apt-get: Support --auto-remove. Ubuntu: #60666.
-
- -- Matthias Klose <doko@ubuntu.com> Sat, 09 Feb 2008 23:11:32 +0100
-
-bash-completion (20060301-0ubuntu1) hardy; urgency=low
-
- * Initial release, split out from the bash package.
- The software currently is unsupported upstream.
- * Don't try to set a readonly variable. Ubuntu: #149527.
- * Support purge in apt-get auto completion (Mathias Gug). Ubuntu: #151677.
- * evince: Autocomplete on cbr/cbz/djvu files. Ubuntu: #156200, #175220.
- Debian: #400678.
- * kdvi: complete .*\.dvi\.(gz|bz2). Ubuntu: #128234.
- * kpdf: Complete postscript files. Ubuntu: #162319.
- * Make completion working in the middle of a word (Adam Simpkins).
- Ubuntu: #139666.
-
- -- Matthias Klose <doko@ubuntu.com> Fri, 08 Feb 2008 16:46:34 +0100
-
diff --git a/Makefile.am b/Makefile.am
index 416be54a..4631b9ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,48 +2,148 @@
sysconf_DATA = bash_completion
bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/apache2ctl \
+bashcomp_DATA = contrib/ant \
+ contrib/apache2ctl \
+ contrib/apt \
+ contrib/apt-build \
+ contrib/aptitude \
+ contrib/aspell \
+ contrib/autorpm \
+ contrib/bash-builtins \
+ contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
+ contrib/bluez-utils \
contrib/brctl \
+ contrib/bzip2 \
+ contrib/cardctl \
+ contrib/cfengine \
+ contrib/chkconfig \
+ contrib/chsh \
contrib/cksfv \
contrib/clisp \
+ contrib/configure \
contrib/cowsay \
contrib/cpan2dist \
+ contrib/cpio \
+ contrib/cups \
+ contrib/cvs \
+ contrib/dcop \
+ contrib/dd \
+ contrib/dhclient \
+ contrib/dict \
+ contrib/dpkg \
+ contrib/dselect \
contrib/dsniff \
+ contrib/findutils \
contrib/freeciv \
+ contrib/gcc \
contrib/gcl \
+ contrib/gdb \
+ contrib/genisoimage \
+ contrib/getent \
contrib/gkrellm \
contrib/gnatmake \
+ contrib/gpg \
contrib/gpg2 \
- contrib/harbour \
+ contrib/gzip \
+ contrib/heimdal \
+ contrib/iconv \
+ contrib/imagemagick \
+ contrib/info \
+ contrib/iptables \
+ contrib/ipmitool \
contrib/isql \
+ contrib/jar \
+ contrib/java \
+ contrib/kldload \
contrib/larch \
- contrib/lilypond \
+ contrib/ldapvi \
+ contrib/lftp \
+ contrib/lilo \
+ contrib/links \
contrib/lisp \
+ contrib/lvm \
contrib/lzma \
contrib/lzop \
contrib/mailman \
+ contrib/make \
+ contrib/man \
+ contrib/mc \
contrib/mcrypt \
+ contrib/mdadm \
contrib/minicom \
+ contrib/mkinitrd \
+ contrib/mock \
contrib/modules \
contrib/monodevelop \
+ contrib/mplayer \
+ contrib/msynctool \
contrib/mtx \
+ contrib/munin-node \
+ contrib/mutt \
+ contrib/mysqladmin \
+ contrib/ncftp \
contrib/net-tools \
+ contrib/ntpdate \
+ contrib/openldap \
+ contrib/openssl \
contrib/p4 \
+ contrib/perl \
+ contrib/pine \
+ contrib/pkg-config \
+ contrib/pkg_install \
+ contrib/pkgtools \
+ contrib/portupgrade \
+ contrib/postfix \
+ contrib/postgresql \
contrib/povray \
+ contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
+ contrib/rcs \
contrib/rdesktop \
+ contrib/repomanage \
+ contrib/reportbug \
+ contrib/resolvconf \
+ contrib/rfkill \
contrib/ri \
+ contrib/rpcdebug \
+ contrib/rpm \
+ contrib/rpmcheck \
+ contrib/rrdtool \
+ contrib/rsync \
+ contrib/samba \
contrib/sbcl \
+ contrib/screen \
+ contrib/shadow \
contrib/sitecopy \
+ contrib/smartctl \
contrib/snownews \
contrib/ssh \
- contrib/_subversion \
+ contrib/strace \
contrib/svk \
+ contrib/sysctl \
+ contrib/sysv-rc \
+ contrib/tar \
+ contrib/tcpdump \
contrib/unace \
- contrib/unrar
+ contrib/unrar \
+ contrib/update-alternatives \
+ contrib/vncviewer \
+ contrib/vpnc \
+ contrib/wireless-tools \
+ contrib/wodim \
+ contrib/wvdial \
+ contrib/xhost \
+ contrib/xm \
+ contrib/xmllint \
+ contrib/xmlwf \
+ contrib/xmms \
+ contrib/xrandr \
+ contrib/xz \
+ contrib/yp-tools \
+ contrib/yum-arch
-EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA)
+EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) contrib/_subversion contrib/_yum
diff --git a/Makefile.in b/Makefile.in
index 3f5510b5..41c405b9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -42,6 +44,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -49,18 +52,31 @@ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(sysconfdir)"
-bashcompDATA_INSTALL = $(INSTALL_DATA)
-sysconfDATA_INSTALL = $(INSTALL_DATA)
DATA = $(bashcomp_DATA) $(sysconf_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
- { test ! -d $(distdir) \
- || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr $(distdir); }; }
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
@@ -91,6 +107,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
@@ -138,51 +155,151 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
sysconf_DATA = bash_completion
bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/apache2ctl \
+bashcomp_DATA = contrib/ant \
+ contrib/apache2ctl \
+ contrib/apt \
+ contrib/apt-build \
+ contrib/aptitude \
+ contrib/aspell \
+ contrib/autorpm \
+ contrib/bash-builtins \
+ contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
+ contrib/bluez-utils \
contrib/brctl \
+ contrib/bzip2 \
+ contrib/cardctl \
+ contrib/cfengine \
+ contrib/chkconfig \
+ contrib/chsh \
contrib/cksfv \
contrib/clisp \
+ contrib/configure \
contrib/cowsay \
contrib/cpan2dist \
+ contrib/cpio \
+ contrib/cups \
+ contrib/cvs \
+ contrib/dcop \
+ contrib/dd \
+ contrib/dhclient \
+ contrib/dict \
+ contrib/dpkg \
+ contrib/dselect \
contrib/dsniff \
+ contrib/findutils \
contrib/freeciv \
+ contrib/gcc \
contrib/gcl \
+ contrib/gdb \
+ contrib/genisoimage \
+ contrib/getent \
contrib/gkrellm \
contrib/gnatmake \
+ contrib/gpg \
contrib/gpg2 \
- contrib/harbour \
+ contrib/gzip \
+ contrib/heimdal \
+ contrib/iconv \
+ contrib/imagemagick \
+ contrib/info \
+ contrib/iptables \
+ contrib/ipmitool \
contrib/isql \
+ contrib/jar \
+ contrib/java \
+ contrib/kldload \
contrib/larch \
- contrib/lilypond \
+ contrib/ldapvi \
+ contrib/lftp \
+ contrib/lilo \
+ contrib/links \
contrib/lisp \
+ contrib/lvm \
contrib/lzma \
contrib/lzop \
contrib/mailman \
+ contrib/make \
+ contrib/man \
+ contrib/mc \
contrib/mcrypt \
+ contrib/mdadm \
contrib/minicom \
+ contrib/mkinitrd \
+ contrib/mock \
contrib/modules \
contrib/monodevelop \
+ contrib/mplayer \
+ contrib/msynctool \
contrib/mtx \
+ contrib/munin-node \
+ contrib/mutt \
+ contrib/mysqladmin \
+ contrib/ncftp \
contrib/net-tools \
+ contrib/ntpdate \
+ contrib/openldap \
+ contrib/openssl \
contrib/p4 \
+ contrib/perl \
+ contrib/pine \
+ contrib/pkg-config \
+ contrib/pkg_install \
+ contrib/pkgtools \
+ contrib/portupgrade \
+ contrib/postfix \
+ contrib/postgresql \
contrib/povray \
+ contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
+ contrib/rcs \
contrib/rdesktop \
+ contrib/repomanage \
+ contrib/reportbug \
+ contrib/resolvconf \
+ contrib/rfkill \
contrib/ri \
+ contrib/rpcdebug \
+ contrib/rpm \
+ contrib/rpmcheck \
+ contrib/rrdtool \
+ contrib/rsync \
+ contrib/samba \
contrib/sbcl \
+ contrib/screen \
+ contrib/shadow \
contrib/sitecopy \
+ contrib/smartctl \
contrib/snownews \
contrib/ssh \
- contrib/_subversion \
+ contrib/strace \
contrib/svk \
+ contrib/sysctl \
+ contrib/sysv-rc \
+ contrib/tar \
+ contrib/tcpdump \
contrib/unace \
- contrib/unrar
-
-EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA)
+ contrib/unrar \
+ contrib/update-alternatives \
+ contrib/vncviewer \
+ contrib/vpnc \
+ contrib/wireless-tools \
+ contrib/wodim \
+ contrib/wvdial \
+ contrib/xhost \
+ contrib/xm \
+ contrib/xmllint \
+ contrib/xmlwf \
+ contrib/xmms \
+ contrib/xrandr \
+ contrib/xz \
+ contrib/yp-tools \
+ contrib/yum-arch
+
+EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) contrib/_subversion contrib/_yum
all: all-am
.SUFFIXES:
@@ -192,15 +309,15 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
- cd $(srcdir) && $(AUTOMAKE) --foreign \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -216,43 +333,50 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
- cd $(srcdir) && $(AUTOCONF)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
install-bashcompDATA: $(bashcomp_DATA)
@$(NORMAL_INSTALL)
test -z "$(bashcompdir)" || $(MKDIR_P) "$(DESTDIR)$(bashcompdir)"
- @list='$(bashcomp_DATA)'; for p in $$list; do \
+ @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \
+ for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(bashcompDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(bashcompdir)/$$f'"; \
- $(bashcompDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(bashcompdir)/$$f"; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompdir)" || exit $$?; \
done
uninstall-bashcompDATA:
@$(NORMAL_UNINSTALL)
- @list='$(bashcomp_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(bashcompdir)/$$f'"; \
- rm -f "$(DESTDIR)$(bashcompdir)/$$f"; \
- done
+ @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bashcompdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bashcompdir)" && rm -f $$files
install-sysconfDATA: $(sysconf_DATA)
@$(NORMAL_INSTALL)
test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
- @list='$(sysconf_DATA)'; for p in $$list; do \
+ @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
+ for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
- $(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \
done
uninstall-sysconfDATA:
@$(NORMAL_UNINSTALL)
- @list='$(sysconf_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
- rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
- done
+ @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files
tags: TAGS
TAGS:
@@ -262,7 +386,7 @@ CTAGS:
distdir: $(DISTFILES)
$(am__remove_distdir)
- test -d $(distdir) || mkdir $(distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -278,21 +402,26 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r $(distdir)
+ || chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
@@ -305,6 +434,10 @@ dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
@@ -333,6 +466,8 @@ distcheck: dist
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
@@ -344,9 +479,11 @@ distcheck: dist
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && cd $(distdir)/_build \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
@@ -368,13 +505,15 @@ distcheck: dist
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
- @cd $(distuninstallcheck_dir) \
+ @$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
@@ -418,6 +557,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -437,6 +577,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -445,18 +587,28 @@ install-data-am: install-bashcompDATA
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am: install-sysconfDATA
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -483,17 +635,18 @@ uninstall-am: uninstall-bashcompDATA uninstall-sysconfDATA
.PHONY: all all-am am--refresh check check-am clean clean-generic dist \
dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
- dist-zip distcheck distclean distclean-generic distcleancheck \
- distdir distuninstallcheck dvi dvi-am html html-am info \
- info-am install install-am install-bashcompDATA install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip install-sysconfDATA \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am uninstall uninstall-am uninstall-bashcompDATA \
- uninstall-sysconfDATA
+ dist-xz dist-zip distcheck distclean distclean-generic \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-bashcompDATA \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ install-sysconfDATA installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-bashcompDATA uninstall-sysconfDATA
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/README b/README
index c403179a..7cfd1bd6 100644
--- a/README
+++ b/README
@@ -450,6 +450,16 @@ guidelines in mind:
These forms of parameter substitutions can also be used on arrays,
which makes them very powerful (if a little slow).
+- Prefer "compgen -W '...' -- $cur" over embedding $cur in external
+ command arguments (often e.g. sed, grep etc) unless there's a good
+ reason to embed it. Embedding user input in command lines can
+ result in syntax errors and other undesired behavior, or messy
+ quoting requirements when the input contains unusual characters.
+ Good reasons for embedding include functionality (if the thing
+ does not sanely work otherwise) or performance (if it makes a big
+ difference in speed), but all embedding cases should be documented
+ with rationale in comments in the code.
+
- Do not write to the file-system under any circumstances. This can
create race conditions, is inefficient, violates the principle of
least surprise and lacks robustness.
diff --git a/aclocal.m4 b/aclocal.m4
index be700abf..99803da4 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -13,13 +13,13 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.63],,
-[m4_warning([this file was generated for autoconf 2.63.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
+[m4_warning([this file was generated for autoconf 2.64.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
-# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -31,10 +31,10 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.10'
+[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.10.1], [],
+m4_if([$1], [1.11], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -48,12 +48,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.1])dnl
+[AM_AUTOMAKE_VERSION([1.11])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
@@ -111,13 +111,13 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 13
+# serial 16
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
@@ -134,7 +134,7 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.60])dnl
+[AC_PREREQ([2.62])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -185,8 +185,8 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
@@ -194,24 +194,37 @@ AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
@@ -234,7 +247,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -245,7 +258,14 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
@@ -271,14 +291,14 @@ AC_SUBST([am__leading_dot])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
+# serial 6
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -295,7 +315,14 @@ AC_SUBST($1)])
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
@@ -333,13 +360,13 @@ esac
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 3
+# serial 4
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -356,7 +383,7 @@ AC_DEFUN([_AM_SET_OPTION],
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
@@ -366,14 +393,14 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
+# serial 5
# AM_SANITY_CHECK
# ---------------
@@ -382,16 +409,29 @@ AC_DEFUN([AM_SANITY_CHECK],
# Just in case
sleep 1
echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftest.file`
+ set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -444,18 +484,25 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 2
+
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 6868f2de..00000000
--- a/autogen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-autoreconf -i
-rm -rf autom4te.cache/
diff --git a/bash_completion b/bash_completion
index 552f8085..e1c40544 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1,8 +1,6 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
#
# bash_completion - programmable completion functions for bash 3.x
-# (backwards compatible with bash 2.05b)
+# (backwards compatible with bash 2.05b)
#
# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
# © 2009, Bash Completion Maintainers
@@ -26,52 +24,63 @@
#
# http://bash-completion.alioth.debian.org/
#
-# RELEASE: 1.0
+# RELEASE: 1.1
if [[ $- == *v* ]]; then
- BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
+ BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
else
- BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
+ BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
fi
if [[ -n $BASH_COMPLETION_DEBUG ]]; then
- set -v
+ set -v
else
- set +v
+ set +v
fi
# Alter the following to reflect the location of this file.
#
[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion
[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash_completion.d
-readonly BASH_COMPLETION BASH_COMPLETION_DIR
+[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
+readonly BASH_COMPLETION BASH_COMPLETION_DIR BASH_COMPLETION_COMPAT_DIR
# Set a couple of useful vars
#
UNAME=$( uname -s )
# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
UNAME=${UNAME/CYGWIN_*/Cygwin}
-RELEASE=$( uname -r )
+
+case ${UNAME} in
+ Linux|GNU|GNU/*) USERLAND=GNU ;;
+ *) USERLAND=${UNAME} ;;
+esac
# features supported by bash 2.05 and higher
if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
- [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash205=$BASH_VERSION 2>/dev/null || :
- default="-o default"
- dirnames="-o dirnames"
- filenames="-o filenames"
+ [ ${BASH_VERSINFO[0]} -gt 2 ]; then
+ declare -r bash205=$BASH_VERSION 2>/dev/null || :
+ default="-o default"
+ dirnames="-o dirnames"
+ filenames="-o filenames"
+ compopt=:
fi
# features supported by bash 2.05b and higher
if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
- [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash205b=$BASH_VERSION 2>/dev/null || :
- nospace="-o nospace"
+ [ ${BASH_VERSINFO[0]} -gt 2 ]; then
+ declare -r bash205b=$BASH_VERSION 2>/dev/null || :
+ nospace="-o nospace"
fi
# features supported by bash 3.0 and higher
if [ ${BASH_VERSINFO[0]} -gt 2 ]; then
- declare -r bash3=$BASH_VERSION 2>/dev/null || :
- bashdefault="-o bashdefault"
- plusdirs="-o plusdirs"
+ declare -r bash3=$BASH_VERSION 2>/dev/null || :
+ bashdefault="-o bashdefault"
+ plusdirs="-o plusdirs"
+fi
+# features supported by bash 4.0 and higher
+if [ ${BASH_VERSINFO[0]} -gt 3 ]; then
+ declare -r bash4=$BASH_VERSION 2>/dev/null || :
+ compopt=compopt
fi
# Turn on extended globbing and programmable completion
@@ -87,17 +96,16 @@ complete -d pushd
# Do NOT break these over multiple lines.
#
# START exclude -- do NOT remove this line
-complete -f -X '!*.?(t)bz?(2)' bunzip2
-# TODO: see #455510
-#complete -f -X '!*.?(t)bz?(2)' bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep
-complete -f -X '!*.*' bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep
+# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
+complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat
complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott|od[fgpst]|epub)' unzip zipinfo
complete -f -X '*.Z' compress znew
-complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip
-# TODO: see #455510
-#complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
-complete -f -X '!*.*' zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
+# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
+complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcat
complete -f -X '!*.Z' uncompress
+# lzcmp, lzdiff intentionally not here, see Debian: #455510
+complete -f -X '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
+complete -f -X '!*.@(xz|lzma)' unxz xzcat
complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
@@ -106,12 +114,13 @@ complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' kdvi
complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
-complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince okular
+complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince
+complete -f -X '!*.@(?(e|x)ps|?(E|X)PS|pdf|PDF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX|epub|EPUB|odt|ODT|fb|FB|mobi|MOBI|g3|G3|chm|CHM)?(.?(gz|GZ|bz2|BZ2))' okular
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.texi*' makeinfo texi2html
complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
-complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|ogg|OGG|ogm|OGM|wav|WAV|asx|ASX|mng|MNG|srt)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine
+complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|wav|WAV|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine
complete -f -X '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
@@ -119,30 +128,32 @@ complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.fig' xfig
complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi
-complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|kar|KAR)' timidity
+complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|s[3t]m|S[3T]M|kar|KAR)' timidity
+complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay
complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview
complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' emacs
complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine
complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya
-complete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter
-complete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress
-complete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc
+complete -f -X '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|odt|ott|odm)' oowriter
+complete -f -X '!*.@(sxi|sti|pps?(x)|ppt?([mx])|pot?([mx])|odp|otp)' ooimpress
+complete -f -X '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|ods|ots)' oocalc
complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase
complete -f -X '!*.rpm' rpm2cpio
complete -f -X '!*.sqlite' sqlite3
complete -f -X '!*.aux' bibtex
+complete -f -X '!*.po' poedit gtranslator kbabel lokalize
+complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
+complete -f -X '!*.[Hh][Rr][Bb]' hbrun
+complete -f -X '!*.ly' lilypond ly2dvi
# FINISH exclude -- do not remove this line
# start of section containing compspecs that can be handled within bash
# user commands see only users
-complete -u su usermod userdel passwd chage write chfn groups slay w sux
-
-# group commands see only groups
-[ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
+complete -u su passwd write chfn groups slay w sux
# bg completes with stopped jobs
complete -A stopped -P '"%' -S '"' bg
@@ -181,14 +192,14 @@ complete -b builtin
#
have()
{
- unset -v have
- PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
- have="yes"
+ unset -v have
+ PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
+ have="yes"
}
# use GNU sed if we have it, since its extensions are still used in our code
#
-[ $UNAME != Linux ] && have gsed && alias sed=gsed
+[ $USERLAND != GNU ] && have gsed && alias sed=gsed
# This function checks whether a given readline variable
# is `on'.
@@ -201,64 +212,166 @@ _rl_enabled()
# This function shell-quotes the argument
quote()
{
- echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
+ echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
}
-# This function quotes the argument in a way so that readline dequoting
+# This function quotes the argument in a way so that readline dequoting
# results in the original argument
quote_readline()
{
- local t="${1//\\/\\\\}"
- echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
+ if [ -n "$bash4" ] ; then
+ # This function isn't really necessary on bash 4
+ # See: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
+ echo "${1}"
+ return
+ fi
+ local t="${1//\\/\\\\}"
+ echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
}
# This function shell-dequotes the argument
dequote()
{
- eval echo "$1"
+ eval echo "$1" 2> /dev/null
}
-# Get the word to complete
+# Get the word to complete.
# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
# where the user is completing in the middle of a word.
# (For example, if the line is "ls foobar",
# and the cursor is here --------> ^
# it will complete just "foo", not "foobar", which is what the user wants.)
+# @param $1 string (optional) Characters out of $COMP_WORDBREAKS which should
+# NOT be considered word breaks. This is useful for things like scp where
+# we want to return host:path and not only path.
+# NOTE: This parameter only applies to bash-4.
+
+_get_cword()
+{
+ if [ -n "$bash4" ] ; then
+ __get_cword4 "$@"
+ else
+ __get_cword3
+ fi
+} # _get_cword()
+
+
+# Get the word to complete on bash-3, where words are not broken by
+# COMP_WORDBREAKS characters and the COMP_CWORD variables look like this, for
+# example:
#
+# $ a b:c<TAB>
+# COMP_CWORD: 1
+# COMP_CWORDS:
+# 0: a
+# 1: b:c
#
-# Accepts an optional parameter indicating which characters out of
-# $COMP_WORDBREAKS should NOT be considered word breaks. This is useful
-# for things like scp where we want to return host:path and not only path.
-_get_cword()
+# See also:
+# _get_cword, main routine
+# __get_cword4, bash-4 variant
+#
+__get_cword3()
{
- if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
- printf "%s" "${COMP_WORDS[COMP_CWORD]}"
- else
- local i
- local cur="$COMP_LINE"
- local index="$COMP_POINT"
- for (( i = 0; i <= COMP_CWORD; ++i )); do
- while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
- cur="${cur:1}"
- index="$(( index - 1 ))"
- done
- if [[ "$i" -lt "$COMP_CWORD" ]]; then
- local old_size="${#cur}"
- cur="${cur#${COMP_WORDS[i]}}"
- local new_size="${#cur}"
- index="$(( index - old_size + new_size ))"
- fi
- done
-
- if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
- # We messed up! At least return the whole word so things
- # keep working
- printf "%s" "${COMP_WORDS[COMP_CWORD]}"
- else
- printf "%s" "${cur:0:$index}"
- fi
- fi
-}
+ if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
+ printf "%s" "${COMP_WORDS[COMP_CWORD]}"
+ else
+ local i
+ local cur="$COMP_LINE"
+ local index="$COMP_POINT"
+ for (( i = 0; i <= COMP_CWORD; ++i )); do
+ while [[
+ # Current COMP_WORD fits in $cur?
+ "${#cur}" -ge ${#COMP_WORDS[i]} &&
+ # $cur doesn't match COMP_WORD?
+ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}"
+ ]]; do
+ # Strip first character
+ cur="${cur:1}"
+ # Decrease cursor position
+ index="$(( index - 1 ))"
+ done
+
+ # Does found COMP_WORD matches COMP_CWORD?
+ if [[ "$i" -lt "$COMP_CWORD" ]]; then
+ # No, COMP_CWORD lies further;
+ local old_size="${#cur}"
+ cur="${cur#${COMP_WORDS[i]}}"
+ local new_size="${#cur}"
+ index="$(( index - old_size + new_size ))"
+ fi
+ done
+
+ if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
+ # We messed up! At least return the whole word so things
+ # keep working
+ printf "%s" "${COMP_WORDS[COMP_CWORD]}"
+ else
+ printf "%s" "${cur:0:$index}"
+ fi
+ fi
+} # __get_cword3()
+
+
+# Get the word to complete on bash-4, where words are splitted by
+# COMP_WORDBREAKS characters (default is " \t\n\"'><=;|&(:") and the COMP_CWORD
+# variables look like this, for example:
+#
+# $ a b:c<TAB>
+# COMP_CWORD: 3
+# COMP_CWORDS:
+# 0: a
+# 1: b
+# 2: :
+# 3: c
+#
+# @oaram $1 string
+# $1 string (optional) Characters out of $COMP_WORDBREAKS which should
+# NOT be considered word breaks. This is useful for things like scp where
+# we want to return host:path and not only path.
+# See also:
+# _get_cword, main routine
+# __get_cword3, bash-3 variant
+#
+__get_cword4()
+{
+ local i
+ local LC_CTYPE=C
+ local WORDBREAKS=$COMP_WORDBREAKS
+ # Strip single quote (') and double quote (") from WORDBREAKS to
+ # workaround a bug in bash-4.0, where quoted words are split
+ # unintended, see:
+ # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
+ # This fixes simple quoting (e.g. $ a "b<TAB> returns "b instead of b)
+ # but still fails quoted spaces (e.g. $ a "b c<TAB> returns c instead
+ # of "b c).
+ WORDBREAKS=${WORDBREAKS//\"/}
+ WORDBREAKS=${WORDBREAKS//\'/}
+ if [ -n "$1" ]; then
+ for (( i=0; i<${#1}; ++i )); do
+ local char=${1:$i:1}
+ WORDBREAKS=${WORDBREAKS//$char/}
+ done
+ fi
+ local cur=${COMP_LINE:0:$COMP_POINT}
+ local tmp=$cur
+ local word_start=`expr "$tmp" : '.*['"$WORDBREAKS"']'`
+ while [ "$word_start" -ge 2 ]; do
+ # Get character before $word_start
+ local char=${cur:$(( $word_start - 2 )):1}
+ # If the WORDBREAK character isn't escaped, exit loop
+ if [ "$char" != "\\" ]; then
+ break
+ fi
+ # The WORDBREAK character is escaped;
+ # Recalculate $word_start
+ tmp=${COMP_LINE:0:$(( $word_start - 2 ))}
+ word_start=`expr "$tmp" : '.*['"$WORDBREAKS"']'`
+ done
+
+ cur=${cur:$word_start}
+ printf "%s" "$cur"
+} # __get_cword4()
+
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
@@ -267,104 +380,121 @@ _get_cword()
#
_filedir()
{
- local IFS=$'\t\n' xspec
-
- _expand || return 0
-
- local -a toks
- local tmp
-
- # TODO: I've removed a "[ -n $tmp ] &&" before `echo $tmp',
- # and everything works again. If this bug
- # suddenly appears again (i.e. "cd /b<TAB>"
- # becomes "cd /"), remember to check for
- # other similar conditionals (here and
- # _filedir_xspec()). --David
- # NOTE: The comment above has been moved outside of the subshell below,
- # because quotes-in-comments-in-a-subshell cause errors on
- # bash-3.1. See also:
- # http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html
- toks=( ${toks[@]-} $(
- compgen -d -- "$(quote_readline "$cur")" | {
- while read -r tmp; do
- echo $tmp
- done
- }
- ))
-
- if [[ "$1" != -d ]]; then
- xspec=${1:+"!*.$1"}
- toks=( ${toks[@]-} $(
- compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
- while read -r tmp; do
- [ -n $tmp ] && echo $tmp
- done
- }
- ))
- fi
-
- COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+ local IFS=$'\t\n' xspec
+
+ _expand || return 0
+
+ local -a toks
+ local tmp
+
+ # TODO: I've removed a "[ -n $tmp ] &&" before `echo $tmp',
+ # and everything works again. If this bug
+ # suddenly appears again (i.e. "cd /b<TAB>"
+ # becomes "cd /"), remember to check for
+ # other similar conditionals (here and
+ # _filedir_xspec()). --David
+ # NOTE: The comment above has been moved outside of the subshell below,
+ # because quotes-in-comments-in-a-subshell cause errors on
+ # bash-3.1. See also:
+ # http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html
+ toks=( ${toks[@]-} $(
+ compgen -d -- "$(quote_readline "$cur")" | {
+ while read -r tmp; do
+ echo $tmp
+ done
+}
+))
+
+if [[ "$1" != -d ]]; then
+ xspec=${1:+"!*.$1"}
+ toks=( ${toks[@]-} $(
+ compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
+ while read -r tmp; do
+ [ -n $tmp ] && echo $tmp
+ done
+}
+))
+ fi
+
+ COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+}
+
+# This function splits $cur=--foo=bar into $prev=--foo, $cur=bar, making it
+# easier to support both "--foo bar" and "--foo=bar" style completions.
+# Returns 0 if current option was split, 1 otherwise.
+#
+_split_longopt()
+{
+ if [[ "$cur" == --?*=* ]]; then
+ # Cut also backslash before '=' in case it ended up there
+ # for some reason.
+ prev="${cur%%?(\\)=*}"
+ cur="${cur#*=}"
+ return 0
+ fi
+
+ return 1
}
# This function tries to parse the output of $command --help
#
_parse_help() {
- local cmd
- cmd=$1
- $cmd --help | \
- grep -- "^[[:space:]]*-" | \
- tr "," " " | \
- awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | \
- sed -e "s:=.*::g"
+ local cmd
+ cmd=$1
+ $cmd --help | \
+ grep -- "^[[:space:]]*-" | \
+ tr "," " " | \
+ awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | \
+ sed -e "s:=.*::g"
}
# This function completes on signal names
#
_signals()
{
- local i
-
- # standard signal completion is rather braindead, so we need
- # to hack around to get what we want here, which is to
- # complete on a dash, followed by the signal name minus
- # the SIG prefix
- COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- COMPREPLY[i]=-${COMPREPLY[i]#SIG}
- done
+ local i
+
+ # standard signal completion is rather braindead, so we need
+ # to hack around to get what we want here, which is to
+ # complete on a dash, followed by the signal name minus
+ # the SIG prefix
+ COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
+ for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
+ COMPREPLY[i]=-${COMPREPLY[i]#SIG}
+ done
}
# This function completes on configured network interfaces
#
_configured_interfaces()
{
- if [ -f /etc/debian_version ]; then
- # Debian system
- COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
- /etc/network/interfaces ) )
- elif [ -f /etc/SuSE-release ]; then
- # SuSE system
- COMPREPLY=( $( command ls \
- /etc/sysconfig/network/ifcfg-* | \
- sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
- elif [ -f /etc/pld-release ]; then
- # PLD Linux
- COMPREPLY=( $( command ls -B \
- /etc/sysconfig/interfaces | \
- sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
- else
- # Assume Red Hat
- COMPREPLY=( $( command ls \
- /etc/sysconfig/network-scripts/ifcfg-* | \
- sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
- fi
+ if [ -f /etc/debian_version ]; then
+ # Debian system
+ COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
+ /etc/network/interfaces ) )
+ elif [ -f /etc/SuSE-release ]; then
+ # SuSE system
+ COMPREPLY=( $( command ls \
+ /etc/sysconfig/network/ifcfg-* | \
+ sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ elif [ -f /etc/pld-release ]; then
+ # PLD Linux
+ COMPREPLY=( $( command ls -B \
+ /etc/sysconfig/interfaces | \
+ sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ else
+ # Assume Red Hat
+ COMPREPLY=( $( command ls \
+ /etc/sysconfig/network-scripts/ifcfg-* | \
+ sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
+ fi
}
# This function completes on available kernels
#
_kernel_versions()
{
- COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
+ COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
# This function completes on all available network interfaces
@@ -373,39 +503,39 @@ _kernel_versions()
#
_available_interfaces()
{
- local cmd
-
- if [ "${1:-}" = -w ]; then
- cmd="iwconfig"
- elif [ "${1:-}" = -a ]; then
- cmd="ifconfig"
- else
- cmd="ifconfig -a"
- fi
-
- COMPREPLY=( $( eval $cmd 2>/dev/null | \
- sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
+ local cmd
+
+ if [ "${1:-}" = -w ]; then
+ cmd="iwconfig"
+ elif [ "${1:-}" = -a ]; then
+ cmd="ifconfig"
+ else
+ cmd="ifconfig -a"
+ fi
+
+ COMPREPLY=( $( eval $cmd 2>/dev/null | \
+ sed -ne 's|^\('"$cur"'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
}
# This function expands tildes in pathnames
#
_expand()
{
- # FIXME: Why was this here?
- #[ "$cur" != "${cur%\\}" ] && cur="$cur\\"
-
- # Expand ~username type directory specifications. We want to expand
- # ~foo/... to /home/foo/... to avoid problems when $cur starting with
- # a tilde is fed to commands and ending up quoted instead of expanded.
-
- if [[ "$cur" == \~*/* ]]; then
- eval cur=$cur
- elif [[ "$cur" == \~* ]]; then
- cur=${cur#\~}
- COMPREPLY=( $( compgen -P '~' -u $cur ) )
- [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}
- return ${#COMPREPLY[@]}
- fi
+ # FIXME: Why was this here?
+ #[ "$cur" != "${cur%\\}" ] && cur="$cur\\"
+
+ # Expand ~username type directory specifications. We want to expand
+ # ~foo/... to /home/foo/... to avoid problems when $cur starting with
+ # a tilde is fed to commands and ending up quoted instead of expanded.
+
+ if [[ "$cur" == \~*/* ]]; then
+ eval cur=$cur
+ elif [[ "$cur" == \~* ]]; then
+ cur=${cur#\~}
+ COMPREPLY=( $( compgen -P '~' -u "$cur" ) )
+ [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}
+ return ${#COMPREPLY[@]}
+ fi
}
# This function completes on process IDs.
@@ -413,11 +543,11 @@ _expand()
[ $UNAME = SunOS -o $UNAME = AIX ] &&
_pids()
{
- COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur ))
+ COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" ))
} ||
_pids()
{
- COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- "$cur" ) )
}
# This function completes on process group IDs.
@@ -425,11 +555,11 @@ _pids()
[ $UNAME = SunOS -o $UNAME = AIX ] &&
_pgids()
{
- COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur ))
+ COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" ))
} ||
_pgids()
{
- COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur ))
+ COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- "$cur" ))
}
# This function completes on process names.
@@ -437,110 +567,115 @@ _pgids()
[ $UNAME = SunOS -o $UNAME = AIX ] &&
_pnames()
{
- COMPREPLY=( $( compgen -W '$( command ps -efo comm | \
- sed -e 1d -e "s:.*/::" -e "s/^-//" \
- -e "s/^<defunct>$//")' \
- -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( command ps -efo comm | \
+ sed -e 1d -e "s:.*/::" -e "s/^-//" \
+ -e "s/^<defunct>$//")' \
+ -- "$cur" ) )
} ||
_pnames()
{
- # FIXME: completes "[kblockd/0]" to "0". Previously it was completed
- # to "kblockd" which isn't correct either. "kblockd/0" would be
- # arguably most correct, but killall from psmisc 22 treats arguments
- # containing "/" specially unless -r is given so that wouldn't quite
- # work either. Perhaps it'd be best to not complete these to anything
- # for now.
- # Not using "ps axo comm" because under some Linux kernels, it
- # truncates command names (see e.g. http://bugs.debian.org/497540#19)
- COMPREPLY=( $( compgen -W '$( command ps axo command | \
- sed -e "1d; s/ .*//; s:.*/::; s/:$//;" \
- -e "s/^[[(-]//; s/[])]$//" \
- -e "s/^<defunct>$//")' \
- -- $cur ) )
+ # FIXME: completes "[kblockd/0]" to "0". Previously it was completed
+ # to "kblockd" which isn't correct either. "kblockd/0" would be
+ # arguably most correct, but killall from psmisc 22 treats arguments
+ # containing "/" specially unless -r is given so that wouldn't quite
+ # work either. Perhaps it'd be best to not complete these to anything
+ # for now.
+ # Not using "ps axo comm" because under some Linux kernels, it
+ # truncates command names (see e.g. http://bugs.debian.org/497540#19)
+ COMPREPLY=( $( compgen -W '$( command ps axo command= | \
+ sed -e "s/ .*//; s:.*/::; s/:$//;" \
+ -e "s/^[[(-]//; s/[])]$//" \
+ -e "s/^<defunct>$//")' \
+ -- "$cur" ) )
}
# This function completes on user IDs
#
_uids()
{
- if type getent &>/dev/null; then
- COMPREPLY=( $( getent passwd | \
- awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
- elif type perl &>/dev/null; then
- COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
- else
- # make do with /etc/passwd
- COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
- /etc/passwd ) )
- fi
+ if type getent &>/dev/null; then
+ COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" ) )
+ elif type perl &>/dev/null; then
+ COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" ) )
+ else
+ # make do with /etc/passwd
+ COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" ) )
+ fi
}
# This function completes on group IDs
#
_gids()
{
- if type getent &>/dev/null; then
- COMPREPLY=( $( getent group | \
- awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
- elif type perl &>/dev/null; then
- COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) )
- else
- # make do with /etc/group
- COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
- /etc/group ) )
- fi
+ if type getent &>/dev/null; then
+ COMPREPLY=( $( getent group | \
+ awk -F: '{if ($3 ~ /^'"$cur"'/) print $3}' ) )
+ elif type perl &>/dev/null; then
+ COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" ) )
+ else
+ # make do with /etc/group
+ COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'"$cur"'/) print $3}'\
+ /etc/group ) )
+ fi
}
# This function completes on services
#
_services()
{
- local sysvdir famdir
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
- famdir=/etc/xinetd.d
- COMPREPLY=( $( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)) )
+ local sysvdir famdir
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
+ famdir=/etc/xinetd.d
+ COMPREPLY=( $( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)) )
- if [ -d $famdir ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) )
- fi
+ if [ -d $famdir ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) )
+ fi
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
}
# This function completes on modules
#
_modules()
{
- local modpath
- modpath=/lib/modules/$1
- COMPREPLY=( $( command ls -R $modpath | \
- sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
+ local modpath
+ modpath=/lib/modules/$1
+ COMPREPLY=( $( command ls -R $modpath | \
+ sed -ne 's/^\('"$cur"'.*\)\.k\?o\(\|.gz\)$/\1/p') )
}
# This function completes on installed modules
#
_installed_modules()
{
- COMPREPLY=( $( compgen -W "$( /sbin/lsmod | \
- awk '{if (NR != 1) print $1}' )" -- $1 ) )
+ COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" lsmod | \
+ awk '{if (NR != 1) print $1}' )" -- $1 ) )
}
# This function completes on user:group format
#
_usergroup()
{
- local IFS=$'\n'
- cur=${cur//\\\\ / }
- if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
- user=${cur%%*([^:.])}
- COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
- elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
- COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
- else
- COMPREPLY=( $( compgen -S : -u -- $cur ) )
- fi
+ local IFS=$'\n'
+ cur=${cur//\\\\ / }
+ if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
+ user=${cur%%*([^:.])}
+ COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
+ elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
+ COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
+ else
+ COMPREPLY=( $( compgen -S : -u -- "$cur" ) )
+ fi
}
+# This function completes on valid shells
+#
+_shells()
+{
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( grep "^[[:space:]]*/" \
+ /etc/shells 2>/dev/null )' -- "$cur" ) )
+}
# Get real command.
# - arg: $1 Command
@@ -548,15 +683,15 @@ _usergroup()
# Empty string if command not found.
# - return: True (0) if command found, False (> 0) if not.
_realcommand() {
- type -P "$1" > /dev/null && {
- if type -p realpath > /dev/null; then
- realpath "$(type -P "$1")"
- elif type -p readlink > /dev/null; then
- readlink -f "$(type -P "$1")"
- else
- type -P "$1"
- fi
- }
+ type -P "$1" > /dev/null && {
+ if type -p realpath > /dev/null; then
+ realpath "$(type -P "$1")"
+ elif type -p readlink > /dev/null; then
+ readlink -f "$(type -P "$1")"
+ else
+ type -P "$1"
+ fi
+}
}
@@ -564,485 +699,306 @@ _realcommand() {
#
_count_args()
{
- args=1
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- args=$(($args+1))
- fi
- done
+ args=1
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ args=$(($args+1))
+ fi
+ done
}
-# This function complete on PCI IDs
+# This function completes on PCI IDs
#
_pci_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} \
- $( compgen -W "$( lspci -n | awk '{print $3}')" -- $cur ) )
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
}
-# This function complete on USB IDs
+# This function completes on USB IDs
#
_usb_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} \
- $( compgen -W "$( lsusb | awk '{print $6}')" -- $cur ) )
-}
-
-# start of section containing completion functions for bash built-ins
-
-# bash alias completion
-#
-_alias()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$COMP_LINE" in
- *[^=])
- COMPREPLY=( $( compgen -A alias -- $cur ) )
- ;;
- *=)
- COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \
- sed -e 's|^alias '$cur'\(.*\)$|\1|' )" )
- ;;
- esac
-}
-complete -F _alias $nospace alias
-
-# bash export completion
-#
-_export()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$COMP_LINE" in
- *=\$*)
- COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) )
- ;;
- *[^=])
- COMPREPLY=( $( compgen -v -S '=' -- $cur ) )
- ;;
- *=)
- COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
- ( echo -n \'
- sed -e 's/'\''/'\''\\\'\'''\''/g'
- echo -n \' ) )" )
- ;;
- esac
-}
-complete -F _export $default $nospace export
-
-# bash shell function completion
-#
-_function()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ $1 == @(declare|typeset) ]]; then
- if [ "$prev" = -f ]; then
- COMPREPLY=( $( compgen -A function -- $cur ) )
- elif [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
- $cur ) )
- fi
- elif [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -A function -- $cur ) )
- else
- COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
- fi
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
}
-complete -F _function function declare typeset
-
-# bash complete completion
-#
-_complete()
-{
- local cur prev options
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -o)
- options="default dirnames filenames"
- [ -n "$bash205b" ] && options="$options nospace"
- [ -n "$bash3" ] && options="$options bashdefault plusdirs"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- return 0
- ;;
-
- -A)
- COMPREPLY=( $( compgen -W 'alias arrayvar binding \
- builtin command directory disabled enabled \
- export file function group helptopic hostname \
- job keyword running service setopt shopt \
- signal stopped user variable' -- $cur ) )
- return 0
- ;;
-
- -C)
- COMPREPLY=( $( compgen -A command -- $cur ) )
- return 0
- ;;
- -F)
- COMPREPLY=( $( compgen -A function -- $cur ) )
- return 0
- ;;
- -@(p|r))
- COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
- grep "^$cur" ) )
- return 0
- ;;
-
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
- [ -n "$bash205" ] && options="$options -o"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- COMPREPLY=( $( compgen -A command -- $cur ) )
- fi
-}
-complete -F _complete complete
# start of section containing completion functions for external programs
# a little help for FreeBSD ports users
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
- extract patch configure build install reinstall \
- deinstall clean clean-depends kernel buildworld' make
+extract patch configure build install reinstall \
+deinstall clean clean-depends kernel buildworld' make
# This completes on a list of all available service scripts for the
# 'service' command and/or the SysV init.d directory, followed by
# that script's available commands
#
{ have service || [ -d /etc/init.d/ ]; } &&
-_service()
-{
- local cur sysvdir
-
- COMPREPLY=()
- prev=${COMP_WORDS[COMP_CWORD-1]}
- cur=`_get_cword`
-
- # don't complete for things like killall, ssh and mysql if it's
- # the standalone command, rather than the init script
- [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
-
- # don't complete past 2nd token
- [ $COMP_CWORD -gt 2 ] && return 0
-
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
-
- if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
- _services
- else
- COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
- s/^.*Usage.*{\(.*\)}.*$/\1/p" \
- $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) )
- fi
-
- return 0
-} &&
-complete -F _service service
-[ -d /etc/init.d/ ] && complete -F _service $default \
- $(for i in /etc/init.d/*; do echo ${i##*/}; done)
-
-# chown(1) completion
-#
-_chown()
-{
- local cur
- cur=`_get_cword`
-
- # options completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
- --dereference --no-dereference --from= --silent --quiet \
- --reference= --recursive --verbose --help --version' -- $cur ) )
- else
- _count_args
-
- case $args in
- 1)
- _usergroup
- ;;
- *)
- _filedir
- ;;
- esac
- fi
-}
-complete -F _chown $filenames chown
-
-# chgrp(1) completion
-#
-_chgrp()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- cur=${cur//\\\\/}
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # options completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
- --dereference --no-dereference --silent --quiet \
- --reference= --recursive --verbose --help --version' -- $cur ) )
- return 0
- fi
-
- # first parameter on line or first since an option?
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
- [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
- local IFS=$'\n'
- COMPREPLY=( $( compgen -g $cur 2>/dev/null ) )
- else
- _filedir || return 0
- fi
-
- return 0
-}
-complete -F _chgrp $filenames chgrp
-
-# umount(8) completion. This relies on the mount point being the third
-# space-delimited field in the output of mount(8)
-#
-_umount()
-{
- local cur IFS=$'\n'
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
-
- return 0
-}
-complete -F _umount $dirnames umount
-
-# mount(8) completion. This will pull a list of possible mounts out of
-# /etc/{,v}fstab, unless the word being completed contains a ':', which
-# would indicate the specification of an NFS server. In that case, we
-# query the server for a list of all available exports and complete on
-# that instead.
-#
-_mount()
-{
- local cur i sm host
-
- COMPREPLY=()
- cur=`_get_cword`
- [[ "$cur" == \\ ]] && cur="/"
-
- for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
-
- if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
- COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
- grep ^${cur#*:} | awk '{print $1}' ) )
- elif [[ "$cur" == //* ]]; then
- host=${cur#//}
- host=${host%%/*}
- if [ -n "$host" ]; then
- COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
- sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
- sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
- fi
- elif [ -r /etc/vfstab ]; then
- # Solaris
- COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
- /etc/vfstab | grep "^$cur" ) )
- elif [ ! -e /etc/fstab ]; then
- # probably Cygwin
- COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
- | grep "^$cur" ) )
- else
- # probably Linux
- COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
- /etc/fstab | grep "^$cur" ) )
- fi
-
- return 0
-}
-complete -F _mount $default $dirnames mount
-
-# Linux rmmod(8) completion. This completes on a list of all currently
-# installed kernel modules.
-#
-have rmmod && {
-_rmmod()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _installed_modules "$cur"
- return 0
-}
-complete -F _rmmod rmmod
-
-# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
-# list of all available modules for the version of the kernel currently
-# running.
-#
-_insmod()
-{
- local cur prev modpath
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # behave like lsmod for modprobe -r
- if [ $1 = "modprobe" ] &&
- [ "${COMP_WORDS[1]}" = "-r" ]; then
- _installed_modules "$cur"
- return 0
- fi
-
- # do filename completion if we're giving a path to a module
- if [[ "$cur" == */* ]]; then
- _filedir '@(?(k)o?(.gz))'
- return 0
- fi
-
- if [ $COMP_CWORD -gt 1 ] &&
- [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
- # do module parameter completion
- COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
- awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \
- else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) )
- else
- _modules $(uname -r)
- fi
-
- return 0
-}
-complete -F _insmod $filenames insmod modprobe modinfo
-}
-
-# man(1) completion
-#
-[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
- -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
- -o $UNAME = OpenBSD ] &&
-_man()
-{
- local cur prev sect manpath manext mansect UNAME
-
- manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))"
- mansect="@([0-9lnp]|[0-9][px])"
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ "$prev" == -l ]]; then
- _filedir $manext
- return 0
- fi
-
- _expand || return 0
-
- # file based completion if parameter contains /
- if [[ "$cur" == */* ]]; then
- _filedir $manext
- return 0
- fi
-
- UNAME=$( uname -s )
- # strip OS type and version under Cygwin
- UNAME=${UNAME/CYGWIN_*/Cygwin}
- if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \
- -o $UNAME = Cygwin ]; then
- manpath=$( manpath 2>/dev/null || command man --path )
- else
- manpath=$MANPATH
- fi
-
- if [ -z "$manpath" ]; then
- COMPREPLY=( $( compgen -c -- $cur ) )
- return 0
- fi
-
- # determine manual section to search
- [[ "$prev" == $mansect ]] && sect=$prev || sect='*'
-
- manpath=$manpath:
- if [ -n "$cur" ]; then
- manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
- else
- manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
- fi
-
- # redirect stderr for when path doesn't exist
- COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
- # weed out directory path names and paths to man pages
- COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
- # strip suffix from man pages
- COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
-
- if [[ "$prev" != $mansect ]]; then
- # File based completion for the rest, prepending ./ if needed
- # (man 1.6f needs that for man pages in current dir)
- local start=${#COMPREPLY[@]}
- _filedir $manext
- for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
- [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
- done
- fi
-
- return 0
+ _service()
+ {
+ local cur prev sysvdir
+
+ COMPREPLY=()
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ cur=`_get_cword`
+
+ # don't complete for things like killall, ssh and mysql if it's
+ # the standalone command, rather than the init script
+ [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
+
+ # don't complete past 2nd token
+ [ $COMP_CWORD -gt 2 ] && return 0
+
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
+ || sysvdir=/etc/init.d
+
+ if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
+ _services
+ else
+ COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
+ s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\1/p" \
+ $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
+ fi
+
+ return 0
+ } &&
+ complete -F _service service
+ [ -d /etc/init.d/ ] && complete -F _service $default \
+ $(for i in /etc/init.d/*; do echo ${i##*/}; done)
+
+ # chown(1) completion
+ #
+ _chown()
+ {
+ local cur prev split=false
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --from)
+ _usergroup
+ return 0
+ ;;
+ --reference)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ # options completion
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
+ --dereference --no-dereference --from --silent --quiet \
+ --reference --recursive --verbose --help --version' -- "$cur" ) )
+ else
+ _count_args
+
+ case $args in
+ 1)
+ _usergroup
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+ fi
+ }
+ complete -F _chown $filenames chown
+
+ # chgrp(1) completion
+ #
+ _chgrp()
+ {
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ cur=${cur//\\\\/}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ if [[ "$prev" == --reference ]]; then
+ _filedir
+ return 0
+ fi
+
+ $split && return 0
+
+ # options completion
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
+ --dereference --no-dereference --silent --quiet \
+ --reference --recursive --verbose --help --version' -- "$cur" ) )
+ return 0
+ fi
+
+ # first parameter on line or first since an option?
+ if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
+ [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
+ else
+ _filedir || return 0
+ fi
+
+ return 0
+ }
+ complete -F _chgrp $filenames chgrp
+
+ # umount(8) completion. This relies on the mount point being the third
+ # space-delimited field in the output of mount(8)
+ #
+ _umount()
+ {
+ local cur IFS=$'\n'
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
+
+ return 0
+ }
+ complete -F _umount $dirnames umount
+
+ # mount(8) completion. This will pull a list of possible mounts out of
+ # /etc/{,v}fstab, unless the word being completed contains a ':', which
+ # would indicate the specification of an NFS server. In that case, we
+ # query the server for a list of all available exports and complete on
+ # that instead.
+ #
+ _mount()
+ {
+ local cur i sm host prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ [[ "$cur" == \\ ]] && cur="/"
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
+
+ if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
+ COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
+ grep ^${cur#*:} | awk '{print $1}' ) )
+ elif [[ "$cur" == //* ]]; then
+ host=${cur#//}
+ host=${host%%/*}
+ if [ -n "$host" ]; then
+ COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
+ sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
+ sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
+ fi
+ elif [ -r /etc/vfstab ]; then
+ # Solaris
+ COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) )
+ elif [ ! -e /etc/fstab ]; then
+ # probably Cygwin
+ COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) )
+ else
+ # probably Linux
+ if [ $prev = -L ]; then
+ COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*LABEL=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
+ elif [ $prev = -U ]; then
+ COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- "$cur" ) )
+ fi
+ fi
+
+ return 0
+ }
+ complete -F _mount $default $dirnames mount
+
+ # Linux rmmod(8) completion. This completes on a list of all currently
+ # installed kernel modules.
+ #
+ have rmmod && {
+ _rmmod()
+ {
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _installed_modules "$cur"
+ return 0
+ }
+ complete -F _rmmod rmmod
+
+ # Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
+ # list of all available modules for the version of the kernel currently
+ # running.
+ #
+ _insmod()
+ {
+ local cur prev modpath
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ # behave like lsmod for modprobe -r
+ if [ $1 = "modprobe" ] &&
+ [ "${COMP_WORDS[1]}" = "-r" ]; then
+ _installed_modules "$cur"
+ return 0
+ fi
+
+ # do filename completion if we're giving a path to a module
+ if [[ "$cur" == */* ]]; then
+ _filedir '@(?(k)o?(.gz))'
+ return 0
+ fi
+
+ if [ $COMP_CWORD -gt 1 ] &&
+ [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
+ # do module parameter completion
+ COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
+ awk '{if ($1 ~ /^parm:/ && $2 ~ /^'"$cur"'/) { print $2 } \
+ else if ($1 !~ /:/ && $1 ~ /^'"$cur"'/) { print $1 }}' ) )
+ else
+ _modules $(uname -r)
+ fi
+
+ return 0
+ }
+ complete -F _insmod $filenames insmod modprobe modinfo
}
-[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
- -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
- -o $UNAME = OpenBSD ] && \
-complete -F _man $filenames man apropos whatis
# renice(8) completion
#
_renice()
{
- local command cur curopt i
-
- COMPREPLY=()
- cur=`_get_cword`
- command=$1
-
- i=0
- # walk back through command line and find last option
- while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
- curopt=${COMP_WORDS[COMP_CWORD-$i]}
- case "$curopt" in
- -u)
- COMPREPLY=( $( compgen -u -- $cur ) )
- ;;
- -g)
- _pgids
- ;;
- -p|$command)
- _pids
- ;;
- esac
- i=$(( ++i ))
- done
+ local command cur curopt i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ command=$1
+
+ i=0
+ # walk back through command line and find last option
+ while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
+ curopt=${COMP_WORDS[COMP_CWORD-$i]}
+ case "$curopt" in
+ -u)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ ;;
+ -g)
+ _pgids
+ ;;
+ -p|$command)
+ _pids
+ ;;
+ esac
+ i=$(( ++i ))
+ done
}
complete -F _renice renice
@@ -1050,18 +1006,18 @@ complete -F _renice renice
#
_kill()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
- # return list of available signals
- _signals
- else
- # return list of available PIDs
- _pids
- fi
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
+ # return list of available signals
+ _signals
+ else
+ # return list of available PIDs
+ _pids
+ fi
}
complete -F _kill kill
@@ -1070,18 +1026,18 @@ complete -F _kill kill
[ $UNAME = Linux -o $UNAME = FreeBSD ] || have pkill &&
_killall()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
- _signals
- else
- _pnames
- fi
+ if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
+ _signals
+ else
+ _pnames
+ fi
- return 0
+ return 0
}
[ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall
have pkill && complete -F _killall pkill
@@ -1091,2147 +1047,337 @@ have pkill && complete -F _killall pkill
[ $UNAME = Linux ] || have pgrep &&
_pgrep()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- _pnames
+ _pnames
- return 0
+ return 0
}
have pgrep && complete -F _pgrep pgrep
# Linux pidof(8) completion.
[ $UNAME = Linux ] && complete -F _pgrep pidof
-# GNU find(1) completion. This makes heavy use of ksh style extended
-# globs and contains Linux specific code for completing the parameter
-# to the -fstype option.
-#
-_find()
-{
- local cur prev i exprfound onlyonce
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(max|min)depth)
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) )
- return 0
- ;;
- -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
- _filedir
- return 0
- ;;
- -fstype)
- # this is highly non-portable
- [ -e /proc/filesystems ] &&
- COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \
- grep "^$cur" ) )
- return 0
- ;;
- -gid)
- _gids
- return 0
- ;;
- -group)
- if [ -n "$bash205" ]; then
- COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
- fi
- return 0
- ;;
- -?(x)type)
- COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) )
- return 0
- ;;
- -uid)
- _uids
- return 0
- ;;
- -user)
- COMPREPLY=( $( compgen -u -- $cur ) )
- return 0
- ;;
- -exec|-ok)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
- _command
- return 0
- ;;
- -[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \
- -links|-perm|-size|-used|-printf)
- # do nothing, just wait for a parameter to be given
- return 0
- ;;
- esac
-
- _expand || return 0
-
- # set exprfound to 1 if there is already an expression present
- for i in ${COMP_WORDS[@]}; do
- [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
- done
-
- # handle case where first parameter is not a dash option
- if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
- _filedir -d
- return 0
- fi
-
- # complete using basic options
- COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
- -mindepth -mount -noleaf -version -xdev -amin -anewer \
- -atime -cmin -cnewer -ctime -empty -false -fstype \
- -gid -group -ilname -iname -inum -ipath -iregex \
- -wholename \
- -links -lname -mmin -mtime -name -newer -nouser \
- -nogroup -perm -regex -size -true -type -uid -used \
- -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
- -print -print0 -printf -prune -ls -wholename -iwholename' -- $cur ) )
-
- # this removes any options from the list of completions that have
- # already been specified somewhere on the command line, as long as
- # these options can only be used once (in a word, "options", in
- # opposition to "tests" and "actions", as in the find(1) manpage).
- onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
- -noleaf -version -xdev '
- COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
- (while read -d ' ' i; do
- [ "$i" == "" ] ||
- [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
- continue
- # flatten array with spaces on either side,
- # otherwise we cannot grep on word boundaries of
- # first and last word
- COMPREPLY=" ${COMPREPLY[@]} "
- # remove word from list of completions
- COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
- done
- echo "${COMPREPLY[@]}")
- ) )
-
- _filedir
-
- return 0
-}
-complete -F _find $filenames find
-
-# Linux iwconfig(8) completion
-#
-[ $UNAME = Linux ] && have iwconfig &&
-_iwconfig()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- mode)
- COMPREPLY=( $( compgen -W 'managed ad-hoc master \
- repeater secondary monitor' -- $cur ) )
- return 0
- ;;
- essid)
- COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} scan | \
- awk -F '"' '/ESSID/ {print $2}' | \
- grep "^$cur" ))
- fi
- return 0
- ;;
- nwid)
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
- return 0
- ;;
- channel)
- COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $2}' | \
- grep "^$cur" ) )
- return 0
- ;;
-
- freq)
- COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
- grep "^$cur" ) )
- return 0
- ;;
- ap)
- COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
- if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} scan | \
- awk -F ': ' '/Address/ {print $2}' | \
- grep "^$cur" ) )
- fi
- return 0
- ;;
- rate)
- COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} rate | \
- awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
- grep "^$cur" ) )
- return 0
- ;;
- rts)
- COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
- return 0
- ;;
- frag)
- COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
- return 0
- ;;
- key)
- COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
- return 0
- ;;
- enc)
- COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
- return 0
- ;;
- power)
- COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) )
- return 0
- ;;
- txpower)
- COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) )
- return 0
- ;;
- retry)
- COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) )
- return 0
- ;;
- esac
-
- if [ $COMP_CWORD -eq 1 ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
- else
- _available_interfaces -w
- fi
- else
- COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
- ap nick rate rts frag enc key power txpower commit' -- $cur ) )
- fi
-
-} &&
-complete -F _iwconfig iwconfig
-
-# Linux iwlist(8) completion
-#
-[ $UNAME = Linux ] && have iwlist &&
-_iwlist()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [ $COMP_CWORD -eq 1 ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
- else
- _available_interfaces -w
- fi
- else
- COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
- channel rate bit bitrate key enc encryption power \
- txpower retry ap accesspoint peers event' -- $cur ) )
- fi
-} &&
-complete -F _iwlist iwlist
-
-# Linux iwspy(8) completion
-#
-[ $UNAME = Linux ] && have iwspy &&
-_iwspy()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
- else
- _available_interfaces -w
- fi
- else
- COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) )
- fi
-} &&
-complete -F _iwspy iwspy
-
-# Linux iwpriv(8) completion
-#
-[ $UNAME = Linux ] && have iwpriv &&
-_iwpriv()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- roam)
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
- return 0
- ;;
- port)
- COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) )
- return 0
- ;;
- esac
-
- if [ $COMP_CWORD -eq 1 ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
- else
- _available_interfaces -w
- fi
- else
- COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) )
- fi
-} &&
-complete -F _iwpriv iwpriv
-
# Red Hat & Debian GNU/Linux if{up,down} completion
#
-[ $UNAME = Linux ] && { have ifup || have ifdown; } &&
+[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
_ifupdown()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [ $COMP_CWORD -eq 1 ]; then
- _configured_interfaces
- COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
- fi
+ if [ $COMP_CWORD -eq 1 ]; then
+ _configured_interfaces
+ COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
+ fi
- return 0
+ return 0
} &&
complete -F _ifupdown ifup ifdown
-[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus
+[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
# Linux ipsec(8) completion (for FreeS/WAN)
#
[ $UNAME = Linux ] && have ipsec &&
_ipsec()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
- manual pluto ranbits rsasigkey \
- setup showdefaults showhostkey spi \
- spigrp tncfg whack' -- $cur ) )
- return 0
- fi
-
- case ${COMP_WORDS[1]} in
- auto)
- COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
- --replace --down --route --unroute \
- --ready --status --rereadsecrets' \
- -- $cur ) )
- ;;
- manual)
- COMPREPLY=( $( compgen -W '--up --down --route --unroute \
- --union' -- $cur ) )
- ;;
- ranbits)
- COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
- -- $cur ) )
- ;;
- setup)
- COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) )
- ;;
-
- *)
- ;;
- esac
-
- return 0
-} &&
-complete -F _ipsec ipsec
-
-# Postfix completion.
-#
-have postfix && {
-# postfix(1)
-#
-_postfix()
-{
- local cur prev
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ $cur == '-' ]]; then
- COMPREPLY=(-c -D -v)
- return 0
- fi
- if [[ $prev == '-c' ]]; then
- _filedir -d
- return 0
- fi
- if [[ $prev == '-D' ]]; then
- COMPREPLY=( $( compgen -W 'start' -- "`_get_cword`" ) )
- return 0
- fi
- COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
- "`_get_cword`" ) )
-}
-complete -F _postfix postfix
-
-# postalias(1) and postmap(1)
-#
-_postmap()
-{
- local cur prev len idx
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ $cur == '-' ]]; then
- COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q)
- return 0
- fi
- if [[ $prev == '-c' ]]; then
- _filedir -d
- return 0
- fi
- if [[ $prev == -[dq] ]]; then
- return 0
- fi
-
- if [[ "$cur" == *:* ]]; then
- COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
- else
- len=${#cur}
- idx=0
- for pval in $( /usr/sbin/postconf -m ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]="$pval:"
- idx=$(($idx+1))
- fi
- done
- if [[ $idx -eq 0 ]]; then
- COMPREPLY=( $( compgen -f -- "$cur" ) )
- fi
- fi
- return 0
-}
-complete -F _postmap postmap postalias
-
-# postcat(1)
-#
-_postcat()
-{
- local cur prev pval len idx qfile
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ $cur == '-' ]]; then
- COMPREPLY=(-c -q -v)
- return 0
- fi
- if [[ $prev == '-c' ]]; then
- _filedir -d
- return 0
- fi
-
- qfile=0
- for idx in "${COMP_WORDS[@]}"; do
- [[ "$idx" = -q ]] && qfile=1 && break
- done
- if [[ $qfile == 1 ]]; then
- len=${#cur}
- idx=0
- for pval in $( mailq | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]=$pval
- idx=$(($idx+1))
- fi
- done
- return 0
- else
- _filedir
- return 0
- fi
-}
-complete -F _postcat postcat
-
-# postconf(1)
-#
-_postconf()
-{
- local cur prev pval len idx eqext
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- if [[ $cur == '-' ]]; then
- COMPREPLY=(-c -d -e -h -m -l -n -v)
- return 0
- fi
- if [[ $prev == '-c' ]]; then
- _filedir -d
- return 0
- fi
- if [[ $prev == '-e' ]]; then
- cur=${cur#[\"\']}
- eqext='='
- fi
- len=${#cur}
- idx=0
- for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]="$pval$eqext"
- idx=$(($idx+1))
- fi
- done
- return 0
-}
-complete -F _postconf postconf
-
-# postsuper(1)
-#
-_postsuper()
-{
- local cur prev pval len idx
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ $cur == '-' ]]; then
- COMPREPLY=(-c -d -h -H -p -r -s -v)
- return 0
- fi
- case $prev in
- -[dr])
- len=${#cur}
- idx=0
- for pval in $( echo ALL; mailq | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]=$pval
- idx=$(($idx+1))
- fi
- done
- return 0
- ;;
- -h)
- len=${#cur}
- idx=0
- for pval in $( echo ALL; mailq | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]=$pval
- idx=$(($idx+1))
- fi
- done
- return 0
- ;;
- -H)
- len=${#cur}
- idx=0
- for pval in $( echo ALL; mailq | \
- sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
- if [[ "$cur" == "${pval:0:$len}" ]]; then
- COMPREPLY[$idx]=$pval
- idx=$(($idx+1))
- fi
- done
- return 0
- ;;
- esac
- COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
- return 0
-}
-complete -F _postsuper postsuper
-}
-
-# cvs(1) completion
-#
-have cvs && {
-set_prefix()
-{
- [ -z ${prefix:-} ] || prefix=${cur%/*}/
- [ -r ${prefix:-}CVS/Entries ] || prefix=""
-}
-
-get_entries()
-{
- local IFS=$'\n'
- [ -r ${prefix:-}CVS/Entries ] && \
- entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
-}
-
-get_modules()
-{
- if [ -n "$prefix" ]; then
- COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
- else
- COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
- fi
-}
-
-_cvs()
-{
- local cur count mode i cvsroot cvsroots pwd
- local -a flags miss files entries changed newremoved
-
- COMPREPLY=()
- cur=`_get_cword`
-
- count=0
- for i in "${COMP_WORDS[@]}"; do
- [ $count -eq $COMP_CWORD ] && break
- # Last parameter was the CVSROOT, now go back to mode selection
- if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
- mode=""
- fi
- if [ -z "$mode" ]; then
- case $i in
- -d)
- mode=cvsroot
- cvsroot=${COMP_WORDS[((count+1))]}
- ;;
- @(ad?(d)|new))
- mode=add
- ;;
- @(adm?(in)|rcs))
- mode=admin
- ;;
- ann?(notate))
- mode=annotate
- ;;
- @(checkout|co|get))
- mode=checkout
- ;;
- @(com?(mit)|ci))
- mode=commit
- ;;
- di?(f?(f)))
- mode=diff
- ;;
- ex?(p?(ort)))
- mode=export
- ;;
- ?(un)edit)
- mode=$i
- ;;
- hi?(s?(tory)))
- mode=history
- ;;
- im?(p?(ort)))
- mode=import
- ;;
- re?(l?(ease)))
- mode=release
- ;;
- ?(r)log)
- mode=log
- ;;
- @(rdiff|patch))
- mode=rdiff
- ;;
- @(remove|rm|delete))
- mode=remove
- ;;
- @(rtag|rfreeze))
- mode=rtag
- ;;
- st?(at?(us)))
- mode=status
- ;;
- @(tag|freeze))
- mode=tag
- ;;
- up?(d?(ate)))
- mode=update
- ;;
- *)
- ;;
- esac
- elif [[ "$i" = -* ]]; then
- flags=( "${flags[@]}" $i )
- fi
- count=$((++count))
- done
-
- case "$mode" in
- add)
- if [[ "$cur" != -* ]]; then
- set_prefix
- if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
- get_entries
- [ -z "$cur" ] && \
- files=$( command ls -Ad !(CVS) ) || \
- files=$( command ls -d ${cur}* 2>/dev/null )
- for i in "${entries[@]}"; do
- files=( ${files[@]/#$i//} )
- done
- COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- \
- $cur ) )
- fi
- else
- COMPREPLY=( $( compgen -W '-k -m' -- $cur ) )
- fi
- ;;
- admin)
- if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \
- -L -U -m -M -n -N -o -q -I \
- -s -t -t- -T -V -x -z' -- \
- $cur ) )
- fi
- ;;
- annotate)
- if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) )
- else
- get_entries
- COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) )
- fi
- ;;
- checkout)
- if [[ "$cur" != -* ]]; then
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
- COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
- awk '{print $1}' ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
- -s -r -D -d -k -j' -- $cur ) )
- fi
- ;;
- commit)
- set_prefix
-
- if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
- # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
- # complete on remotely checked-out files (requires
- # passwordless access to the remote repository
- if [ -n "${COMP_CVS_REMOTE:-}" ]; then
- # this is the least computationally intensive
- # way found so far, but other changes
- # (something other than changed/removed/new)
- # may be missing
- changed=( $( cvs -q diff --brief 2>&1 | \
- sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
- newremoved=( $( cvs -q diff --brief 2>&1 | \
- sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
- COMPREPLY=( $( compgen -W '${changed[@]:-} \
- ${newremoved[@]:-}' -- $cur ) )
- else
- COMPREPLY=( $(compgen $default -- "$cur") )
- fi
- else
- COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \
- $cur ) )
- fi
- ;;
- cvsroot)
- if [ -r ~/.cvspass ]; then
- # Ugly escaping because of bash treating ':' specially
- cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
- COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
- fi
- ;;
- export)
- if [[ "$cur" != -* ]]; then
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
- COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W '-N -f -l -R -n \
- -r -D -d -k' -- $cur ) )
- fi
- ;;
- diff)
- if [[ "$cur" == -* ]]; then
- _longopt diff
- else
- get_entries
- COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) )
- fi
- ;;
- remove)
- if [[ "$cur" != -* ]]; then
- set_prefix
- if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
- get_entries
- # find out what files are missing
- for i in "${entries[@]}"; do
- [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
- done
- COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
- fi
- else
- COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) )
- fi
- ;;
- import)
- if [[ "$cur" != -* ]]; then
- # starts with same algorithm as checkout
- [ -z "$cvsroot" ] && cvsroot=$CVSROOT
- prefix=${cur%/*}
- if [ -r ${cvsroot}/${prefix} ]; then
- get_modules
- COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
- COMPREPLY=( ${COMPREPLY[@]#\/} )
- fi
- pwd=$( pwd )
- pwd=${pwd##*/}
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
- $cur ) )
- else
- COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur ))
- fi
- ;;
- update)
- if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
- -k -r -D -j -I -W' -- \
- $cur ) )
- fi
- ;;
- "")
- COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
- commit diff delete edit export \
- freeze get history import log new \
- patch rcs rdiff release remove \
- rfreeze rlog rm rtag stat status \
- tag unedit up update -H -Q -q -b \
- -d -e -f -l -n -t -r -v -w -x -z \
- --help --version' -- $cur ) )
- ;;
- *)
- ;;
- esac
-
- return 0
-}
-complete -F _cvs $default cvs
-}
-
-have rpm && {
-# helper functions for rpm completion
-#
-_rpm_installed_packages()
-{
- local ver nodig="$1" nosig="$2"
-
- if [ -r /var/log/rpmpkgs -a \
- /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
- # using RHL 7.2 or later - this is quicker than querying the DB
- COMPREPLY=( $( sed -ne \
- 's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \
- /var/log/rpmpkgs ) )
- else
- _rpm_nodigsig
- COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) )
- fi
-}
-
-_rpm_groups()
-{
- local IFS=$'\t'
- # remove trailing backslash, or grep will complain
- cur=${cur%"\\"}
- COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
- grep "^$cur" ) )
- # backslash escape spaces and translate newlines to tabs
- COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
-}
-
-_rpm_nodigsig()
-{
- if [ -z "$nodig" -a -z "$nosig" ]; then
- local rpmver
-
- rpmver=$(rpm --version)
- rpmver=${rpmver##* }
-
- if [[ "$rpmver" > "4.0.4" ]]; then
- nodig="--nodigest"
- fi
- if [[ "$rpmver" > "4.0.99" ]]; then
- nosig="--nosignature"
- fi
- fi
-}
-
-# rpm(8) completion
-#
-_rpm()
-{
- local cur prev nodig nosig
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- nodig=""
- nosig=""
- _rpm_nodigsig
-
- if [ $COMP_CWORD -eq 1 ]; then
- # first parameter on line
- case "$cur" in
- -b*)
- COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\
- -- $cur ) )
- ;;
- -t*)
- COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\
- -- $cur ) )
- ;;
- --*)
- COMPREPLY=( $( compgen -W '--help --version --initdb \
- --checksig --recompile --rebuild --resign --addsign \
- --rebuilddb --showrc --setperms --setugids --tarbuild \
- --eval --install --upgrade --query --freshen --erase \
- --verify --querytags --rmsource --rmspec --clean \
- --import' -- $cur ) )
- ;;
- *)
- COMPREPLY=( $( compgen -W '-b -e -E -F -i -q -t -U -V' \
- -- $cur ) )
- ;;
- esac
-
- return 0
- fi
-
- case "$prev" in
- --@(@(db|exclude)path|prefix|relocate|root))
- _filedir -d
- return 0
- ;;
- --eval|-E)
- # get a list of macros
- COMPREPLY=( $( rpm --showrc | sed -ne \
- 's/^-\?[0-9]\+[:=][[:space:]]\+\('${cur#%}'[^[:space:](]*\).*/\1/p' ) )
- COMPREPLY=( "${COMPREPLY[@]/#/%}" )
- return 0
- ;;
- --pipe)
- COMPREPLY=( $( compgen -c -- $cur ) )
- return 0
- ;;
- --rcfile)
- _filedir
- return 0
- ;;
- --specfile)
- # complete on .spec files
- _filedir spec
- return 0
- ;;
- --whatprovides)
- if [[ "$cur" == */* ]]; then
- _filedir
- else
- # complete on capabilities
- COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
- '%{providename}\n' | grep "^$cur" ) )
- fi
- return 0
- ;;
- --whatrequires)
- # complete on capabilities
- COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
- '%{requirename}\n' | grep "^$cur" ) )
- return 0
- ;;
- --target)
- COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
- 's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" -- $cur ) )
- return 0
- ;;
- esac
-
- case "${COMP_WORDS[1]}" in
- -@([iFU]*|-install|-freshen|-upgrade))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--percent --force --test \
- --replacepkgs --replacefiles --root --excludedocs \
- --includedocs --noscripts --rcfile --ignorearch \
- --dbpath --prefix --ignoreos --nodeps --allfiles \
- --ftpproxy --ftpport --justdb --httpproxy --httpport \
- --noorder --relocate --badreloc --notriggers \
- --excludepath --ignoresize --oldpackage --define \
- --eval --pipe --queryformat --repackage --nosuggests \
- --nodigest --nosignature' -- $cur ) )
- else
- _filedir 'rpm'
- fi
- ;;
- -@(e|-erase))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--allmatches --noscripts \
- --notriggers --nodeps --test --repackage' -- $cur ) )
- else
- _rpm_installed_packages "$nodig" "$nosig"
- fi
- ;;
- -@(q*|-query))
- # check whether we're doing file completion
- if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--scripts --root \
- --rcfile --requires --ftpport --ftpproxy \
- --httpproxy --httpport --provides --triggers \
- --dump --changelog --dbpath \
- --last --filesbypkg \
- --info --list --state \
- --docfiles --configfiles --queryformat \
- --conflicts --obsoletes \
- --nodigest --nosignature \
- --suggests --enhances \
- --triggerscripts' -- $cur ) )
- else
- _filedir
- fi
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
- _rpm_groups
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
- # uninstalled package completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--scripts --root \
- --rcfile --whatprovides --whatrequires \
- --requires --triggeredby --ftpport --ftpproxy \
- --httpproxy --httpport --provides --triggers \
- --dump --changelog --dbpath --filesbypkg \
- --define --eval --pipe --showrc --info --list \
- --state --docfiles --configfiles --queryformat\
- --conflicts --obsoletes --nodigest \
- --nosignature' -- $cur ) )
- else
- _filedir 'rpm'
- fi
- else
- # installed package completion
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--scripts --root \
- --rcfile --whatprovides --whatrequires \
- --requires --triggeredby --ftpport --ftpproxy \
- --httpproxy --httpport --provides --triggers \
- --dump --changelog --dbpath --specfile \
- --querybynumber --last --filesbypkg --define \
- --eval --pipe --showrc --info --list --state \
- --docfiles --configfiles --queryformat \
- --conflicts --obsoletes --pkgid --hdrid \
- --fileid --tid --nodigest --nosignature \
- --triggerscripts' -- $cur ) )
- elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
- _rpm_installed_packages "$nodig" "$nosig"
- fi
- fi
- ;;
- -@(K*|-checksig))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \
- --nodigest --nosignature' -- $cur ) )
- else
- _filedir 'rpm'
- fi
- ;;
- -@([Vy]*|-verify))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \
- --nodeps --nogroup --nolinkto --nomode --nomtime \
- --nordev --nouser --nofiles --noscripts --nomd5 \
- --querytags --specfile --whatrequires --whatprovides \
- --nodigest --nosignature' -- $cur ) )
- # check whether we're doing file completion
- elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
- _filedir
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
- _rpm_groups
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
- _filedir 'rpm'
- else
- _rpm_installed_packages "$nodig" "$nosig"
- fi
- ;;
- -[bt]*)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--short-circuit --timecheck \
- --clean --rmsource --rmspec --test --sign --buildroot \
- --target --nobuild --nodeps --nodirtokens' -- $cur ) )
- elif [[ ${COMP_WORDS[1]} == -b* ]]; then
- _filedir 'spec'
- else
- _filedir '@(tgz|tar.@(gz|bz2|lzma))'
- fi
- ;;
- --re@(build|compile))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--nodeps --rmsource \
- --rmspec --sign --nodirtokens --target' -- $cur ) )
- else
- _filedir '?(no)src.rpm'
- fi
- ;;
- --tarbuild)
- _filedir '@(tgz|tar.@(gz|bz2|lzma))'
- ;;
- --@(re|add)sign)
- _filedir 'rpm'
- ;;
- --set@(perms|gids))
- _rpm_installed_packages "$nodig" "$nosig"
- ;;
- --@(clean|rms@(ource|pec)))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--clean --rmsource \
- --rmspec' -- $cur ) )
- else
- _filedir 'spec'
- fi
- ;;
- --@(import|dbpath|root))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--import --dbpath --root' \
- -- $cur ) )
- else
- _filedir
- fi
- ;;
- esac
-
- return 0
-}
-complete -F _rpm $filenames rpm rpmbuild
-}
-
-# Debian apt-get(8) completion.
-#
-have apt-get &&
-_apt_get()
-{
- local cur prev special i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
-
- if [ -n "$special" ]; then
- case $special in
- remove|autoremove|purge)
- if [ -f /etc/debian_version ]; then
- # Debian system
- COMPREPLY=( $( _comp_dpkg_installed_packages \
- $cur ) )
- else
- # assume RPM based
- _rpm_installed_packages
- fi
- return 0
- ;;
- *)
- COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
- return 0
- ;;
-
- esac
- fi
-
- case "$prev" in
- -@(c|-config-file))
- _filedir
- return 0
- ;;
-
- -@(t|-target-release|-default-release))
- COMPREPLY=( $( apt-cache policy | \
- grep "release.o=Debian,a=$cur" | \
- sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
- return 0
- ;;
-
- esac
-
- if [[ "$cur" == -* ]]; then
-
- COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \
- -u -t -b -c -o --download-only --fix-broken \
- --help --version --ignore-missing \
- --fix-missing --no-download --quiet --simulate \
- --just-print --dry-run --recon --no-act --yes \
- --assume-yes --show-upgraded --only-source \
- --compile --build --ignore-hold \
- --target-release --no-upgrade --force-yes \
- --print-uris --purge --reinstall \
- --list-cleanup --default-release \
- --trivial-only --no-remove --diff-only \
- --no-install-recommends \
- --tar-only --config-file --option --auto-remove' -- $cur ) )
- else
-
- COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
- dist-upgrade install remove purge source build-dep \
- check clean autoclean autoremove' -- $cur ) )
-
- fi
-
-
- return 0
-} &&
-complete -F _apt_get $filenames apt-get
-
-# Debian apt-cache(8) completion.
-#
-have apt-cache &&
-_apt_cache()
-{
- local cur prev special i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
-
- if [ "$cur" != show ]; then
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
- fi
-
-
- if [ -n "$special" ]; then
- case $special in
- add)
- _filedir
- return 0
- ;;
-
- showsrc)
- COMPREPLY=( $( apt-cache dumpavail | \
- grep "^Source: $cur" | sort | \
- uniq | cut -f2 -d" " ) )
- return 0
- ;;
-
- *)
- COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
- return 0
- ;;
-
- esac
- fi
-
-
- case "$prev" in
- -@(c|p|s|-config-file|-@(pkg|src)-cache))
- _filedir
- return 0
- ;;
- search)
- if [[ "$cur" != -* ]]; then
- return 0
- fi
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
-
- COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
- -o --help --version --pkg-cache --src-cache \
- --quiet --important --full --all-versions \
- --no-all-versions --generate --no-generate \
- --names-only --all-names --recurse \
- --config-file --option --installed' -- $cur ) )
- else
-
- COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
- stats dump dumpavail unmet search search \
- depends rdepends pkgnames dotty xvcg \
- policy madison' -- $cur ) )
-
- fi
-
-
- return 0
-} &&
-complete -F _apt_cache $filenames apt-cache
-
+ local cur
-# Debian aptitude(1) completion
-#
-have aptitude && {
-have grep-status && {
-_comp_dpkg_hold_packages()
-{
- grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
-}
-} || {
-_comp_dpkg_hold_packages()
-{
- grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \
- | cut -d\ -f2
-}
-}
+ COMPREPLY=()
+ cur=`_get_cword`
-_aptitude()
-{
- local cur dashoptions prev special i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
-
- dashoptions='-S -u -i -h --help --version -s --simulate -d \
- --download-only -P --prompt -y --assume-yes -F \
- --display-format -O --sort -w --width -f -r -g \
- --with-recommends --with-suggests -R -G \
- --without-recommends --without-suggests -t \
- --target-release -V --show-versions -D --show-deps\
- -Z -v --verbose --purge-unused --schedule-only'
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- 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
- special=${COMP_WORDS[i]}
- fi
- #exclude some mutually exclusive options
- [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
- [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
- done
-
- if [[ -n "$special" ]]; then
- case $special in
- @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
- COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
- return 0
- ;;
- @(purge|remove|reinstall|forbid-version))
- COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
- return 0
- ;;
- unhold)
- COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) )
- return 0
- ;;
-
- esac
- fi
-
- case $prev in
- # don't complete anything if these options are found
- @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
- return 0
- ;;
-
- -S)
- _filedir
- return 0
- ;;
-
- -@(t|-target-release|-default-release))
- COMPREPLY=( $( apt-cache policy | \
- grep "release.o=Debian,a=$cur" | \
- sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
- return 0
- ;;
-
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
- else
- COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \
- autoclean install reinstall remove \
- hold unhold purge markauto unmarkauto why why-not \
- dist-upgrade full-upgrade download search show \
- forbid-version changelog keep-all' -- $cur ) )
- fi
-
-
- return 0
-}
-complete -F _aptitude $default aptitude
-}
-# Debian apt-build(1) completion.
-#
-have apt-build &&
-_apt_build()
-{
- local cur prev special i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
-
- if [ -n "$special" ]; then
- case $special in
- @(install|source|info))
- COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
- return 0
- ;;
- remove)
- COMPREPLY=( $( _comp_dpkg_installed_packages \
- $cur ) )
- return 0
- ;;
- *)
- return 0
- ;;
- esac
- fi
-
- case "$prev" in
-
- --@(patch|build-dir|repository-dir))
- _filedir
- return 0
- ;;
-
- -@(h|-help))
- return 0
- ;;
-
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
- --repository-dir --build-only \
- --build-command --reinstall --rebuild \
- --remove-builddep --no-wrapper --purge \
- --patch --patch-strip -p --yes -y \
- --version -v --no-source' -- $cur ) )
-
- else
- COMPREPLY=( $( compgen -W 'update upgrade install remove \
- source dist-upgrade world clean info \
- clean-build update-repository ' -- $cur ) )
- fi
-
-
- return 0
-} &&
-complete -F _apt_build $filenames apt-build
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
+ manual pluto ranbits rsasigkey \
+ setup showdefaults showhostkey spi \
+ spigrp tncfg whack' -- "$cur" ) )
+ return 0
+ fi
-# chsh(1) completion
-#
-_chsh()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [ "$prev" = "-s" ]; then
- if [ -f /etc/debian_version ]; then
- COMPREPLY=( $( </etc/shells ) )
- else
- COMPREPLY=( $( chsh -l | grep "^$cur" ) )
- fi
- else
- COMPREPLY=( $( compgen -u -- $cur ) )
- fi
-
- return 0
-}
-complete -F _chsh chsh
+ case ${COMP_WORDS[1]} in
+ auto)
+ COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
+ --replace --down --route --unroute \
+ --ready --status --rereadsecrets' \
+ -- "$cur" ) )
+ ;;
+ manual)
+ COMPREPLY=( $( compgen -W '--up --down --route --unroute \
+ --union' -- "$cur" ) )
+ ;;
+ ranbits)
+ COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
+ -- "$cur" ) )
+ ;;
+ setup)
+ COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
+ ;;
+ *)
+ ;;
+ esac
-# chkconfig(8) completion
-#
-have chkconfig &&
-_chkconfig()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- @([1-6]|--@(list|add|del)))
- _services
- return 0
- ;;
- --level)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
- else
- if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
- COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
- else
- _services
- fi
- fi
+ return 0
} &&
-complete -F _chkconfig chkconfig
+complete -F _ipsec ipsec
# This function provides simple user@host completion
#
_user_at_host() {
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ $cur == *@* ]]; then
- _known_hosts
- else
- COMPREPLY=( $( compgen -u -- "$cur" ) )
- fi
+ if [[ $cur == *@* ]]; then
+ _known_hosts_real "$cur"
+ else
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ fi
- return 0
+ return 0
}
shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
-# This function performs host completion based on ssh's known_hosts files,
-# defaulting to standard host completion if they don't exist.
-#
-# Arguments: -a Use aliases
-# -c Use `:' suffix
-# -F configfile Use `configfile' for configuration settings
+# NOTE: Using this function as a helper function is deprecated. Use
+# `_known_hosts_real' instead.
_known_hosts()
{
- local configfile
- local cur curd ocur user suffix aliases global_kh user_kh hosts i host
- local -a kh khd config
-
- COMPREPLY=()
- cur=`_get_cword`
- ocur=$cur
-
- local OPTIND=1
- while getopts "acF:" flag "$@"; do
- case $flag in
- a) aliases='yes' ;;
- c) suffix=':' ;;
- F) configfile="$OPTARG" ;;
- esac
- done
-
- [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
- kh=()
-
- # ssh config files
- if [ -n "$configfile" ]; then
- [ -r "$configfile" ] &&
- config=( "${config[@]}" "$configfile" )
- else
- [ -r /etc/ssh/ssh_config ] &&
- config=( "${config[@]}" "/etc/ssh/ssh_config" )
- [ -r "${HOME}/.ssh/config" ] &&
- config=( "${config[@]}" "${HOME}/.ssh/config" )
- [ -r "${HOME}/.ssh2/config" ] &&
- config=( "${config[@]}" "${HOME}/.ssh2/config" )
- fi
-
- if [ ${#config[@]} -gt 0 ]; then
- # expand path (if present) to global known hosts file
- 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[@]}" )" )
- # expand path (if present) to user known hosts file
- 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[@]}" )" )
- fi
-
- # Global known_hosts files
- [ -r "$global_kh" ] &&
- kh=( "${kh[@]}" "$global_kh" )
- if [ -z "$configfile" ]; then
- [ -r /etc/ssh/ssh_known_hosts ] &&
- kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
- [ -r /etc/ssh/ssh_known_hosts2 ] &&
- kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
- [ -r /etc/known_hosts ] &&
- kh=( "${kh[@]}" /etc/known_hosts )
- [ -r /etc/known_hosts2 ] &&
- kh=( "${kh[@]}" /etc/known_hosts2 )
- [ -d /etc/ssh2/knownhosts ] &&
- khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
- fi
-
- # User known_hosts files
- [ -r "$user_kh" ] &&
- kh=( "${kh[@]}" "$user_kh" )
- if [ -z "$configfile" ]; then
- [ -r ~/.ssh/known_hosts ] &&
- kh=( "${kh[@]}" ~/.ssh/known_hosts )
- [ -r ~/.ssh/known_hosts2 ] &&
- kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
- [ -d ~/.ssh2/hostkeys ] &&
- khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
- fi
-
- # If we have known_hosts files to use
- if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
- # Escape slashes and dots in paths for awk
- cur=${cur//\//\\\/}
- cur=${cur//\./\\\.}
- curd=$cur
-
- if [[ "$cur" == [0-9]*.* ]]; then
- # Digits followed by a dot - just search for that
- cur="^$cur.*"
- elif [[ "$cur" == [0-9]* ]]; then
- # Digits followed by no dot - search for digits followed
- # by a dot
- cur="^$cur.*\."
- elif [ -z "$cur" ]; then
- # A blank - search for a dot or an alpha character
- cur="[a-z.]"
- else
- cur="^$cur"
- fi
-
- if [ ${#kh[@]} -gt 0 ]; then
-
- # FS needs to look for a comma separated list
- COMPREPLY=( $( awk 'BEGIN {FS=","}
- /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
- gsub(" .*$", "", $i); \
- if ($i ~ /'$cur'/) {print $i} \
- }}' "${kh[@]}" 2>/dev/null ) )
- fi
- if [ ${#khd[@]} -gt 0 ]; then
- # Needs to look for files called
- # .../.ssh2/key_22_<hostname>.pub
- # dont fork any processes, because in a cluster environment,
- # there can be hundreds of hostkeys
- for i in "${khd[@]}" ; do
- if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then
- host=${i/#*key_22_/}
- host=${host/%.pub/}
- COMPREPLY=( "${COMPREPLY[@]}" $host )
- fi
- done
- fi
- # append any available aliases from config files
- if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
- local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
- hosts=$( compgen -W "$host_aliases" -- $ocur )
- COMPREPLY=( "${COMPREPLY[@]}" $hosts )
- fi
-
- # Now add results of normal hostname completion
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) )
-
- # apply suffix
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- COMPREPLY[i]=$user${COMPREPLY[i]}$suffix
- done
- elif [ -z "$configfile" ]; then
- # Just do normal hostname completion
- COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) )
- fi
-
- return 0
-}
-complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
- ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
+ local options
+ COMPREPLY=()
-# rsync(1) completion
-#
-have rsync &&
-_rsync()
-{
- local cur prev shell i userhost path
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- _expand || return 0
-
- case "$prev" in
- --@(config|password-file|include-from|exclude-from))
- _filedir
- return 0
- ;;
- -@(T|-temp-dir|-compare-dest))
- _filedir -d
- return 0
- ;;
- -@(e|-rsh))
- COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
- return 0
- ;;
- esac
-
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
- -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
- -z -h -4 -6 --verbose --quiet --checksum \
- --archive --recursive --relative --backup \
- --backup-dir --suffix= --update --links \
- --copy-links --copy-unsafe-links --safe-links \
- --hard-links --perms --owner --group --devices\
- --times --sparse --dry-run --whole-file \
- --no-whole-file --one-file-system \
- --block-size= --rsh= --rsync-path= \
- --cvs-exclude --existing --ignore-existing \
- --delete --delete-excluded --delete-after \
- --ignore-errors --max-delete= --partial \
- --force --numeric-ids --timeout= \
- --ignore-times --size-only --modify-window= \
- --temp-dir= --compare-dest= --compress \
- --exclude= --exclude-from= --include= \
- --include-from= --version --daemon --no-detach\
- --address= --config= --port= --blocking-io \
- --no-blocking-io --stats --progress \
- --log-format= --password-file= --bwlimit= \
- --write-batch= --read-batch= --help' -- $cur ))
- ;;
- *:*)
- # find which remote shell is used
- shell=ssh
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
- shell=${COMP_WORDS[i+1]}
- break
- fi
- done
- if [[ "$shell" == ssh ]]; then
- # remove backslash escape from :
- cur=${cur/\\:/:}
- userhost=${cur%%?(\\):*}
- path=${cur#*:}
- # unescape spaces
- path=${path//\\\\\\\\ / }
- if [ -z "$path" ]; then
- # default to home dir of specified
- # user on remote host
- path=$(ssh -o 'Batchmode yes' \
- $userhost pwd 2>/dev/null)
- fi
- # escape spaces; remove executables, aliases, pipes
- # and sockets; add space at end of file names
- COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
- command ls -aF1d "$path*" 2>/dev/null | \
- sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
- -e 's/[^\/]$/& /g' ) )
- fi
- ;;
- *)
- _known_hosts -c -a
- _filedir
- ;;
- esac
-
- return 0
-} &&
-complete -F _rsync $nospace $filenames rsync
+ # NOTE: Using `_known_hosts' as a helper function and passing options
+ # to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
+ [ "$1" = -a ] || [ "$2" = -a ] && options=-a
+ [ "$1" = -c ] || [ "$2" = -c ] && options="$options -c"
+ _known_hosts_real $options "$(_get_cword)"
+}
+
+# Helper function for completing _known_hosts.
+# This function performs host completion based on ssh's known_hosts files.
+# Also hosts from HOSTFILE (compgen -A hostname) are added, unless
+# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value.
+# Usage: _known_hosts_real [OPTIONS] CWORD
+# Options: -a Use aliases
+# -c Use `:' suffix
+# -F configfile Use `configfile' for configuration settings
+# -p PREFIX Use PREFIX
+# Return: Completions, starting with CWORD, are added to COMPREPLY[]
+_known_hosts_real()
+{
+ local configfile flag prefix
+ local cur curd awkcur user suffix aliases global_kh user_kh hosts i host
+ local -a kh khd config
+
+ local OPTIND=1
+ while getopts "acF:p:" flag "$@"; do
+ case $flag in
+ a) aliases='yes' ;;
+ c) suffix=':' ;;
+ F) configfile=$OPTARG ;;
+ p) prefix=$OPTARG ;;
+ esac
+ done
+ [ $# -lt $OPTIND ] && echo "error: $FUNCNAME: missing mandatory argument CWORD"
+ cur=${!OPTIND}; let "OPTIND += 1"
+ [ $# -ge $OPTIND ] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\
+ $(while [ $# -ge $OPTIND ]; do echo ${!OPTIND}; shift; done)
+
+ [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
+ kh=()
+
+ # ssh config files
+ if [ -n "$configfile" ]; then
+ [ -r "$configfile" ] &&
+ config=( "${config[@]}" "$configfile" )
+ else
+ [ -r /etc/ssh/ssh_config ] &&
+ config=( "${config[@]}" "/etc/ssh/ssh_config" )
+ [ -r "${HOME}/.ssh/config" ] &&
+ config=( "${config[@]}" "${HOME}/.ssh/config" )
+ [ -r "${HOME}/.ssh2/config" ] &&
+ config=( "${config[@]}" "${HOME}/.ssh2/config" )
+ fi
-# Linux route(8) completion
-#
-[ $UNAME = Linux ] &&
-_route()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [ "$prev" = dev ]; then
- COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
- return 0
- fi
-
- COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
- window irtt reject mod dyn reinstate dev \
- default gw' -- $cur ) )
-
- COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
- (while read -d ' ' i; do
- [ "$i" == "" ] && continue
- # flatten array with spaces on either side,
- # otherwise we cannot grep on word
- # boundaries of first and last word
- COMPREPLY=" ${COMPREPLY[@]} "
- # remove word from list of completions
- COMPREPLY=( ${COMPREPLY/ $i / } )
- done
- echo "${COMPREPLY[@]}")
- ) )
- return 0
-}
-[ $UNAME = Linux ] && complete -F _route route
+ if [ ${#config[@]} -gt 0 ]; then
+ local OIFS=$IFS IFS=$'\n'
+ # expand path (if present) to global known hosts file
+ global_kh=($( 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[@]}" ))
+ for (( i=0; i < ${#global_kh[@]}; i++ )); do
+ global_kh[i]=$(echo "${global_kh[i]//\"/}")
+ done
+ # expand path (if present) to user known hosts file
+ user_kh=($( 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[@]}" ))
+ for (( i=0; i < ${#user_kh[@]}; i++ )); do
+ user_kh[i]=$(echo "${user_kh[i]//\"/}")
+ done
+ IFS=$OIFS
+ fi
-# GNU make(1) completion
-#
-have make || have gmake || have gnumake || have pmake &&
-_make()
-{
- local file makef makef_dir="." makef_inc cur prev i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case $prev in
- -@(f|o|W))
- _filedir
- return 0
- ;;
- -@(I|C))
- _filedir -d
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --@(file|makefile))
- _filedir
- return 0
- ;;
- --@(directory|include-dir))
- _filedir -d
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
- -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
- --always-make --directory= --debug \
- --environment-overrides --file= --makefile= --help \
- --ignore-errors --include-dir= --jobs --load-average \
- --max-load --keep-going --just-print --dry-run \
- --recon --old-file= --assume-old= --print-data-base \
- --question --no-builtin-rules --no-builtin-variables \
- --silent --quiet --no-keep-goind --stop --touch \
- --version --print-directory --no-print-directory \
- --what-if= --new-file= --assume-new= \
- --warn-undefined-variables' -- $cur ) )
- else
- # before we check for makefiles, see if a path was specified
- # with -C
- for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -C ]]; then
- # eval for tilde expansion
- eval makef_dir=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- # before we scan for targets, see if a Makefile name was
- # specified with -f
- for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
- if [[ ${COMP_WORDS[i]} == -f ]]; then
- # eval for tilde expansion
- eval makef=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- [ -n "$makef" ] && makef="-f ${makef}"
- [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
-
- COMPREPLY=( $( make -qp $makef $makef_dir 2>/dev/null | \
- awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
- {split($1,A,/ /);for(i in A)print A[i]}' | \
- command grep "^$cur" ))
-
- fi
-} &&
-complete -f -F _make $filenames make gmake gnumake pmake
+ # Global known_hosts files
+ [ -r "$global_kh" ] &&
+ kh=( "${kh[@]}" "${global_kh[@]}" )
+ if [ -z "$configfile" ]; then
+ [ -r /etc/ssh/ssh_known_hosts ] &&
+ kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
+ [ -r /etc/ssh/ssh_known_hosts2 ] &&
+ kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
+ [ -r /etc/known_hosts ] &&
+ kh=( "${kh[@]}" /etc/known_hosts )
+ [ -r /etc/known_hosts2 ] &&
+ kh=( "${kh[@]}" /etc/known_hosts2 )
+ [ -d /etc/ssh2/knownhosts ] &&
+ khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
+ fi
-# GNU tar(1) completion
-#
-_tar()
-{
- local cur ext regex tar untar
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) )
- return 0
- fi
-
- case "${COMP_WORDS[1]}" in
- ?(-)[cr]*f)
- _filedir
- return 0
- ;;
- +([^IZzJjy])f)
- ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))'
- regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\)\)\?\|gz\|bz2\?\|lzma\)'
- ;;
- *[Zz]*f)
- ext='t?(ar.)@(gz|Z)'
- regex='t\(ar\.\)\?\(gz\|Z\)'
- ;;
- *[Ijy]*f)
- ext='t?(ar.)bz?(2)'
- regex='t\(ar\.\)\?bz2\?'
- ;;
- *[J]*f)
- ext='t?(ar.)lz?(ma)'
- regex='t\(ar\.\)\?lzma\?'
- ;;
- *)
- _filedir
- return 0
- ;;
-
- esac
-
- if [[ "$COMP_LINE" == *$ext' ' ]]; then
- # complete on files in tar file
- #
- # get name of tar file from command line
- tar=$( echo "$COMP_LINE" | \
- sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
- # devise how to untar and list it
- untar=t${COMP_WORDS[1]//[^Izjyf]/}
-
- COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
- 2>/dev/null ) )" -- "$cur" ) )
- return 0
- fi
-
- # file completion on relevant files
- _filedir "$ext"
-
- return 0
-}
-[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
- complete -F _tar $filenames tar
+ # User known_hosts files
+ [ -r "$user_kh" ] &&
+ kh=( "${kh[@]}" "${user_kh[@]}" )
+ if [ -z "$configfile" ]; then
+ [ -r ~/.ssh/known_hosts ] &&
+ kh=( "${kh[@]}" ~/.ssh/known_hosts )
+ [ -r ~/.ssh/known_hosts2 ] &&
+ kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
+ [ -d ~/.ssh2/hostkeys ] &&
+ khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
+ fi
-# jar(1) completion
-#
-have jar &&
-_jar()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD = 1 ]; then
- COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) )
- return 0
- fi
-
- case "${COMP_WORDS[1]}" in
- *c*f)
- _filedir
- ;;
- *f)
- _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
- ;;
- *)
- _filedir
- ;;
- esac
-} &&
-complete -F _jar $filenames jar
+ # If we have known_hosts files to use
+ if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
+ # Escape slashes and dots in paths for awk
+ awkcur=${cur//\//\\\/}
+ awkcur=${awkcur//\./\\\.}
+ curd=$awkcur
+
+ if [[ "$awkcur" == [0-9]*.* ]]; then
+ # Digits followed by a dot - just search for that
+ awkcur="^$awkcur.*"
+ elif [[ "$awkcur" == [0-9]* ]]; then
+ # Digits followed by no dot - search for digits followed
+ # by a dot
+ awkcur="^$awkcur.*\."
+ elif [ -z "$awkcur" ]; then
+ # A blank - search for a dot or an alpha character
+ awkcur="[a-z.]"
+ else
+ awkcur="^$awkcur"
+ fi
+
+ if [ ${#kh[@]} -gt 0 ]; then
+ # FS needs to look for a comma separated list
+ COMPREPLY=( $( awk 'BEGIN {FS=","}
+ /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
+ gsub(" .*$", "", $i); \
+ gsub("[\\[\\]]", "", $i); \
+ gsub(":[0-9]+$", "", $i); \
+ if ($i ~ /'"$awkcur"'/) {print $i} \
+ }}' "${kh[@]}" 2>/dev/null ) )
+ fi
+ if [ ${#khd[@]} -gt 0 ]; then
+ # Needs to look for files called
+ # .../.ssh2/key_22_<hostname>.pub
+ # dont fork any processes, because in a cluster environment,
+ # there can be hundreds of hostkeys
+ for i in "${khd[@]}" ; do
+ if [[ "$i" == *key_22_$awkcurd*.pub ]] && [ -r "$i" ] ; then
+ host=${i/#*key_22_/}
+ host=${host/%.pub/}
+ COMPREPLY=( "${COMPREPLY[@]}" $host )
+ fi
+ done
+ fi
+ # append any available aliases from config files
+ if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
+ local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
+ hosts=$( compgen -W "$host_aliases" -- "$cur" )
+ COMPREPLY=( "${COMPREPLY[@]}" $hosts )
+ fi
+
+ # Add hosts reported by avahi, if it's available
+ # and if the daemon is started.
+ # The original call to avahi-browse also had "-k", to avoid
+ # lookups into avahi's services DB. We don't need the name
+ # of the service, and if it contains ";", it may mistify
+ # the result. But on Gentoo (at least), -k isn't available
+ # (even if mentioned in the manpage), so...
+ if type avahi-browse >&/dev/null; then
+ if [ -n "$(pidof avahi-daemon)" ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $(
+ compgen -W "$( avahi-browse -cpr _workstation._tcp | \
+ grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
+ fi
+ fi
+
+ # apply suffix and prefix
+ for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
+ COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix
+ done
+ fi
-# Linux iptables(8) completion
-#
-have iptables &&
-_iptables()
-{
- local cur prev table chain
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- chain='s/^Chain \([^ ]\+\).*$/\1/p'
-
- if [[ $COMP_LINE == *-t\ *filter* ]]; then
- table="-t filter"
- elif [[ $COMP_LINE == *-t\ *nat* ]]; then
- table="-t nat"
- elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
- table="-t mangle"
- fi
-
- case "$prev" in
- -*[AIDRPFXLZ])
- COMPREPLY=( $( compgen -W '`iptables $table -nL | \
- sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
- ;;
- -*t)
- COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
- ;;
- -j)
- if [ "$table" = "-t filter" -o "$table" = "" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- `iptables $table -nL | sed -ne "$chain" \
- -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
- $cur ) )
- elif [ "$table" = "-t nat" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
- sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
- -- $cur ) )
- elif [ "$table" = "-t mangle" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- MARK TOS `iptables $table -nL | sed -ne "$chain" \
- -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
- $cur ) )
- fi
- ;;
- *)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
- --delete --insert --replace --list --flush --zero --new \
- --delete-chain --policy --rename-chain --proto --source \
- --destination --in-interface --jump --match --numeric \
- --out-interface --table --verbose --line-numbers --exact \
- --fragment --modprobe= --set-counters --version' -- "$cur") )
- fi
- ;;
- esac
+ # Add results of normal hostname completion, unless `COMP_KNOWN_HOSTS_WITH_HOSTFILE'
+ # is set to an empty value.
+ if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
+ fi
-} &&
-complete -F _iptables iptables
+ return 0
+}
+complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
+ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
-# tcpdump(8) completion
+# This meta-cd function observes the CDPATH variable, so that cd additionally
+# completes on directories under those specified in CDPATH.
#
-have tcpdump &&
-_tcpdump()
+_cd()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(r|w|F))
- _filedir
- return 0
- ;;
- -i)
- _available_interfaces -a
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
- -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
- -E' -- $cur ) )
- fi
-
-} &&
-complete -F _tcpdump tcpdump
+ local IFS=$'\t\n' cur=`_get_cword` i j k
-# autorpm(8) completion
-#
-have autorpm &&
-_autorpm()
-{
- local cur
+ # try to allow variable completion
+ if [[ "$cur" == ?(\\)\$* ]]; then
+ COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
+ return 0
+ fi
- COMPREPLY=()
- cur=`_get_cword`
+ # Enable -o filenames option, see Debian bug #272660
+ compgen -f /non-existing-dir/ >/dev/null
- COMPREPLY=( $( compgen -W '--notty --debug --help --version \
- auto add fullinfo info help install list \
- remove set' -- $cur ) )
+ # Use standard dir completion if no CDPATH or parameter starts with /,
+ # ./ or ../
+ if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
+ _filedir -d
+ return 0
+ fi
-} &&
-complete -F _autorpm autorpm
+ local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
+ local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
+
+ # we have a CDPATH, so loop on its contents
+ for i in ${CDPATH//:/$'\t'}; do
+ # create an array of matched subdirs
+ k="${#COMPREPLY[@]}"
+ for j in $( compgen -d $i/$cur ); do
+ if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
+ j="${j}/"
+ fi
+ COMPREPLY[k++]=${j#$i/}
+ done
+ done
+
+ _filedir -d
+
+ if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
+ i=${COMPREPLY[0]}
+ if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
+ COMPREPLY[0]="${i}/"
+ fi
+ fi
-# This meta-cd function observes the CDPATH variable, so that cd additionally
-# completes on directories under those specified in CDPATH.
-#
-_cd()
-{
- local IFS=$'\t\n' cur=`_get_cword` i j k
-
- # try to allow variable completion
- if [[ "$cur" == ?(\\)\$* ]]; then
- COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
- return 0
- fi
-
- # Enable -o filenames option, see Debian bug #272660
- compgen -f /non-existing-dir/ >/dev/null
-
- # Use standard dir completion if no CDPATH or parameter starts with /,
- # ./ or ../
- if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
- _filedir -d
- return 0
- fi
-
- local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
- local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
-
- # we have a CDPATH, so loop on its contents
- for i in ${CDPATH//:/$'\t'}; do
- # create an array of matched subdirs
- k="${#COMPREPLY[@]}"
- for j in $( compgen -d $i/$cur ); do
- if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
- j="${j}/"
- fi
- COMPREPLY[k++]=${j#$i/}
- done
- done
-
- _filedir -d
-
- if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
- i=${COMPREPLY[0]}
- if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
- COMPREPLY[0]="${i}/"
- fi
- fi
-
- return 0
+ return 0
}
if shopt -q cdable_vars; then
complete -v -F _cd $nospace cd
@@ -3242,17 +1388,17 @@ fi
# a wrapper method for the next one, when the offset is unknown
_command()
{
- local offset i
-
- # find actual offset, as position of the first non-option
- offset=1
- for (( i=1; i <= COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- offset=$i
- break
- fi
- done
- _command_offset $offset
+ local offset i
+
+ # find actual offset, as position of the first non-option
+ offset=1
+ for (( i=1; i <= COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ offset=$i
+ break
+ fi
+ done
+ _command_offset $offset
}
# A meta-command completion function for commands like sudo(8), which need to
@@ -3262,6055 +1408,220 @@ _command()
#
_command_offset()
{
- local cur func cline cspec noglob cmd i char_offset word_offset \
- _COMMAND_FUNC _COMMAND_FUNC_ARGS
-
- word_offset=$1
-
- # rewrite current completion context before invoking
- # actual command completion
-
- # find new first word position, then
- # rewrite COMP_LINE and adjust COMP_POINT
- local first_word=${COMP_WORDS[$word_offset]}
- for (( i=0; i <= ${#COMP_LINE}; i++ )); do
- if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then
- char_offset=$i
- break
- fi
- done
- COMP_LINE=${COMP_LINE:$char_offset}
- COMP_POINT=$(( COMP_POINT - $char_offset ))
-
- # shift COMP_WORDS elements and adjust COMP_CWORD
- for (( i=0; i <= COMP_CWORD - $word_offset; i++ )); do
- COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}
- done
- for (( i; i <= COMP_CWORD; i++ )); do
- unset COMP_WORDS[i];
- done
- COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ $COMP_CWORD -eq 0 ]]; then
- COMPREPLY=( $( compgen -c -- $cur ) )
- else
- cmd=${COMP_WORDS[0]}
- if complete -p $cmd &>/dev/null; then
- cspec=$( complete -p $cmd )
- if [ "${cspec#* -F }" != "$cspec" ]; then
- # complete -F <function>
-
- # get function name
- func=${cspec#*-F }
- func=${func%% *}
-
- if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
- $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
- else
- $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
- fi
-
- # remove any \: generated by a command that doesn't
- # default to filenames or dirnames (e.g. sudo chown)
- # FIXME: I'm pretty sure this does not work!
- if [ "${cspec#*-o }" != "$cspec" ]; then
- cspec=${cspec#*-o }
- cspec=${cspec%% *}
- if [[ "$cspec" != @(dir|file)names ]]; then
- COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
- fi
- fi
- elif [ -n "$cspec" ]; then
- cspec=${cspec#complete};
- cspec=${cspec%%$cmd};
- COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
- fi
- fi
- fi
-
- [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
-}
-complete -F _command $filenames nohup exec nice eval time ltrace then \
- else do vsound command xargs tsocks
-
-_root_command()
-{
- PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
-}
-complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
-
-# ant(1) completion
-#
-have ant && {
-_ant()
-{
- local cur prev buildfile i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -buildfile|-f)
- _filedir 'xml'
- return 0
- ;;
- -logfile)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
- -verbose -debug -emacs -logfile -logger \
- -listener -buildfile -f -D -find' -- $cur ) )
- else
- # available targets completion
- # find which buildfile to use
- buildfile=build.xml
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
- buildfile=${COMP_WORDS[i+1]}
- break
- fi
- done
- [ ! -f $buildfile ] && return 0
-
- # parse buildfile for targets
- 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" ) )
- fi
-}
-have complete-ant-cmd.pl && \
- complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
- complete -F _ant $filenames ant
-}
-
-have nslookup &&
-_nslookup()
-{
- local cur
-
- COMPREPLY=()
- cur=${COMP_WORDS[COMP_CWORD]#-}
-
- COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
- srchlist= defname search port= querytype= \
- type= recurse retry root timeout vc \
- ignoretc' -- $cur ) )
-} &&
-complete -F _nslookup nslookup
-
-# mysqladmin(1) completion
-#
-have mysqladmin &&
-_mysqladmin()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -u)
- COMPREPLY=( $( compgen -u -- $cur ) )
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
- -v -V -w' -- $cur ) )
-
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W 'create drop extended-status flush-hosts \
- flush-logs flush-status flush-tables \
- flush-threads flush-privileges kill \
- password ping processlist reload refresh \
- shutdown status variables version' \
- -- $cur ) )
-} &&
-complete -F _mysqladmin mysqladmin
-
-# gzip(1) completion
-#
-have gzip &&
-_gzip()
-{
- local cur prev xspec helpopts
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- helpopts=`_parse_help gzip`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" \
- -- "$cur" ) )
- return 0
- fi
-
- local IFS=$'\t\n'
-
- xspec="*.?(t)gz"
- if [[ "$prev" == --* ]]; then
- [[ "$prev" == --decompress || \
- "$prev" == --list || \
- "$prev" == --test ]] && xspec="!"$xspec
- [[ "$prev" == --force ]] && xspec=
- elif [[ "$prev" == -* ]]; then
- [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
- [[ "$prev" == -*f* ]] && xspec=
- elif [ "$prev" = '>' ]; then
- xspec=
- elif [ "$prev" = '<' ]; then
- xspec=
- fi
-
- _expand || return 0
-
- COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
- $( compgen -d -- $cur ) )
-} &&
-complete -F _gzip $filenames gzip
-
-# bzip2(1) completion
-#
-have bzip2 &&
-_bzip2()
-{
- local cur prev xspec
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
- -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
- --help --decompress --compress --keep --force \
- --test --stdout --quiet --verbose --license \
- --version --small --fast --best' -- $cur ) )
- return 0
- fi
-
- local IFS=$'\t\n'
-
- xspec="*.bz2"
- if [[ "$prev" == --* ]]; then
- [[ "$prev" == --decompress || \
- "$prev" == --list || \
- "$prev" == --test ]] && xspec="!"$xspec
- [[ "$prev" == --compress ]] && xspec=
- elif [[ "$prev" == -* ]]; then
- [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
- [[ "$prev" == -*z* ]] && xspec=
- fi
-
- _expand || return 0
-
- COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
- $( compgen -d -- $cur ) )
-} &&
-complete -F _bzip2 $filenames bzip2
-
-# openssl(1) completion
-#
-have openssl && {
-_openssl_sections()
-{
- local config
-
- config=/etc/ssl/openssl.cnf
- [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf
- for (( i=2; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -config ]]; then
- config=${COMP_WORDS[i+1]}
- break
- fi
- done
- [ ! -f $config ] && return 0
-
- COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
-}
-
-_openssl()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \
- dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \
- genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \
- rsautl s_client s_server s_time sess_id smime speed \
- spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \
- sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \
- cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \
- des-cbc des-cfb des-ecb des-ede des-ede-cbc \
- des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \
- des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
- rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \
- rc4 rc4-40' -- $cur ) )
- else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case ${COMP_WORDS[1]} in
- asn1parse)
- case $prev in
- -inform)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out|oid))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -in -out -noout -offset \
- -length -i -oid -strparse' -- $cur ) )
- fi
- ;;
- ca)
- case $prev in
- -@(config|revoke|cert|in|out|spkac|ss_cert))
- _filedir
- return 0
- ;;
- -outdir)
- _filedir -d
- return 0
- ;;
- -@(name|crlexts|extensions))
- _openssl_sections
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-verbose -config -name \
- -gencrl -revoke -crldays -crlhours -crlexts \
- -startdate -enddate -days -md -policy -keyfile \
- -key -passin -cert -in -out -notext -outdir \
- -infiles -spkac -ss_cert -preserveDN -batch \
- -msie_hack -extensions' -- $cur ) )
- fi
- ;;
- ciphers)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ) )
- fi
- ;;
- crl)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out|CAfile))
- _filedir
- return 0
- ;;
- -CAPath)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -text -in -out -noout \
- -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ) )
- fi
- ;;
- crl2pkcs7)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs' -- $cur ) )
- fi
- ;;
- dgst)
- case $prev in
- -@(out|sign|verify|prvrify|signature))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
- -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ) )
- else
- _filedir
- fi
- ;;
- dsa)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
- -modulus -pubin -pubout' -- $cur ) )
- fi
- ;;
- dsaparam)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -out -noout \
- -text -C -rand -genkey' -- $cur ) )
- fi
- ;;
- enc)
- case $prev in
- -@(in|out|kfile))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-ciphername -in -out -pass \
- -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ) )
- fi
- ;;
- dhparam)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -out -dsaparam -noout \
- -text -C -2 -5 -rand' -- $cur ) )
- fi
- ;;
- gendsa)
- case $prev in
- -@(out|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-out -des -des3 -idea -rand' -- $cur ) )
- else
- _filedir
- fi
- ;;
- genrsa)
- case $prev in
- -@(out|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ) )
- fi
- ;;
- pkcs7)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ) )
- fi
- ;;
- rand)
- case $prev in
- -@(out|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-out -rand -base64' -- $cur ) )
- fi
- ;;
- req)
- case "$prev" in
- -@(in|out|key)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
-
- -@(in|out|rand|key|keyout|config))
- _filedir
- return 0
- ;;
- -extensions)
- _openssl_sections
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in \
- -passin -out -passout -text -noout -verify \
- -modulus -new -rand -newkey -newkey -nodes \
- -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
- -config -x509 -days -asn1-kludge -newhdr \
- -extensions -reqexts section' -- $cur ) )
- fi
- ;;
- rsa)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER NET PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout \
- -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
- -pubout -engine' -- $cur ) )
- fi
- ;;
- rsautl)
- case $prev in
- -@(in|out|inkey))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
- -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ) )
- fi
- ;;
- s_client)
- case $prev in
- -connect)
- _known_hosts
- return 0
- ;;
- -@(cert|key|CAfile|rand))
- _filedir
- return 0
- ;;
- -CApath)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-connect -verify -cert -key -CApath -CAfile \
- -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
- -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
- -bugs -cipher -starttls -engine -rand' -- $cur ) )
- fi
- ;;
- s_server)
- case $prev in
- -@(cert|key|dcert|dkey|dhparam|CAfile|rand))
- _filedir
- return 0
- ;;
- -CApath)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-accept -context -verify -Verify -cert -key \
- -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
- -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
- -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
- -rand' -- $cur ) )
- fi
- ;;
- s_time)
- case $prev in
- -connect)
- _known_hosts
- return 0
- ;;
- -@(cert|key|CAfile))
- _filedir
- return 0
- ;;
- -CApath)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
- -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ) )
- fi
- ;;
-
- sess_id)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out))
- _filedir
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform -in -out -text -noout \
- -context ID' -- $cur ) )
- fi
- ;;
- smime)
- case $prev in
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'SMIME DER PEM' -- $cur ) )
- return 0
- ;;
- -@(in|out|certfile|signer|recip|inkey|content|rand))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
- -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
- -recip -inform -passin -inkey -out -outform -content -to -from -subject \
- -text -rand' -- $cur ) )
- else
- _filedir
- fi
- ;;
- speed)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-engine' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
- rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
- rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ) )
- fi
- ;;
- verify)
- case $prev in
- -@(CAfile|untrusted))
- _filedir
- return 0
- ;;
- -CApath)
- _filedir -d
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
- -verbose -certificates' -- $cur ) )
- else
- _filedir
- fi
- ;;
- x509)
- case "$prev" in
- -@(in|out|CA|CAkey|CAserial|extfile))
- _filedir
- return 0
- ;;
- -@(in|out)form)
- COMPREPLY=( $( compgen -W 'DER PEM NET' -- $cur ) )
- return 0
- ;;
- -@(key|CA|CAkey)form)
- COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
- return 0
- ;;
- -extensions)
- _openssl_sections
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-inform -outform \
- -keyform -CAform -CAkeyform -in -out \
- -serial -hash -subject -issuer -nameopt \
- -email -startdate -enddate -purpose \
- -dates -modulus -fingerprint -alias \
- -noout -trustout -clrtrust -clrreject \
- -addtrust -addreject -setalias -days \
- -set_serial -signkey -x509toreq -req \
- -CA -CAkey -CAcreateserial -CAserial \
- -text -C -md2 -md5 -sha1 -mdc2 -clrext \
- -extfile -extensions -engine' -- $cur ) )
- fi
- ;;
- @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d' -- $cur ) )
- else
- _filedir
- fi
- ;;
- esac
- fi
-
- return 0
-}
-complete -F _openssl $default openssl
-}
-
-# screen(1) completion
-#
-have screen &&
-_screen()
-{
- local cur prev preprev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
-
- if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \
- "$prev" = "-R" ]; then
- # list all
- COMPREPLY=( $( command screen -ls | \
- sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) )
- else
- case "$prev" in
- -[rR])
- # list detached
- COMPREPLY=( $( command screen -ls | \
- sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) )
- ;;
- -[dDx])
- # list attached
- COMPREPLY=( $( command screen -ls | \
- sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) )
- ;;
- -s)
- # shells
- COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
- ;;
- *)
- ;;
- esac
- fi
-
- return 0
-} &&
-complete -F _screen $default screen
-
-# lftp(1) bookmark completion
-#
-have lftp &&
-_lftp()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
- COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
- ~/.lftp/bookmarks )' -- $cur ) )
- fi
-
- return 0
-} &&
-complete -F _lftp $default lftp
-
-# ncftp(1) bookmark completion
-#
-have ncftp &&
-_ncftp()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
- COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
- ~/.ncftp/bookmarks )' -- $cur ) )
- fi
-
- return 0
-} &&
-complete -F _ncftp $default ncftp
-
-# gdb(1) completion
-#
-have gdb &&
-_gdb()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [ $COMP_CWORD -eq 1 ]; then
- local IFS
- if [[ "$cur" == */* ]]; then
- # compgen -c works as expected if $cur contains any slashes.
- IFS=$'\n'
- COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) )
- else
- # otherwise compgen -c contains Bash's built-in commands,
- # functions and aliases. Thus we need to retrieve the program
- # names manually.
- IFS=":"
- local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') )
- IFS=$'\n'
- COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
- -mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n" 2>/dev/null)' \
- -- "$cur" ) )
- fi
- elif [ $COMP_CWORD -eq 2 ]; then
- prev=${prev##*/}
- COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
- awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \
- -- "$cur" ) )
- fi
-} &&
-complete -F _gdb $default gdb
+ local cur func cline cspec noglob cmd i char_offset word_offset \
+ _COMMAND_FUNC _COMMAND_FUNC_ARGS
+
+ word_offset=$1
+
+ # rewrite current completion context before invoking
+ # actual command completion
+
+ # find new first word position, then
+ # rewrite COMP_LINE and adjust COMP_POINT
+ local first_word=${COMP_WORDS[$word_offset]}
+ for (( i=0; i <= ${#COMP_LINE}; i++ )); do
+ if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then
+ char_offset=$i
+ break
+ fi
+ done
+ COMP_LINE=${COMP_LINE:$char_offset}
+ COMP_POINT=$(( COMP_POINT - $char_offset ))
+
+ # shift COMP_WORDS elements and adjust COMP_CWORD
+ for (( i=0; i <= COMP_CWORD - $word_offset; i++ )); do
+ COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}
+ done
+ for (( i; i <= COMP_CWORD; i++ )); do
+ unset COMP_WORDS[i];
+ done
+ COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
-# Postgresql completion
-#
-have psql && {
-_pg_databases()
-{
- return
- COMPREPLY=( $( psql -l 2>/dev/null | \
- sed -e '1,/^-/d' -e '/^(/,$d' | \
- awk '{print $1}' | grep "^$cur" ) )
-}
-
-_pg_users()
-{
- #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
- # grep "^ $cur" ) )
- #[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
- COMPREPLY=( $( compgen -u -- $cur ) )
-}
+ COMPREPLY=()
+ cur=`_get_cword`
-# createdb(1) completion
-#
-_createdb()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(h|-host=))
- _known_hosts
- return 0
- ;;
- -@(U|-username=))
- _pg_users
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
- --location= --template= --encoding= --host= --port= \
- --username= --password --echo --quiet --help' -- $cur ))
- else
- _pg_databases
- fi
-}
-complete -F _createdb $default createdb
+ if [[ $COMP_CWORD -eq 0 ]]; then
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ else
+ cmd=${COMP_WORDS[0]}
+ if complete -p $cmd &>/dev/null; then
+ cspec=$( complete -p $cmd )
+ if [ "${cspec#* -F }" != "$cspec" ]; then
+ # complete -F <function>
+
+ # get function name
+ func=${cspec#*-F }
+ func=${func%% *}
+
+ if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
+ $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
+ else
+ $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
+ fi
+
+ # remove any \: generated by a command that doesn't
+ # default to filenames or dirnames (e.g. sudo chown)
+ # FIXME: I'm pretty sure this does not work!
+ if [ "${cspec#*-o }" != "$cspec" ]; then
+ cspec=${cspec#*-o }
+ cspec=${cspec%% *}
+ if [[ "$cspec" != @(dir|file)names ]]; then
+ COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
+ fi
+ fi
+ elif [ -n "$cspec" ]; then
+ cspec=${cspec#complete};
+ cspec=${cspec%%$cmd};
+ COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
+ fi
+ fi
+ fi
-# dropdb(1) completion
-#
-_dropdb()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(h|-host=))
- _known_hosts
- return 0
- ;;
- -@(U|-username=))
- _pg_users
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \
- --host= --port= --username= --password \
- --interactive --echo --quiet --help' -- $cur ) )
- else
- _pg_databases
- fi
+ [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
}
-complete -F _dropdb $default dropdb
+complete -F _command $filenames nohup exec nice eval time ltrace then \
+ else do vsound command xargs tsocks
-# psql(1) completion
-#
-_psql()
+_root_command()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -h|--host)
- _known_hosts
- return 0
- ;;
- -U|--username)
- _pg_users
- return 0
- ;;
- -d|--dbname)
- _pg_databases
- return 0
- ;;
- -@(o|f)|--output|--file)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
- -c --command -d --dbname -e --echo-queries \
- -E --echo-hidden -f --file -F --filed-separator \
- -h --host -H --html -l --list -n -o --output \
- -p --port -P --pset -q -R --record-separator \
- -s --single-step -S --single-line -t --tuples-only \
- -T --table-attr -U --username -v --variable \
- -V --version -W --password -x --expanded -X --nopsqlrc \
- -? --help ' -- $cur ) )
- else
- # return list of available databases
- _pg_databases
- fi
-}
-complete -F _psql $default psql
+ PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
}
+complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
_longopt()
{
- local cur opt
-
- cur=`_get_cword`
-
- if [[ "$cur" == --*=* ]]; then
- opt=${cur%%=*}
- # cut backslash that gets inserted before '=' sign
- opt=${opt%\\*}
- cur=${cur#*=}
- _filedir
- # FIXME: see #297065... adding "-o nospace" (or $nospace),
- # should do the trick, but seems not working... ideas?
- COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
- return 0
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
- -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
- command grep "^$cur" | sort -u ) )
- elif [[ "$1" == rmdir ]]; then
- _filedir -d
- else
- _filedir
- fi
-}
-# makeinfo and texi2dvi are defined elsewhere.
-for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
- bison diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
- touch vdir awk gperf grep grub indent less m4 sed shar date \
- tee who texindex cat csplit cut expand fmt fold head \
- md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
- uniq wc ldd bash id irb mkdir rmdir; do
- have $i && complete -F _longopt $filenames $i
-done
-
-# These commands use filenames, so '-o filenames' is not needed.
-for i in env netstat seq uname units wget; do
- have $i && complete -F _longopt $default $i
-done
-unset i
-
-# gcc(1) completion
-#
-# The only unusual feature is that we don't parse "gcc --help -v" output
-# directly, because that would include the options of all the other backend
-# tools (linker, assembler, preprocessor, etc) without any indication that
-# you cannot feed such options to the gcc driver directly. (For example, the
-# linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we
-# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
-# --help output of the compiler.
-#
-have gcc &&
-_gcc()
-{
- local cur cc backend
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _expand || return 0
-
- case "$1" in
- gcj)
- backend=jc1
- ;;
- gpc)
- backend=gpc1
- ;;
- *77)
- backend=f771
- ;;
- *)
- backend=cc1 # (near-)universal backend
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- cc=$( $1 -print-prog-name=$backend )
- # sink stderr:
- # for C/C++/ObjectiveC it's useless
- # for FORTRAN/Java it's an error
- COMPREPLY=( $( $cc --help 2>/dev/null | tr '\t' ' ' | \
- sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
- command grep "^$cur" | sort -u ) )
- else
- _filedir
- fi
-} &&
-complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
-[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \
-[ -n "${have:-}" ] && complete $filenames -F _gcc cc
-
-# Linux cardctl(8) completion
-#
-have cardctl &&
-_cardctl()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'status config ident suspend \
- resume reset eject insert scheme' \
- -- $cur ) )
- fi
-} &&
-complete -F _cardctl cardctl
-
-# This function is required by _dpkg() and _dpkg-reconfigure()
-#
-# TODO: Ubuntu (and Debian) folks removed the "have grep-status" part. In my Debian I got it,
-# and I believe it's ok if we leave it like it is now. Was that removed because
-# of Ubuntu's (and Debian's? :() inner weirdness? :) -- David (hanska-guest)
-have dpkg && {
-#have grep-status && {
-#_comp_dpkg_installed_packages()
-#{
-# grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package
-#}
-#} || {
-_comp_dpkg_installed_packages()
-{
- 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
-}
-#}
-
-# Debian dpkg(8) completion
-#
-_dpkg()
-{
- local cur prev i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- i=$COMP_CWORD
-
- _expand || return 0
-
- # find the last option flag
- if [[ $cur != -* ]]; then
- while [[ $prev != -* && $i != 1 ]]; do
- i=$((i-1))
- prev=${COMP_WORDS[i-1]}
- done
- fi
-
- case "$prev" in
- -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
- _filedir '?(u)deb'
- return 0
- ;;
- -@(b|-build))
- _filedir -d
- return 0
- ;;
- -@(s|p|l|-@(status|print-avail|list)))
- COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) )
- return 0
- ;;
- -@(S|-search))
- _filedir
- return 0
- ;;
- -@(r|L|P|-@(remove|purge|listfiles)))
- COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
- return 0
- ;;
- *)
-
- COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
- --configure -r --remove -P --purge --get-selections \
- --set-selections --update-avail --merge-avail \
- --clear-avail --command-fd --forget-old-unavail -s \
- --status -p --print-avail -L --listfiles -l --list \
- -S --search -C --audit --print-architecture \
- --print-gnu-build-architecture \
- --print-installation-architecture \
- --compare-versions --help --version --force-help \
- --force-all --force-auto-select --force-downgrade \
- --force-configure-any --force-hold --force-bad-path \
- --force-not-root --force-overwrite \
- --force-overwrite-diverted --force-bad-verify \
- --force-depends-version --force-depends \
- --force-confnew --force-confold --force-confdef \
- --force-confmiss --force-conflicts --force-architecture\
- --force-overwrite-dir --force-remove-reinstreq \
- --force-remove-essential -Dh \
- --debug=help --licence --admindir= --root= --instdir= \
- -O --selected-only -E --skip-same-version \
- -G --refuse-downgrade -B --auto-deconfigure \
- --no-debsig --no-act -D --debug= --status-fd \
- -b --build -I --info -f --field -c --contents \
- -x --extract -X --vextract --fsys-tarfile -e --control \
- --ignore-depends= --abort-after' -- $cur ) )
- ;;
- esac
-
-
-}
-complete -F _dpkg $filenames dpkg dpkg-deb
-}
-
-# Debian GNU dpkg-reconfigure(8) completion
-#
-have dpkg-reconfigure &&
-_dpkg_reconfigure()
-{
- local cur prev opt
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
-
- case "$prev" in
- -@(f|-frontend))
- opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
- opt=( ${opt[@]##*/} )
- opt=( ${opt[@]%.pm} )
- COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) )
- return 0
- ;;
- -@(p|-priority))
- COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \
- -u --unseen-only -h --help -s --showold \
- --force --terse' -- $cur ) )
- else
- COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
- fi
-} &&
-complete -F _dpkg_reconfigure $default dpkg-reconfigure
-
-# Debian dpkg-source completion
-#
-have dpkg-source &&
-_dpkg_source()
-{
- local cur prev options work i action packopts unpackopts
-
- packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
- unpackopts="-sp -sn -su"
- options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
-
- COMPREPLY=()
- if [ "$1" != "dpkg-source" ]; then
- return 1
- fi
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- action="options"
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
- action=unpack
- elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
- action=pack
- elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
- action=help
- fi
- done
- # if currently seeing a complete option, return just itself.
- for i in $options; do
- if [ "$cur" = "$i" ]; then
- COMPREPLY=( "$cur" )
- return 0
- fi
- done
- case "$action" in
- "unpack")
- if [ "$cur" = "-" -o "$cur" = "-s" ]; then
- COMPREPLY=( $unpackopts )
- return 0
- fi
- case "$prev" in
- "-x")
- COMPREPLY=( $( compgen -d -- "$cur" ) \
- $( compgen -f -X '!*.dsc' -- "$cur" ) )
- return 0
- ;;
- *)
- COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
- return 0
- ;;
- esac
- return 0
- ;;
- "pack")
- if [ "$cur" = "-" ]; then
- COMPREPLY=( $packopts )
- return 0
- fi
- if [ "$cur" = "-s" ]; then
- COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
- "-sA" "-sK" "-sP" "-sU" "-sR" )
- return 0
- fi
- case "$prev" in
- "-b")
- COMPREPLY=( $( compgen -d -- "$cur" ) )
- return 0
- ;;
- "-c"|"-l"|"-T"|"-i"|"-I")
- # -c: get controlfile
- # -l: get per-version info from this file
- # -T: read variables here, not debian/substvars
- # -i: <regexp> filter out files to ignore diffs of.
- # -I: filter out files when building tarballs.
- # return directory names and file names
- COMPREPLY=( $( compgen -d -f ) )
- return 0
- ;;
- "-F")
- # -F: force change log format
- COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
- return 0
- ;;
- "-V"|"-D")
- # -V: set a substitution variable
- # we don't know anything about possible variables or values
- # so we don't try to suggest any completion.
- COMPREPLY=()
- return 0
- ;;
- "-D")
- # -D: override or add a .dsc field and value
- # if $cur doesn't contain a = yet, suggest variable names
- if echo -- "$cur" | grep -q "="; then
- # $cur contains a "="
- COMPREPLY=()
- return 0
- else
- COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
- return 0
- fi
- ;;
- "-U")
- # -U: remove a field
- # Suggest possible fieldnames
- COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
- return 0
- ;;
- *)
- COMPREPLY=( $packopts )
- return 0
- ;;
- esac
- return 0
- ;;
- *)
- # if seeing a partial option, return possible completions.
- if [ "$cur" = "-s" ]; then
- COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
- "-sA" "-sK" "-sP" "-sU" "-sR" )
- return 0
- fi
- # else return all possible options.
- COMPREPLY=( $options )
- return 0
- ;;
- esac
-} &&
-complete -F _dpkg_source dpkg-source
-
-# Debian Linux dselect(8) completion.
-#
-have dselect &&
-_dselect()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --admindir)
- _filedir -d
- return 0
- ;;
-
- -@(D|debug))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
- --license --expert --debug' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W 'access update select install config \
- remove quit' -- $cur ) )
- fi
-
-
- return 0
-} &&
-complete -F _dselect $filenames dselect
-
-# Java completion
-#
-
-# available path elements completion
-have java && {
-_java_path()
-{
- cur=${cur##*:}
- _filedir '@(jar|zip)'
-}
-
-# exact classpath determination
-_java_find_classpath()
-{
- local i
-
- # search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
- classpath=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- # default to environment
- [ -z "$classpath" ] && classpath=$CLASSPATH
-
- # default to current directory
- [ -z "$classpath" ] && classpath=.
-}
-
-# exact sourcepath determination
-_java_find_sourcepath()
-{
- local i
-
- # search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
- sourcepath=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- # default to classpath
- if [ -z "$sourcepath" ]; then
- _java_find_classpath
- sourcepath=$classpath
- fi
-}
-
-# available classes completion
-_java_classes()
-{
- local classpath i
-
- # find which classpath to use
- _java_find_classpath
-
- # convert package syntax to path syntax
- cur=${cur//.//}
- # parse each classpath element for classes
- for i in ${classpath//:/ }; do
- if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
- if type zipinfo &> /dev/null; then
- COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
- "$i" | grep "^$cur" | grep '\.class$' | \
- grep -v "\\$" ) )
- else
- COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | grep "\.class$" | grep -v "\\$" ) )
- fi
-
- elif [ -d $i ]; then
- i=${i%/}
-
- # See bug #496828
- COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
- -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
- grep -v "\\$" | sed -e "s|^$i/||" ) )
-
- # FIXME: if we have foo.class and foo/, the completion
- # returns "foo/"... how to give precedence to files
- # over directories?
- fi
- done
-
- # remove class extension
- COMPREPLY=( ${COMPREPLY[@]%.class} )
- # convert path syntax to package syntax
- COMPREPLY=( ${COMPREPLY[@]//\//.} )
-}
-
-# available packages completion
-_java_packages()
-{
- local sourcepath i
-
- # find which sourcepath to use
- _java_find_sourcepath
-
- # convert package syntax to path syntax
- cur=${cur//.//}
- # parse each sourcepath element for packages
- for i in ${sourcepath//:/ }; do
- if [ -d $i ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
- $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
- fi
- done
- # keep only packages
- COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
- # remove packages extension
- COMPREPLY=( ${COMPREPLY[@]%/} )
- # convert path syntax to package syntax
- cur=${COMPREPLY[@]//\//.}
-}
-
-# java completion
-#
-_java()
-{
- local cur prev i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for ((i=1; i < $COMP_CWORD; i++)); do
- case ${COMP_WORDS[$i]} in
- -cp|-classpath)
- ((i++)) # skip the classpath string.
- ;;
- -*)
- # this is an option, not a class/jarfile name.
- ;;
- *)
- # once we've seen a class, just do filename completion
- _filedir
- return 0
- ;;
- esac
- done
-
- case $prev in
- -@(cp|classpath))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
- -cp -classpath -D -verbose -verbose:class \
- -verbose:gc -version:jni -version \
- -showversion -? -help -X -jar \
- -ea -enableassertions -da -disableassertions \
- -esa -enablesystemassertions \
- -dsa -disablesystemassertions ' -- $cur ) )
- else
- if [[ "$prev" == -jar ]]; then
- # jar file completion
- _filedir jar
- else
- # classes completion
- _java_classes
- fi
- fi
-}
-complete -F _java $filenames java
-}
-
-# javadoc completion
-#
-have javadoc &&
-_javadoc()
-{
- COMPREPLY=()
- local cur prev
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -@(overview|helpfile|stylesheetfile))
- _filedir
- return 0
- ;;
- -d)
- _filedir -d
- return 0
- ;;
- -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-overview -public -protected \
- -package -private -help -doclet -docletpath \
- -sourcepath -classpath -exclude -subpackages \
- -breakiterator -bootclasspath -source -extdirs \
- -verbose -locale -encoding -J -d -use -version \
- -author -docfilessubdirs -splitindex \
- -windowtitle -doctitle -header -footer -bottom \
- -link -linkoffline -excludedocfilessubdir \
- -group -nocomment -nodeprecated -noqualifier \
- -nosince -nodeprecatedlist -notree -noindex \
- -nohelp -nonavbar -quiet -serialwarn -tag \
- -taglet -tagletpath -charset -helpfile \
- -linksource -stylesheetfile -docencoding' -- \
- $cur ) )
- else
- # source files completion
- _filedir java
- # packages completion
- _java_packages
- fi
-} &&
-complete -F _javadoc $filenames javadoc
-
-# javac completion
-#
-have javac &&
-_javac()
-{
- COMPREPLY=()
- local cur prev
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -d)
- _filedir -d
- return 0
- ;;
- -@(classpath|bootclasspath|sourcepath|extdirs))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
- -g:source -O -nowarn -verbose -deprecation -classpath\
- -sourcepath -bootclasspath -extdirs -d -encoding -source\
- -target -help' -- $cur ) )
- else
- # source files completion
- _filedir java
- fi
-} &&
-complete -F _javac $filenames javac
-
-# PINE address-book completion
-#
-have pine &&
-_pineaddr()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \
- -- $cur ) )
-} &&
-complete -F _pineaddr $default pine
-
-# mutt completion
-#
-# Mutt doesn't have an "addressbook" like Pine, but it has aliases and
-# a "query" function to retrieve addresses, so that's what we use here.
-have mutt || have muttng && {
-_muttaddr()
-{
- _muttaliases
- _muttquery
-
- cur=`_get_cword`
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- $cur ) )
-
- return 0
-}
-
-_muttconffiles()
-{
- local file sofar
- local -a newconffiles
-
- sofar=" $1 "
- shift
- while [[ "$1" ]]; do
- newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
- for file in "${newconffiles[@]}"; do
- [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
- continue
- sofar="$sofar $file"
- sofar=" $(eval _muttconffiles \"$sofar\" $file) "
- done
- shift
- done
- echo $sofar
-}
-
-_muttaliases()
-{
- local cur muttrc
- local -a conffiles aliases
- cur=`_get_cword =`
-
- [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
- [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
- [ -z "$muttrc" ] && return 0
-
- conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
- aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
- $(eval echo "${conffiles[@]}") ) )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
-
- return 0
-}
-
-_muttquery()
-{
- local cur querycmd
- local -a queryresults
- cur=`_get_cword`
-
- querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
- if [ -z "$cur" -o -z "$querycmd" ]; then
- queryresults=()
- else
- queryresults=( $( $querycmd | \
- sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
- fi
-
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
- -- $cur ) )
-
- return 0
-}
-
-_muttfiledir()
-{
- local cur folder spoolfile
- cur=`_get_cword`
-
- # This is currently not working so well. Perhaps this function should
- # just call _filedir() for the moment.
- if [[ $cur == [=+]* ]]; then
- folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
- : folder:=~/Mail
-
- # Match any file in $folder beginning with $cur
- # (minus the leading '=' sign).
- COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
- COMPREPLY=( ${COMPREPLY[@]#$folder/} )
- return 0
- elif [ "$cur" == !* ]; then
- spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
- [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
- fi
- _filedir
-
- return 0
-}
-
-_mutt()
-{
- local cur prev
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- COMPREPLY=()
-
- [ ${COMP_WORDS[0]} == muttng ] && muttcmd="muttng" || muttcmd="mutt"
-
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
- -p -Q -R -s -v -x -y -z -Z -h' \
- -- $cur ) )
- return 0
- ;;
- *)
- case "$prev" in
- -@(a|f|F|H|i))
- _muttfiledir
- return 0
- ;;
- -A)
- _muttaliases
- return 0
- ;;
- -@(e|m|Q|s|h|p|R|v|y|z|Z))
- return 0
- ;;
- *)
- _muttaddr
- return 0
- ;;
- esac
- ;;
- esac
-
-}
-complete -F _mutt $default $filenames mutt muttng
-}
+ local cur prev
-_configure_func()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
- # --option=SETTING will include 'SETTING' as a contextual hint
- [[ "$cur" != -* ]] && return 0
-
- if [ -n "$COMP_CONFIGURE_HINTS" ]; then
- COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) )
- else
- COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) )
- fi
-}
-complete -F _configure_func $default configure
-
-# Debian reportbug(1) completion
-#
-have reportbug &&
-_reportbug()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -f|--filename|-i|--include|--mta|-o|--output)
- _filedir
- return 0
- ;;
- -B|--bts)
- COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
- $cur ))
- return 0
- ;;
- -e|--editor|--mua)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
- _command
- return 0
- ;;
- --mode)
- COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
- return 0
- ;;
- -S|--severity)
- COMPREPLY=( $( compgen -W "grave serious important normal \
- minor wishlist" -- $cur ) )
- return 0
- ;;
- -u|--ui|--interface)
- COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
- return 0
- ;;
- -t|--type)
- COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
- return 0
- ;;
- -T|--tags)
- COMPREPLY=( $( compgen -W "none \
- woody potato sarge sarge-ignore etch etch-ignore \
- lenny lenny-ignore sid experimental confirmed \
- d-i fixed fixed-in-experimental fixed-upstream \
- help l10n moreinfo patch pending security \
- unreproducible upstream wontfix ipv6 lfs" -- $cur ))
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
- --no-query-bts --query-bts -B --bts -c --configure \
- --no-config-files --check-available -d --debug \
- --no-check-available -e --editor --email -f \
- --filename -g --gnupg -H --header -i --include -j \
- --justification -l --ldap --no-ldap -L --list-cc -m \
- --maintonly --mode --mua --mta --mutt -n --mh --nmh \
- -o --output -p --print -P --pgp --proxy --http_proxy\
- -q --quiet -Q --query-only --realname --report-quiet \
- --reply-to --replyto -s --subject -S --severity \
- --smtphost -t --type -T --tags --template -V -x \
- --no-cc --package-version -z --no-compress \
- --ui --interface -u \
- wnpp boot-floppies kernel bugs.debian.org \
- cdimage.debian.org general installation-reports \
- listarchives lists.debian.org mirrors nm.debian.org \
- press project qa.debian.org release-notes \
- security.debian.org tech-ctte upgrade-reports \
- www.debian.org' -- $cur ) \
- $( apt-cache pkgnames -- $cur 2> /dev/null) )
- _filedir
- return 0
-} &&
-complete -F _reportbug $filenames reportbug
-
-# Debian querybts(1) completion
-#
-have querybts &&
-_querybts()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -B|--bts)
- COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
- $cur ))
- return 0
- ;;
- -u|--ui|--interface)
- COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
- -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
- -s --source -w --web -u --ui --interface \
- wnpp boot-floppies kernel bugs.debian.org \
- cdimage.debian.org general installation-reports \
- listarchives lists.debian.org mirrors nm.debian.org \
- press project qa.debian.org release-notes \
- security.debian.org tech-ctte upgrade-reports \
- www.debian.org' -- $cur ) \
- $( apt-cache pkgnames -- $cur 2> /dev/null) )
-} &&
-complete -F _querybts $filenames querybts
-
-# update-alternatives completion
-#
-have update-alternatives && {
-installed_alternatives()
-{
- local admindir
- # find the admin dir
- for i in alternatives dpkg/alternatives rpm/alternatives; do
- [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
- done
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
- admindir=${COMP_WORDS[i+1]}
- break
- fi
- done
- COMPREPLY=( $( command ls $admindir | grep "^$cur" ) )
-}
-
-_update_alternatives()
-{
- local cur prev mode args i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --@(altdir|admindir))
- _filedir -d
- return 0
- ;;
- --@(help|version))
- return 0
- ;;
- esac
-
- # find which mode to use and how many real args used so far
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
- mode=${COMP_WORDS[i]}
- args=$(($COMP_CWORD - i))
- break
- fi
- done
-
- case $mode in
- --install)
- case $args in
- 1)
- _filedir
- ;;
- 2)
- installed_alternatives
- ;;
- 3)
- _filedir
- ;;
- esac
- ;;
- --remove)
- case $args in
- 1)
- installed_alternatives
- ;;
- 2)
- _filedir
- ;;
- esac
- ;;
- --auto)
- installed_alternatives
- ;;
- --remove-all)
- installed_alternatives
- ;;
- --display)
- installed_alternatives
- ;;
- --config)
- installed_alternatives
- ;;
- *)
- COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
- --altdir --admindir' -- $cur ) \
- $( compgen -W '--install --remove --auto --display \
- --config' -- $cur ) )
- esac
-}
-complete -F _update_alternatives update-alternatives
-}
-
-# Python completion
-#
-have python &&
-_python()
-{
- local prev cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]##*/}
-
- case "$prev" in
- -Q)
- COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
- return 0
- ;;
- -W)
- COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
- return 0
- ;;
- -c)
- _filedir '@(py|pyc|pyo)'
- return 0
- ;;
- !(python|-?))
- [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
- ;;
- esac
-
-
- # if '-c' is already given, complete all kind of files.
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -c ]]; then
- _filedir
- fi
- done
-
-
- if [[ "$cur" != -* ]]; then
- _filedir '@(py|pyc|pyo)'
- else
- COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
- -U -v -V -W -x -c" -- $cur ) )
- fi
-
-
-
- return 0
-} &&
-complete -F _python $filenames python
-
-# Perl completion
-#
-have perl &&
-{
-_perlmodules()
-{
- 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 ) )
-}
-
-_perl()
-{
- local cur prev prefix temp
- local optPrefix optSuffix
-
- COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
- prefix=""
-
- # If option not followed by whitespace, reassign prev and cur
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- optPrefix=-P$prev
- optSuffix=-S/
- prefix=$prev
- fi
- # only handle module completion for now
- case "$prev" in
- -I|-x)
- local IFS=$'\t\n'
- COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
- return 0
- ;;
- -m|-M)
- _perlmodules
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
- -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _perl $nospace $filenames perl
-
-_perldoc()
-{
- local cur prev prefix temp
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- prefix=""
-
- # completing an option (may or may not be separated by a space)
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- prefix=$prev
+ if _split_longopt; then
+ case "$prev" in
+ *[Dd][Ii][Rr]*)
+ _filedir -d
+ ;;
+ *[Ff][Ii][Ll][Ee]*)
+ _filedir
+ ;;
+ esac
+ return 0
fi
- # complete builtin perl functions
- case $prev in
- -f)
- COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
- lcfirst length oct ord pack q qq reverse rindex sprintf \
- substr tr uc ucfirst y m pos quotemeta s split study qr abs \
- atan2 cos exp hex int log oct rand sin sqrt srand pop push \
- shift splice unshift grep join map qw reverse sort unpack \
- delete each exists keys values binmode close closedir \
- dbmclose dbmopen die eof fileno flock format getc print \
- printf read readdir rewinddir seek seekdir select syscall \
- sysread sysseek syswrite tell telldir truncate warn write \
- pack read syscall sysread syswrite unpack vec -X chdir chmod \
- chown chroot fcntl glob ioctl link lstat mkdir open opendir \
- readlink rename rmdir stat symlink umask unlink utime caller \
- continue do dump eval exit goto last next redo return \
- sub wantarray caller import local my our package use defined \
- formline reset scalar undef \
- alarm exec fork getpgrp getppid getpriority kill pipe qx \
- setpgrp setpriority sleep system times wait waitpid \
- import no package require use bless dbmclose dbmopen package \
- ref tie tied untie use accept bind connect getpeername \
- getsockname getsockopt listen recv send setsockopt shutdown \
- socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
- semop shmctl shmget shmread shmwrite endgrent endhostent \
- endnetent endpwent getgrent getgrgid getgrnam getlogin \
- getpwent getpwnam getpwuid setgrent setpwent endprotoent \
- endservent gethostbyaddr gethostbyname gethostent \
- getnetbyaddr getnetbyname getnetent getprotobyname \
- getprotobynumber getprotoent getservbyname getservbyport \
- getservent sethostent setnetent setprotoent setservent \
- gmtime localtime time times' -- $cur ) )
- return 0
- ;;
- esac
-
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
+ COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | sed -e '/--/!d' \
+ -e 's/.*\(--[-A-Za-z0-9]\+\).*/\1/' |sort -u )"\
+ -- "$cur" ) )
+ elif [[ "$1" == rmdir ]]; then
+ _filedir -d
else
- # return available modules (unless it is clearly a file)
- if [[ "$cur" != */* ]]; then
- _perlmodules
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) )
- fi
+ _filedir
fi
}
-complete -F _perldoc $default perldoc
-}
-
-# rcs(1) completion
-#
-have rcs &&
-_rcs()
-{
- local cur prev file dir i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- file=${cur##*/}
- dir=${cur%/*}
-
- # deal with relative directory
- [ "$file" = "$dir" ] && dir=.
-
- COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
-
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- file=${COMPREPLY[$i]##*/}
- dir=${COMPREPLY[$i]%RCS/*}
- COMPREPLY[$i]=$dir$file
- done
-
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
-
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- COMPREPLY[$i]=${COMPREPLY[$i]%,v}
- done
-
- # default to files if nothing returned and we're checking in.
- # otherwise, default to directories
- [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
-} &&
-complete -F _rcs $filenames ci co rlog rcs rcsdiff
-
-# lilo(8) completion
-#
-have lilo && {
-_lilo_labels()
-{
- COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
- /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
-}
-
-_lilo()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -@(C|i|m|s|S))
- _filedir
- return 0
- ;;
- -r)
- _filedir -d
- return 0
- ;;
- -@(I|D|R))
- # label completion
- _lilo_labels
- return 0
- ;;
- -@(A|b|M|u|U))
- # device completion
- cur=${cur:=/dev/}
- _filedir
- return 0
- ;;
- -T)
- # topic completion
- COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
- table= video' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
- -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
- $cur ) )
- fi
-}
-complete -F _lilo lilo
-}
-
-# links completion
-#
-have links &&
-_links()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$cur" in
- --*)
- COMPREPLY=( $( compgen -W '--help' -- $cur ) )
- ;;
- -*)
- COMPREPLY=( $( compgen -W '-async-dns -max-connections \
- -max-connections-to-host -retries \
- -receive-timeout -unrestartable-receive-timeout\
- -format-cache-size -memory-cache-size \
- -http-proxy -ftp-proxy -download-dir \
- -assume-codepage -anonymous -dump -no-connect \
- -source -version -help' -- $cur ) )
- ;;
- *)
- if [ -r ~/.links/links.his ]; then
- COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
- -- $cur ) )
- fi
- _filedir '@(htm|html)'
- return 0
- ;;
- esac
-
- return 0
-} &&
-complete -F _links $filenames links
-
-[ $UNAME = FreeBSD ] && {
-# FreeBSD package management tool completion
-#
-_pkg_delete()
-{
- local cur pkgdir prev
-
- pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
-
- COMPREPLY=( $( compgen -d $pkgdir$cur ) )
- COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
-
- return 0
-}
-complete -F _pkg_delete $dirnames pkg_delete pkg_info
-have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall
-
-# FreeBSD kernel module commands
-#
-_kldload()
-{
- local cur moddir
-
- moddir=/modules/
- [ -d $moddir ] || moddir=/boot/kernel/
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -f $moddir$cur ) )
- COMPREPLY=( ${COMPREPLY[@]#$moddir} )
- COMPREPLY=( ${COMPREPLY[@]%.ko} )
-
- return 0
-}
-complete -F _kldload $filenames kldload
-
-_kldunload()
-{
- local cur
- cur=`_get_cword`
- COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
-}
-complete -F _kldunload $filenames kldunload
-}
-
-# FreeBSD portupgrade completion
-#
-have portupgrade &&
-_portupgrade()
-{
- local cur pkgdir prev
-
- pkgdir=${PKG_DBDIR:-/var/db/pkg}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
-
- COMPREPLY=( $( compgen -d $pkgdir$cur ) )
- COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
- COMPREPLY=( ${COMPREPLY[@]%-*} )
-
- return 0
-} &&
-complete -F _portupgrade $dirnames portupgrade
-
-# FreeBSD portinstall completion
-#
-have portinstall &&
-_portinstall()
-{
- local cur portsdir prev indexfile
- local -a COMPREPLY2
-
- portsdir=${PORTSDIR:-/usr/ports}/
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- # First try INDEX-5
- indexfile=$portsdir/INDEX-5
- # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
- [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
- indexfile=$portsdir/INDEX
-
- [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
-
- COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
- COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
- cut -d'|' -f2 ) )
- COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
- COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
-
- return 0
-} &&
-complete -F _portinstall $dirnames portinstall
-
-# Slackware Linux removepkg completion
-#
-have removepkg && [ -f /etc/slackware-version ] &&
-_removepkg()
-{
- local packages cur
-
- COMPREPLY=()
- cur=`_get_cword`
+# makeinfo and texi2dvi are defined elsewhere.
+for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
+ bison diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
+ touch vdir awk gperf grep grub indent less m4 sed shar date \
+ tee who texindex cat csplit cut expand fmt fold head \
+ md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
+ uniq wc ldd bash id irb mkdir rmdir; do
+ have $i && complete -F _longopt $filenames $i
+done
- COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
-} &&
-complete -F _removepkg $filenames removepkg &&
- complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
+# These commands do not use filenames, so '-o filenames' is not needed.
+for i in env netstat seq uname units wget; do
+ have $i && complete -F _longopt $default $i
+done
+unset i
# look(1) completion
#
have look &&
_look()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD = 1 ]; then
- COMPREPLY=( $( compgen -W '$(look $cur 2>/dev/null)' ) )
- fi
-} &&
-complete -F _look $default look
-
-# ypcat(1) and ypmatch(1) completion
-#
-have ypmatch &&
-_ypmatch()
-{
- local cur map
-
- COMPREPLY=()
- cur=`_get_cword`
-
- [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
- [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
-
- if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
- [ ${#COMP_WORDS[@]} -eq 3 ]; then
- map=${COMP_WORDS[2]}
- COMPREPLY=( $( compgen -W '$( ypcat $map | \
- cut -d':' -f 1 )' -- $cur) )
- else
- [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
- COMPREPLY=( $( compgen -W \
- '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
- fi
-
- return 0
-} &&
-complete -F _ypmatch ypmatch ypcat
-
-#xrandr(1) completion
-#
-have xrandr &&
-_xrandr()
-{
- local cur prev output modes
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --output)
- local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
- COMPREPLY=( $(compgen -W "$outputs" -- $cur))
- return 0
- ;;
- --mode)
- for(( i = 1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
- output=${COMP_WORDS[i+1]}
- break
- fi
- done
- modes=$(xrandr|sed -e "1,/$output/ d" \
- -e "/connected/,$ d"|awk '{print $1}')
- COMPREPLY=( $( compgen -W "$modes" -- $cur))
- return 0
- ;;
- esac
-
- case "$cur" in
- *)
- COMPREPLY=( $(compgen -W '-d -display -help -o \
- --orientation -q --query -s --size\
- -r --rate -v --version -x -y --screen \
- --verbose --dryrun --prop --fb --fbmm --dpi \
- --output --auto --mode --preferred --pos \
- --reflect --rotate --left-of --right-of \
- --above --below --same-as --set --off --crtc \
- --newmode --rmmode --addmode --delmode' -- $cur))
- return 0
- ;;
- esac
-
- return 0
-} &&
-complete -F _xrandr xrandr
-
-
-
-# mplayer(1) completion
-#
-have mplayer && {
-_mplayer_options_list()
-{
- cur=${cur%\\}
- COMPREPLY=( $( $1 $2 help 2> /dev/null | \
- sed -e '1,/^Available/d' | awk '{print $1}' | \
- sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \
- grep "^$cur" ) )
-}
-
-_mplayer()
-{
- local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
-
- COMPREPLY=()
- cmd=${COMP_WORDS[0]}
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(ac|afm|vc|vfm|ao|vo|vop|fstype|demuxer|vf|af))
- _mplayer_options_list mplayer $prev
- return 0
- ;;
- -@(oac|ovc|of))
- _mplayer_options_list mencoder $prev
- return 0
- ;;
- -audiofile)
- _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)'
- return 0
- ;;
- -font)
- _filedir '@(desc|ttf)'
- return 0
- ;;
- -sub)
- _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)'
- return 0
- ;;
- -vobsub)
- _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
- IFS=$'\t\n'
- COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
- if [ -f $i -a -r $i ]; then
- echo ${i%.*}
- else
- echo $i
- fi
- done ) )
- IFS=$' \t\n'
- return 0
- ;;
- -ifo)
- _filedir '@(ifo|IFO)'
- return 0
- ;;
- -cuefile)
- _filedir '@(bin|BIN|cue|CUE)'
- return 0
- ;;
- -skin)
- # if you don't have installed mplayer in /usr you
- # may want to set the MPLAYER_SKINS_DIR global variable
- if [ -n "$MPLAYER_SKINS_DIR" ]; then
- skinsdir=$MPLAYER_SKINS_DIR
- else
- skinsdir=/usr/share/mplayer/Skin
- fi
-
- IFS=$'\t\n'
- for i in ~/.mplayer/Skin $skinsdir; do
- if [ -d $i -a -r $i ]; then
- for j in $( compgen -d $i/$cur ); do
- COMPREPLY[$k]=${j#$i/}
- k=$((++k))
- done
- fi
- done
- IFS=$' \t\n'
- return 0
- ;;
- -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
- cur=${cur:=/dev/}
- _filedir
- return 0
- ;;
- -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
- -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
- -passlogfile)
- _filedir
- return 0
- ;;
- -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
- -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
- -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
- -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
- -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
- -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
- -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
- -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
- -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
- -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
- -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
- -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
- -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
- return 0
- ;;
- -lavdopts)
- COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \
- -- $cur ) )
- return 0
- ;;
- -lavcopts)
- COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \
- vqmax= mbqmin= mbqmax= vqdiff= \
- vmax_b_frames= vme= vhq v4mv \
- keyint= vb_strategy= vpass= \
- aspect= vbitrate= vratetol= \
- vrc_maxrate= vrc_minrate= \
- vrc_buf_size= vb_qfactor= vi_qfactor= \
- vb_qoffset= vi_qoffset= vqblur= \
- vqcomp= vrc_eq= vrc_override= \
- vrc_init_cplx= vqsquish= vlelim= \
- vcelim= vstrict= vdpart vpsize= gray \
- vfdct= idct= lumi_mask= dark_mask= \
- tcplx_mask= scplx_mask= naq ildct \
- format= pred qpel precmp= cmp= \
- subcmp= predia= dia= trell last_pred= \
- preme= subq= psnr mpeg_quant aic umv' \
- -- $cur ) )
- return 0
- ;;
- -ssf)
- COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \
- cvs=' -- $cur ) )
- return 0
- ;;
- -jpeg)
- COMPREPLY=( $( compgen -W 'noprogressive progressive \
- nobaseline baseline optimize= \
- smooth= quality= outdir=' -- $cur ) )
- return 0
- ;;
- -xvidopts)
- COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) )
- return 0
- ;;
- -xvidencopts)
- COMPREPLY=( $( compgen -W 'pass= bitrate= \
- fixed_quant= me_quality= 4mv \
- rc_reaction_delay_factor= \
- rc_averaging_period= rc_buffer= \
- quant_range= min_key_interval= \
- max_key_interval= mpeg_quant \
- mod_quant lumi_mask hintedme \
- hintfile debug keyframe_boost= \
- kfthreshold= kfreduction=' -- $cur ) )
- return 0
- ;;
- -divx4opts)
- COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \
- min_quant= max_quant= rc_period= \
- rc_reaction_period= crispness= \
- rc_reaction_ratio= pass= vbrpass= \
- help' -- $cur ) )
- return 0
- ;;
- -info)
- COMPREPLY=( $( compgen -W 'name= artist= genre= \
- subject= copyright= srcform= \
- comment= help' -- $cur ) )
- return 0
- ;;
- -lameopts)
- COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \
- ratio= vol= mode= padding= fast \
- preset= help' -- $cur ) )
- return 0
- ;;
- -rawaudio)
- COMPREPLY=( $( compgen -W 'on channels= rate= \
- samplesize= format=' -- $cur ) )
- return 0
- ;;
- -rawvideo)
- COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \
- 4cif pal ntsc w= h= y420 yv12 yuy2 \
- y8 format= size=' -- $cur ) )
- return 0
- ;;
- -aop)
- COMPREPLY=( $( compgen -W 'list= delay= format= fout= \
- volume= mul= softclip' -- $cur ) )
- return 0
- ;;
- -dxr2)
- COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \
- iec958-decoded mute ucode= 75ire bw \
- color interlaced macrovision= norm= \
- square-pixel ccir601-pixel cr-left= \
- cr-right= cr-top= cr-bot= ck-rmin= \
- ck-gmin= ck-bmin= ck-rmax= ck-gmax= \
- ck-bmax= ck-r= ck-g= ck-b= \
- ignore-cache= ol-osd= olh-cor= \
- olw-cor= olx-cor= oly-cor= overlay \
- overlay-ratio= update-cache' -- $cur ))
- return 0
- ;;
- -tv)
- COMPREPLY=( $( compgen -W 'on noaudio driver= device= \
- input= freq= outfmt= width= height= \
- buffersize= norm= channel= chanlist= \
- audiorate= forceaudio alsa amode= \
- forcechan= adevice= audioid= volume= \
- bass= treble= balance= fps= \
- channels= immediatemode=' -- $cur ) )
- return 0
- ;;
- -mf)
- COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
- -- $cur ) )
- return 0
- ;;
- -cdda)
- COMPREPLY=( $( compgen -W 'speed= paranoia= \
- generic-dev= sector-size= overlap= \
- toc-bias toc-offset= skip noskip' \
- -- $cur ) )
- return 0
- ;;
- -input)
- COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
- keylist cmdlist js-dev file' -- $cur ) )
- return 0
- ;;
- -af)
- COMPREPLY=( $( compgen -W 'resample resample= \
- channels channels= format format= \
- volume volume= delay delay= pan \
- pan= sub sub= surround surround=' \
- -- $cur ) )
- return 0
- ;;
- -af-adv)
- COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) )
- return 0
- ;;
- -profile)
- _mplayer_options_list $cmd $prev
- return 0
- ;;
- esac
-
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \
- -audiofile -cdrom-device -cache -cdda \
- -channels -chapter -csslib -demuxer \
- -dvd -dvd-device -dvdangle -dvdauth \
- -dvdkey -dvdnav -forceidx -fps -frames \
- -hr-mp3-seek -idx -mc -mf -ni -nobps \
- -passwd -rawaudio -rtsp-stream-over-tcp\
- -skipopening -sb -srate -ss -tv -user \
- -vcd -vid -vivo -ifo -ffactor -font \
- -noautosub -nooverlapsub -sid -slang \
- -sub -subcc -subcp -sub-demuxer \
- -subdelay -subfont-autoscale \
- -subfont-blur -subfont-encoding \
- -subfont-osd-scale -subfont-outline \
- -subfont-text-scale -subfps -subfile \
- -subpos -unicode -utf8 -vobsub \
- -vobsubid -ac -afm -aspect -flip \
- -lavdopts -noaspect -nosound -pp -ssf \
- -stereo -sws -vc -vfm -vop -xvidopts\
- -xy -zoom -bandwidth -cuefile \
- -noextbased -rawvideo -overlapsub \
- -sub-bg-alpha -sub-bg-color -subalign \
- -subwidth -sub-no-text-pp -spualign \
- -spuaa -spugauss -pphelp -verbose -v \
- -noni -noidx -nohr-mp3-seek -extbased \
- -bps -oldpp -nozoom -noflip -nounicode \
- -noutf8 -profile -vf -af' -- $cur ) )
- # add mplayer specific options
- [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \
- $(compgen -W '-autoq -autosync -benchmark \
- -framedrop -h -help -hardframedrop \
- -identify -input -lircconf -loop \
- -nojoystick -nolirc -nortc -playlist \
- -quiet -really-quiet -rnd -sdp -skin \
- -slave -softsleep -speed -sstep \
- -use-stdin -dumpaudio -dumpfile \
- -dumpstream -dumpvideo -dumpmicrodvdsub\
- -dumpmpsub -dumpsrtsub -dumpjacosub \
- -dumpsami -dumpsub -osdlevel -af \
- -af-adv -ao -aofile -aop -delay -mixer \
- -nowaveheader -bpp -brightness \
- -contrast -display -double -dr -dxr2 \
- -fb -fbmode -fbmodeconfig -forcexv -fs \
- -geometry -hue -icelayer -jpeg \
- -monitor-dotclock -monitor-hfreq \
- -monitor-vfreq -monitoraspect \
- -nograbpointer -noslices -panscan \
- -rootwin -saturation -screenw -screenh \
- -stop-xscreensaver -vm -vo -vsync -wid \
- -xineramascreen -z -zrbw -zrcrop \
- -zrdev -zrfd -zrhelp -zrnorm -zrquality \
- -zrvdec -zrhdec -zrxdoff -zrydoff -y \
- -edl -edlout -enqueue -fixed-vo \
- -menu -menu-root -menu-cfg -shuffle \
- -format -aahelp -dfbopts -fstype \
- -guiwid -nokeepaspect -x --help \
- -aaosdcolor -aasubcolor -aadriver \
- -aaextended -aaeight' -- $cur) )
- # add mencoder specific options
- [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \
- $(compgen -W '-audio-density -audio-delay \
- -audio-preload -divx4opts -endpos \
- -ffourcc -include -info -lameopts \
- -lavcopts -noskip -o -oac -ofps -ovc \
- -passlogfile -skiplimit -vobsubout \
- -vobsuboutindex -vobsuboutid \
- -xvidencopts -of --verbose' -- $cur) )
- ;;
- *)
- _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
- ;;
- esac
-
- return 0
-}
-complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
-}
-
-# KDE dcop completion
-#
-have dcop &&
-_dcop()
-{
- local cur compstr
-
- COMPREPLY=()
- cur=`_get_cword`
- if [ -z $cur ]; then
- compstr=${COMP_WORDS[*]}
- else
- compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
- fi
- COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) )
-} &&
-complete -F _dcop dcop
-
-# wvdial(1) completion
-#
-have wvdial &&
-_wvdial()
-{
- local cur prev config i IFS=$'\t\n'
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- --config)
- _filedir
- return 0
- ;;
- esac
-
- case $cur in
- -*)
- COMPREPLY=( $( compgen -W '--config --chat \
- --remotename --help --version --no-syslog' \
- -- $cur ) )
- ;;
- *)
- # start with global and personal config files
- config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
- # replace with command line config file if present
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
- config=${COMP_WORDS[i+1]}
- break
- fi
- done
- # parse config files for sections and
- # remove default section
- COMPREPLY=( $( sed -ne \
- "s|^\[Dialer \($cur.*\)\]$|\1|p" \
- $config 2>/dev/null |grep -v '^Defaults$'))
- # escape spaces
- COMPREPLY=${COMPREPLY// /\\ }
- ;;
- esac
-
-} &&
-complete -F _wvdial wvdial
-
-# gpg(1) completion
-#
-have gpg &&
-_gpg()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
- _filedir
- return 0
- ;;
- --@(export|@(?(l|nr|nrl)sign|edit)-key))
- # return list of public keys
- COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
- return 0
- ;;
- -@(r|-recipient))
- COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
- if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
- fi
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
- -q -n -N $(gpg --dump-options)' -- $cur ) )
- fi
-
-} &&
-complete -F _gpg $default gpg
-
-# iconv(1) completion
-#
-have iconv &&
-_iconv()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(f|t|-@(from|to)-code))
- COMPREPLY=( $( compgen -W \
- '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
- return 0
- ;;
- esac
-
-
- if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
- --output -o --verbose' -- "$cur" ) )
- return 0
- fi
-} &&
-complete -F _iconv $default iconv
-
-# dict(1) completion
-#
-{ have dict || have rdict; } && {
-_dictdata()
-{
- dict $host $port $1 2>/dev/null | sed -ne \
- 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
-}
-
-_dict()
-{
- local cur prev host port db dictfile
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- dictfile=/usr/share/dict/words
-
- for (( i=1; i < COMP_CWORD; i++ )); do
- case "${COMP_WORDS[i]}" in
- -@(h|--host))
- host=${COMP_WORDS[i+1]}
- [ -n "$host" ] && host="-h $host"
- i=$((++i))
- ;;
- -@(p|-port))
- port=${COMP_WORDS[i+1]}
- [ -n "$port" ] && port="-p $port"
- i=$((++i))
- ;;
- -@(d|-database))
- db=${COMP_WORDS[i+1]}
- [ -n "$db" ] && host="-d $db"
- i=$((++i))
- ;;
- *)
- ;;
- esac
- done
-
- if [[ "$cur" = -* ]]; then
- COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
- -m --match -s --strategy -c --config -C \
- --nocorrect -D --dbs -S --strats -H \
- --serverhelp -i --info -I --serverinfo \
- -a --noauth -u --user -k --key -V --version \
- -L --license --help -v --verbose -r --raw \
- -P --pager --debug --html --pipesize --client' \
- -- "$cur" ) )
- return 0
- fi
-
- case "$prev" in
- -@(d|-database|i|info))
- COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
- return 0
- ;;
- -@(s|-strategy))
- COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
- return 0
- ;;
- *)
- ;;
- esac
-
- [ -r $dictfile ] && \
- COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
-}
-complete -F _dict $default dict rdict
-}
-
-# cdrecord(1) completion
-#
-(have cdrecord || have wodim) &&
-_cdrecord()
-{
- local cur prev i generic_options track_options track_mode
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # foo=bar style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- @(text|cue)file)
- _filedir
- return 0
- ;;
- blank)
- COMPREPLY=( $( compgen -W 'help all fast \
- track unreserve trtail unclose session' \
- -- $cur ) )
- return 0
- ;;
- driveropts)
- COMPREPLY=( $( compgen -W 'burnfree noburnfree\
- varirec= audiomaster forcespeed noforcespeed\
- speedread nospeedread singlesession \
- nosinglesession hidecdr nohidecdr tattooinfo\
- tattoofile=' -- $cur ) )
- return 0
- ;;
- esac
- fi
-
- 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=)
- 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=)
- # look if previous was either a file or a track option
- track_mode=0
- if [ $COMP_CWORD -gt 1 ]; then
- if [ -f "$prev" ]; then
- track_mode=1
- else
- for (( i=0; i < ${#track_options[@]}; i++ )); do
- if [[ "${track_options[i]}" == "$prev" ]]; then
- track_mode=1
- break
- fi
- done
- fi
- fi
-
- # files are always eligible completion
- _filedir
- # track options are always available
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
- # general options are no more available after file or track option
- if [ $track_mode -eq 0 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${generic_options[@]}' -- $cur ) )
- fi
-
-} &&
-complete -F _cdrecord $filenames cdrecord wodim
-
-# mkisofs(8) completion
-#
-(have mkisofs || have genisoimage) &&
-_mkisofs()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
- _filedir
- return 0
- ;;
- -*-charset)
- COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \
- tail +3 | grep "^$cur") )
- return 0
- ;;
- -uid)
- _uids
- return 0
- ;;
- -gid)
- _gids
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
- -allow-multidot -biblio -cache-inodes \
- -no-cache-inodes -b -eltorito-alt-boot -B -G \
- -hard-disk-boot -no-emul-boot -no-boot \
- -boot-load-seg -boot-load-size \
- -boot-info-table -C -c -check-oldname \
- -check-session -copyright -d -D -dir-mode \
- -dvd-video -f -file-mode -gid -gui \
- -graft-points -hide -hide-list -hidden \
- -hidden-list -hide-joliet -hide-joliet-list \
- -hide-joliet-trans-tbl -hide-rr-moved \
- -input-charset -output-charset -iso-level -J \
- -joliet-long -jcharset -l -L -log-file -m \
- -exclude-list -max-iso9660-filenames -M -N \
- -new-dir-mode -nobak -no-bak -force-rr -no-rr \
- -no-split-symlink-components \
- -no-split-symlink-fields -o -pad -no-pad \
- -path-list -P -p -print-size -quiet -R -r \
- -relaxed-filenames -sort -split-output \
- -stream-media-size -stream-file-name -sysid -T\
- -table-name -ucs-level -udf -uid \
- -use-fileversion -U -no-iso-translate -V \
- -volset -volset-size -volset-seqno -v -x -z \
- -hfs -apple -map -magic -hfs-creator \
- -hfs-type -probe -no-desktop -mac-name \
- -boot-hfs-file -part -auto -cluster-size \
- -hide-hfs -hide-hfs-list -hfs-volid \
- -icon-position -root-info -prep-boot \
- -input-hfs-charset -output-hfs-charset \
- -hfs-unlock -hfs-bless -hfs-parms --cap \
- --netatalk --double --ethershare --ushare \
- --exchange --sgi --xinet --macbin --single \
- --dave --sfm --osx-double --osx-hfs' -- $cur ))
- else
- _filedir
- fi
-
-} &&
-complete -F _mkisofs $filenames mkisofs genisoimage
-
-# mc(1) completion
-#
-have mc &&
-_mc()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # -name value style option
- case "$prev" in
- -@(e|v|l|P))
- _filedir
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --@(edit|view|ftplog|printwd))
- _filedir
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
- --color -C --colors= -d --nomouse -e --edit= -f \
- --datadir -k --resetsoft -l --ftplog= -P --printwd= \
- -s --slow -t --termcap -u --nosubshell -U --subshell \
- -v --view= -V --version -x --xterm -h --help' -- $cur ) )
- else
- _filedir -d
- fi
-} &&
-complete -F _mc $filenames mc
-
-# yum(8) completion
-#
-have yum && {
-_yum_list()
-{
- if [[ "$1" == all ]] ; then
- # Try to strip in between headings like "Available Packages"
- # This will obviously only work for English :P
- COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- grep -iv '^\(Available\|Installed\|Updated\) Packages' | \
- sed -e 's/[[:space:]].*//' ) )
- else
- # Drop first line (e.g. "Updated Packages")
- COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
- sed -ne 1d -e 's/[[:space:]].*//p' ) )
- fi
-}
-
-_yum()
-{
- local cur prev special
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
- special=${COMP_WORDS[i]}
- fi
- done
-
- if [ -n "$special" ]; then
- case $special in
- install)
- _yum_list available
- return 0
- ;;
- deplist|info)
- _yum_list all
- return 0
- ;;
- upgrade|update)
- _yum_list updates
- return 0
- ;;
- remove|erase)
- # _rpm_installed_packages is not arch-qualified
- _yum_list installed
- return 0
- ;;
- esac
- fi
-
- case $cur in
- --*)
- COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
- return 0
- ;;
- -*)
- COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
- return 0
- ;;
- esac
-
- case $prev in
- list)
- COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) )
- ;;
- clean)
- COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) )
- ;;
- localinstall|localupdate)
- # TODO: should not match *src.rpm
- _filedir rpm
- ;;
- -c)
- _filedir
- ;;
- --installroot)
- _filedir -d
- ;;
- *)
- COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \
- search info provides clean groupinstall groupupdate \
- grouplist deplist erase groupinfo groupremove \
- localinstall localupdate makecache resolvedep \
- shell whatprovides' -- $cur ) )
- ;;
- esac
-}
-complete -F _yum $filenames yum
-
-# yum-arch(8) completion
-#
-_yum_arch()
-{
local cur
+
COMPREPLY=()
cur=`_get_cword`
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
- ;;
- *)
- _filedir -d
- ;;
- esac
-
- return 0
-
-}
-complete -F _yum_arch $filenames yum-arch
-}
-
-# ImageMagick completion
-#
-have convert && {
-_ImageMagick()
-{
- local prev
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -channel)
- COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
- Matte Cyan Magenta Yellow Black' -- $cur ) )
- return 0
- ;;
- -colormap)
- COMPREPLY=( $( compgen -W 'shared private' -- $cur ) )
- return 0
- ;;
- -colorspace)
- COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
- XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) )
- return 0
- ;;
- -compose)
- COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
- Minus Add Subtract Difference Multiply Bumpmap\
- Copy CopyRed CopyGreen CopyBlue CopyOpacity' \
- -- $cur ) )
- return 0
- ;;
- -compress)
- COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
- Lossless LZW RLE Zip' -- $cur ) )
- return 0
- ;;
- -dispose)
- COMPREPLY=( $( compgen -W 'Undefined None Background \
- Previous' -- $cur ) )
- return 0
- ;;
- -encoding)
- COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
- AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
- None SJIScode Symbol Unicode Wansung' -- $cur))
- return 0
- ;;
- -endian)
- COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) )
- return 0
- ;;
- -filter)
- COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
- Hanning Hamming Blackman Gaussian Quadratic \
- Cubic Catrom Mitchell Lanczos Bessel Sinc' \
- -- $cur ) )
- return 0
- ;;
- -format)
- COMPREPLY=( $( convert -list format | \
- awk '/ [r-][w-][+-] / {print $1}' | \
- tr -d '*' | tr [:upper:] [:lower:] | \
- grep "^$cur" ) )
- return 0
- ;;
- -gravity)
- COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
- West Center East SouthWest South SouthEast' \
- -- $cur ) )
- return 0
- ;;
- -intent)
- COMPREPLY=( $( compgen -W 'Absolute Perceptual \
- Relative Saturation' -- $cur ) )
- return 0
- ;;
- -interlace)
- COMPREPLY=( $( compgen -W 'None Line Plane Partition' \
- -- $cur ) )
- return 0
- ;;
- -limit)
- COMPREPLY=( $( compgen -W 'Disk File Map Memory' \
- -- $cur ) )
- return 0
- ;;
- -list)
- COMPREPLY=( $( compgen -W 'Delegate Format Magic \
- Module Resource Type' -- $cur ) )
- return 0
- ;;
- -map)
- COMPREPLY=( $( compgen -W 'best default gray red \
- green blue' -- $cur ) )
- _filedir
- return 0
- ;;
- -noise)
- COMPREPLY=( $( compgen -W 'Uniform Gaussian \
- Multiplicative \
- Impulse Laplacian Poisson' -- $cur ) )
- return 0
- ;;
- -preview)
- COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
- Saturation Brightness Gamma Spiff \
- Dull Grayscale Quantize Despeckle \
- ReduceNoise AddNoise Sharpen Blur \
- Treshold EdgeDetect Spread Shade \
- Raise Segment Solarize Swirl Implode \
- Wave OilPaint CharcoalDrawing JPEG' \
- -- $cur ) )
- return 0
- ;;
- -@(mask|profile|texture|tile|write))
- _filedir
- return 0
- ;;
- -type)
- COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \
- PaletteMatte TrueColor TrueColorMatte \
- ColorSeparation ColorSeparationlMatte \
- Optimize' -- $cur ) )
- return 0
- ;;
- -units)
- COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
- PixelsPerCentimeter' -- $cur ) )
- return 0
- ;;
- -virtual-pixel)
- COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \
- -- $cur ) )
- return 0
- ;;
- -visual)
- COMPREPLY=( $( compgen -W 'StaticGray GrayScale \
- StaticColor PseudoColor TrueColor \
- DirectColor defaut visualid' -- $cur ))
- return 0
- ;;
- esac
-}
-
-_convert()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
- -adaptive-sharpen -adjoin -affine -alpha -annotate \
- -antialias -append -attenuate -authenticate \
- -auto-orient -average -background -bench -bias \
- -black-point-compensation -black-threshold \
- -blue-primary -blur -border -bordercolor -caption \
- -channel -charcoal -chop -clip -clip-mask -clip-path \
- -clone -clut -coalesce -colorize -colors -colorspace \
- -combine -comment -compose -composite -compress \
- -contrast -contrast-stretch -convolve -crop -cycle \
- -debug -decipher -deconstruct -define -delay -delete \
- -density -depth -despeckle -display -dispose -distort \
- -dither -draw -edge -emboss -encipher -encoding \
- -endian -enhance -equalize -evaluate -extent -extract \
- -family -fill -filter -flatten -flip -floodfill -flop \
- -font -format -frame -fuzz -fx -gamma -gaussian-blur \
- -geometry -gravity -green-primary -help -identify \
- -implode -insert -intent -interlace -interpolate \
- -label -lat -layers -level -limit -linear-stretch \
- -liquid-rescale -list -log -loop -map -mask \
- -mattecolor -median -modulate -monitor -monochrome \
- -morph -mosaic -motion-blur -negate -noise -normalize \
- -opaque -ordered-dither -orient -page -paint -ping \
- -pointsize -polaroid -posterize -preview -print \
- -process -profile -quality -quantize -quiet \
- -radial-blur -raise -random-threshold -recolor \
- -red-primary -regard-warnings -region -render -repage \
- -resample -resize -respect-parenthesis -reverse -roll \
- -rotate -sample -sampling-factor -scale -scene -seed \
- -segment -separate -sepia-tone -set -shade -shadow \
- -sharpen -shave -shear -sigmoidal-contrast -size \
- -sketch -solarize -splice -spread -stretch -strip \
- -stroke -strokewidth -style -swap -swirl -taint \
- -texture -threshold -thumbnail -tile -tile-offset \
- -tint -transform -transparent -transparent-color \
- -transpose -transverse -treedepth -trim -type \
- -undercolor -unique-colors -units -unsharp -verbose \
- -version -view -vignette -virtual-pixel -wave \
- -weight -white-point -white-threshold \
- -write' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+adjoin +append +compress \
- +contrast +debug +dither +endian +gamma +label +map \
- +mask +matte +negate +noise +page +raise +render \
- +write' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _convert $filenames convert
-
-_mogrify()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
- -adaptive-sharpen -adjoin -affine -alpha -annotate \
- -antialias -attenuate -authenticate -auto-orient \
- -background -bias -black-point-compensation \
- -black-threshold -blue-primary -blur -border \
- -bordercolor -caption -channel -charcoal -chop -clip \
- -clip-mask -clip-path -clut -colorize -colors \
- -colorspace -comment -compose -compress -contrast \
- -contrast-stretch -convolve -cycle -debug -decipher \
- -define -delay -density -depth -despeckle -display \
- -dispose -distort -dither -draw -edge -emboss \
- -encipher -encoding -endian -enhance -equalize \
- -evaluate -extent -extract -family -fill -filter \
- -flip -floodfill -flop -font -format -frame -fuzz \
- -gamma -gaussian-blur -geometry -gravity \
- -green-primary -help -identify -implode -intent \
- -interlace -interpolate -label -lat -layers -level \
- -limit -linear-stretch -liquid-rescale -list -log \
- -loop -mask -mattecolor -median -modulate -monitor \
- -monochrome -motion-blur -negate -noise -normalize \
- -opaque -ordered-dither -orient -page -paint -path \
- -ping -pointsize -polaroid -posterize -preview -print \
- -profile -quality -quantize -quiet -radial-blur \
- -raise -random-threshold -recolor -red-primary \
- -regard-warnings -region -render -repage -resample \
- -resize -roll -rotate -sample -sampling-factor -scale \
- -scene -seed -segment -sepia-tone -set -shade -shadow \
- -sharpen -shave -shear -sigmoidal-contrast -size \
- -sketch -solarize -splice -spread -stretch -strip \
- -stroke -strokewidth -style -swirl -taint -texture \
- -threshold -thumbnail -tile -tile-offset -tint \
- -transform -transparent -transparent-color -transpose \
- -transverse -treedepth -trim -type -undercolor \
- -unique-colors -units -unsharp -verbose -version \
- -view -vignette -virtual-pixel -wave -weight \
- -white-point -white-threshold' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
- +endian +gamma +label +map +mask +matte +negate +page \
- +raise' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _mogrify $filenames mogrify
-
-_display()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
- -auto-orient -backdrop -background -border \
- -bordercolor -borderwidth -channel -clip \
- -clip-path -coalesce -colormap -colors -colorspace \
- -comment -compress -contrast -crop -debug -decipher \
- -define -delay -density -depth -despeckle -display \
- -dispose -dither -edge -endian -enhance -extract \
- -filter -flatten -flip -flop -font -foreground \
- -format -frame -gamma -geometry -help -iconGeometry \
- -iconic -identify -immutable -interlace -interpolate \
- -label -limit -list -log -loop -map -mattecolor \
- -monitor -monochrome -name -negate -page -profile \
- -quality -quantize -quiet -raise -regard-warnings \
- -remote -repage -resample -resize \
- -respect-parenthesis -roll -rotate -sample \
- -sampling-factor -scenes -seed -segment -set \
- -shared-memory -sharpen -size -strip -texture -title \
- -transparent-color -treedepth -trim -update \
- -usePixmap -verbose -version -virtual-pixel -visual \
- -window -window-group -write' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
- +endian +gamma +label +map +matte +negate +page \
- +raise +write' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _display $filenames display
-
-_animate()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \
- -background -bordercolor -borderwidth -channel \
- -coalesce -colormap -colors -colorspace -crop -debug \
- -decipher -define -delay -density -depth -display \
- -dispose -dither -extract -filter -flatten -font \
- -foreground -format -gamma -geometry -help \
- -iconGeometry -iconic -identify -immutable -interlace \
- -interpolate -limit -list -log -loop -map -mattecolor \
- -mattecolor -monitor -monochrome -name -page -pause \
- -quantize -quiet -regard-warnings -remote -repage \
- -resample -resize -respect-parenthesis -rotate \
- -sampling-factor -scenes -seed -set -shared-memory \
- -size -strip -title -transparent-color -treedepth \
- -trim -verbose -version -virtual-pixel -visual \
- -window' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _animate $filenames animate
-
-_identify()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
- -channel -colorspace -crop -debug -define -density \
- -depth -extract -format -fuzz -gamma -help -interlace \
- -interpolate -limit -list -log -monitor -ping -quiet \
- -regard-warnings -respect-parenthesis \
- -sampling-factor -seed -set -size -strip -units \
- -verbose -version -virtual-pixel' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _identify $filenames identify
-
-_montage()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \
- -authenticate -background -blue-primary -blur -border \
- -bordercolor -borderwidth -caption -channel -clone \
- -coalesce -colors -colorspace -comment -compose \
- -compress -crop -debug -define -density -depth \
- -display -dispose -dither -draw -encoding -endian \
- -extract -fill -filter -flatten -flip -flop -font \
- -format -frame -gamma -geometry -gravity \
- -green-primary -help -identify -interlace \
- -interpolate -label -limit -list -log -mattecolor \
- -mode -monitor -monochrome -origin -page -pointsize \
- -polaroid -profile -quality -quantize -quiet \
- -red-primary -regard-warnings -repage -resize \
- -respect-parenthesis -rotate -sampling-factor -scenes \
- -seed -set -shadow -size -strip -stroke -texture \
- -thumbnail -tile -title -transform -transparent \
- -transparent-color -treedepth -trim -type -units \
- -verbose -version -virtual-pixel \
- -white-point' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
- +endian +gamma +label +matte +page' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _montage $filenames montage
-
-_composite()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \
- -blend -blue-primary -border -bordercolor -channel \
- -colors -colorspace -comment -compose -compress \
- -debug -decipher -define -density -depth -displace \
- -display -dispose -dissolve -dither -encipher \
- -encoding -endian -extract -filter -font -format \
- -geometry -gravity -green-primary -help -identify \
- -interlace -interpolate -label -limit -list -log \
- -monitor -monochrome -negate -page -profile -quality \
- -quantize -quiet -red-primary -regard-warnings \
- -repage -resize -respect-parenthesis -rotate \
- -sampling-factor -scene -seed -sharpen -shave -size \
- -stegano -stereo -strip -swap -thumbnail -tile \
- -transform -transparent-color -treedepth -type -units \
- -unsharp -verbose -version -virtual-pixel -watermark \
- -white-point -write' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
- +matte +negate +page +write' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _composite $filenames composite
-
-_compare()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \
- -colorspace -compress -debug -decipher -define \
- -density -depth -encipher -extract -format -fuzz \
- -help -highlight-color -identify -interlace -limit \
- -list -log -metric -monitor -passphrase -profile \
- -quality -quantize -quiet -regard-warnings \
- -respect-parenthesis -sampling-factor -seed -set \
- -size -transparent-color -type -verbose -version \
- -virtual-pixel' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _compare $filenames compare
-
-_conjure()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor \
- -quiet -regard-warnings -seed -verbose \
- -version' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _conjure $filenames conjure
-
-_import()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \
- -colors -colorspace -comment -compress -crop -debug \
- -define -delay -density -depth -descend -display \
- -dispose -dither -encipher -encoding -endian -filter \
- -format -frame -geometry -gravity -help -identify \
- -interlace -interpolate -label -limit -list -log \
- -monitor -monochrome -negate -page -pause -pointsize \
- -quality -quantize -quiet -regard-warnings -repage \
- -resize -respect-parenthesis -rotate -sampling-factor \
- -scene -screen -seed -set -silent -snaps -strip \
- -thumbnail -transparent -transparent-color -treedepth \
- -trim -type -verbose -version -virtual-pixel \
- -window' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _import $filenames import
-
-_stream()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _ImageMagick
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \
- -compress -debug -define -density -depth -extract \
- -help -identify -interlace -interpolate -limit -list \
- -log -map -monitor -quantize -quiet -regard-warnings \
- -respect-parenthesis -sampling-factor -seed -set \
- -size -storage-type -transparent-color -verbose \
- -version -virtual-pixel' -- $cur ) )
- elif [[ "$cur" == +* ]]; then
- COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _stream $filenames stream
-}
-
-# dd(1) completion
-#
-have dd &&
-_dd()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$cur" in
- if=*|of=*)
- cur=${cur#*=}
- _filedir
- return 0
- ;;
- conv=*)
- cur=${cur#*=}
- COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
- lcase notrunc ucase swab noerror sync' \
- -- $cur ) )
- return 0
- ;;
- esac
-
- _expand || return 0
-
- COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
- $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
- -S '=' -- $cur ) )
-} &&
-complete -F _dd $nospace $filenames dd
-
-# CUPS cancel(1) completion
-#
-have cancel &&
-_cancel()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) )
-} &&
-complete -F _cancel $filenames cancel
-
-# aspell(1) completion
-#
-have aspell && {
-_aspell_dictionary()
-{
- local datadir
- datadir=/usr/lib/aspell
- COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
- COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
-}
-
-_aspell()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case "$prev" in
- @(-c|-p|check))
- _filedir
- return 0
- ;;
- @(dump|create|merge))
- COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
- return 0
- ;;
- -d)
- _aspell_dictionary
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --@(conf|personal|repl|per-conf))
- _filedir
- return 0
- ;;
- --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
- _filedir -d
- return 0
- ;;
- --master)
- _aspell_dictionary
- return 0
- ;;
- --mode)
- COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
- return 0
- ;;
- --sug-mode)
- COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
- return 0
- ;;
- --keymapping)
- COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
- --encoding= --add-filter= --rem-filter= --mode= -e \
- -H -t --add-extra-dicts= --rem-extra-dicts= \
- --home-dir= -W --ignore= --ignore-accents \
- --dont-ignore-accents --ignore-case --dont-ignore-case \
- --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
- --lang= --language-tag= --local-data-dir= -d --master= \
- --module= --add-module-search-order= \
- --rem-module-search-order= --per-conf= -p --personal= \
- --prefix= --repl= -C -B --run-together --dont-run-together \
- --run-together-limit= --run-together-min= --save-repl \
- --dont-save-repl --set-prefix --dont-set-prefix --size= \
- --spelling= --strip-accents --dont-strip-accents \
- --sug-mode= --add-word-list-path= --rem-word-list-path= \
- -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
- --time --dont-time --keymapping= --add-email-quote= \
- --rem-email-quote= --email-margin= --add-tex-command= \
- --rem-tex-command= --tex-check-comments \
- --dont-tex-check-comments --add-tex-extension= \
- --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
- --add-sgml-extension= --rem-sgml-extension=' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
- config config soundslike filter -v version dump \
- create merge' -- $cur ) )
- fi
-
-}
-complete -F _aspell $filenames aspell
-}
-
-# xmms(1) completion
-#
-have xmms &&
-_xmms()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
- -u --pause -s --stop -t --play-pause -f --fwd -e \
- --enqueue -m --show-main-window -i --sm-client-id \
- -v --version' -- $cur ) )
- else
- _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
-
- fi
-
-} &&
-complete -F _xmms $filenames xmms
-
-# info(1) completion
-#
-have info &&
-_info()
-{
- local cur infopath
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _expand || return 0
-
- # default completion if parameter contains /
- if [[ "$cur" == */* ]]; then
- _filedir
- return 0
- fi
-
- infopath='/usr/share/info'
-
- if [ "${INFOPATH: -1:1}" == ':' ]; then
- infopath=${INFOPATH}${infopath}
- elif [ ${INFOPATH:+set} ]; then
- infopath=$INFOPATH
- fi
-
- infopath=$infopath:
- if [ -n "$cur" ]; then
- infopath="${infopath//://$cur* }"
- else
- infopath="${infopath//:// }"
- fi
-
- # redirect stderr for when path doesn't exist
- COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
- # weed out directory path names and paths to info pages
- COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
- # weed out info dir file
- for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
- if [ "${COMPREPLY[$i]}" == 'dir' ]; then
- unset COMPREPLY[$i];
- fi;
- done
- # strip suffix from info pages
- COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
-
- return 0
-} &&
-complete -F _info $filenames info
-
-# dhclient(1) completion
-#
-have dhclient && _dhclient()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(cf|lf|pf|sf))
- _filedir
- return 0
- ;;
- -s)
- _known_hosts
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
- -cf -sf -s -g -n -nw -w' -- $cur ) )
- else
- _available_interfaces
- fi
-} &&
-complete -F _dhclient dhclient
-
-# lvm(8) completion
-#
-have lvm && {
-_volumegroups()
-{
- COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
- sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) )
-}
-
-_physicalvolumes()
-{
- COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
- sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) )
-}
-
-_logicalvolumes()
-{
- COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
- sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) )
-}
-
-_units()
-{
- COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) )
-}
-
-_sizes()
-{
- COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) )
-}
-
-_args()
-{
- args=0
- if [[ "${COMP_WORDS[0]}" == lvm ]]; then
- offset=2
- else
- offset=1
- fi
- for (( i=$offset; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- args=$(($args + 1))
- fi
- done
-}
-
-_lvmdiskscan()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
- --lvmpartition -v --verbose --version' -- $cur ) )
- fi
-}
-complete -F _lvmdiskscan lvmdiskscan
-
-_pvscan()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -e \
- --exported -n --novolumegroup -h -? \
- --help --ignorelockingfailure -P \
- --partial -s --short -u --uuid -v \
- --verbose --version' -- $cur ) )
- fi
-}
-complete -F _pvscan pvscan
-
-_pvs()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(o|O|-options|-sort))
- COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
- pv_size pv_free pv_used pv_name \
- pv_attr pv_pe_count \
- pv_pe_alloc_count' -- $cur ) )
- return 0
- ;;
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
- -h -? --help --ignorelockingfailure --noheadings \
- --nosuffix -o --options -O --sort \
- --separator --unbuffered --units \
- -v --verbose --version' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvs pvs
-
-_pvdisplay()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -v --verbose -d --debug -h --help --version' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvdisplay pvdisplay
-
-_pvchange()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|x|-autobackup|--allocatable))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
- -d --debug -h --help -t --test -u --uuid -x \
- --allocatable -v --verbose --addtag --deltag \
- --version' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvchange pvchange
-
-_pvcreate()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --restorefile)
- _filedir
- return 0
- ;;
- -@(M|-metadatatype))
- COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
- return 0
- ;;
- --metadatacopies)
- COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
- return 0
- ;;
- --@(metadatasize|setphysicalvolumesize))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
- --force -h -? --help --labelsector -M --metadatatype \
- --metadatacopies --metadatasize \
- --setphysicalvolumesize -t --test -u --uuid uuid -v \
- --verbose -y --yes --version' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvcreate pvcreate
-
-_pvmove()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(n|-name))
- _logicalvolumes
- return 0
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--abort -A --autobackup \
- -b --background -d --debug -f --force -h -? \
- --help -i --interval -t --test -v --verbose \
- --version -n --name' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvmove pvmove
-
-_pvremove()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
- --help -y --yes -t --test -v --verbose \
- --version' -- $cur ) )
- else
- _physicalvolumes
- fi
-}
-complete -F _pvremove pvremove
-
-_vgscan()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help \
- --ignorelockingfailure --mknodes -P \
- --partial -v --verbose --version' -- $cur ) )
- fi
-}
-complete -F _vgscan vgscan
-
-_vgs()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(o|O|-options|-sort))
- COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
- vg_attr vg_size vg_free vg_sysid \
- vg_extent_size vg_extent_count vg_free_count \
- max_lv max_pv pv_count lv_count snap_count \
- vg_seqno' -- $cur ) )
- return 0
- ;;
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -d --debug \
- -h --help --ignorelockingfailure --noheadings \
- --nosuffix -o --options -O --sort -P --partial \
- --separator --unbuffered --units \
- -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgs vgs
-
-_vgdisplay()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -P --partial -A --activevolumegroups -v --verbose \
- -d --debug -h --help --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgdisplay vgdisplay
-
-_vgchange()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(a|A|x|-available|-autobackup|-resizeable))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
- --partial -d --debug -h --help --ignorelockingfailure \
- -t --test -u --uuid -v --verbose --version -a \
- --available -x --resizeable -l --logicalvolume \
- --addtag --deltag' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgchange vgchange
-
-_vgcreate()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(M|-metadatatype))
- COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
- return 0
- ;;
- -@(s|-physicalextentsize))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --addtag \
- --alloc -d --debug -h --help -l --maxlogicalvolumes \
- -M --metadatatype -p --maxphysicalvolumes -s \
- --physicalextentsize -t --test -v --verbose \
- --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 ]; then
- _volumegroups
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _vgcreate vgcreate
-
-_vgremove()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
- -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgremove vgremove
-
-_vgrename()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgrename vgrename
-
-_vgreduce()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
- --debug -h --help --removemissing -t --test -v \
- --verbose --version' -- $cur ) )
-
- else
- _args
- if [ $args -eq 0 ]; then
- _volumegroups
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _vgreduce vgreduce
-
-_vgextend()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(L|-size))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 ]; then
- _volumegroups
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _vgextend vgextend
-
-_vgport()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
- -? --help -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgport vgimport vgexport
-
-_vgck()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h \
- -? --help -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgck vgck
-
-_vgconvert()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(M|-metadatatype))
- COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
- return 0
- ;;
- --metadatacopies)
- COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
- return 0
- ;;
- --metadatasize)
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
- -M --metadatatype --metadatacopies --metadatasize \
- -t --test -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgconvert vgconvert
-
-_vgcfgbackup()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(f|-file))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
- --ignorelockingfailure -P --partial -v --verbose \
- --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgcfgbackup vgcfgbackup
-
-_vgcfgrestore()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(f|-file))
- _filedir
- return 0
- ;;
- -@(M|-metadatatype))
- COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
- return 0
- ;;
- -@(n|-name))
- _volumegroups
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
- -h --help -M --Metadatatype -n --name -t --test \
- -v --verbose --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgcfgrestore vgcfgrestore
-
-_vgmerge()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
- -h --help -l --list -t --test -v --verbose \
- --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgmerge vgmerge
-
-_vgsplit()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(M|-metadatatype))
- COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
- -h --help -l --list -M --metadatatype -t --test \
- -v --verbose --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 -o $args -eq 1 ]; then
- _volumegroups
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _vgsplit vgsplit
-
-_vgmknodes()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
- --version' -- $cur ) )
- else
- _volumegroups
- fi
-}
-complete -F _vgmknodes vgmknodes
-
-_lvscan()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
- -h -? --help --ignorelockingfailure -P \
- --partial -v --verbose --version' -- $cur ) )
- fi
-}
-complete -F _lvscan lvscan
-
-_lvs()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(o|O|-options|-sort))
- COMPREPLY=( $( compgen -W 'lv_uuid lv_name \
- lv_attr lv_minor lv_size seg_count \
- origin snap_percent segtype stripes \
- stripesize chunksize seg_start \
- seg_size' -- $cur ) )
- return 0
- ;;
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--aligned -d --debug \
- -h --help --ignorelockingfailure --noheadings \
- --nosuffix -o --options -O --sort -P --partial \
- --segments --separator --unbuffered --units \
- -v --verbose --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvs lvs
-
-_lvdisplay()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --units)
- _units
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
- -P --partial -m --maps -v --verbose -d --debug -h \
- --help --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvdisplay lvdisplay
-
-_lvchange()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(p|-permission))
- COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
- --addtag --alloc -C --contiguous -d --debug --deltag \
- -f --force -h --help --ignorelockingfailure -M \
- --persistent --major major --minor minor -P --partial \
- -p --permission -r --readahead --refresh -t --test \
- -v --verbose --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvchange lvchange
-
-_lvcreate()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(L|-size))
- _sizes
- return 0
- ;;
- -@(p|-permission))
- COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
- return 0
- ;;
- -@(n|-name))
- _logicalvolumes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
- -C --contiguous -d --debug -h -? --help -i --stripes \
- -I --stripesize -l --extents -L --size -M --persistent \
- --major --minor -n --name -p --permission -r \
- --readahead -t --test --type -v --verbose -Z --zero \
- --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 ]; then
- _volumegroups
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _lvcreate lvcreate
-
-_lvremove()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
- --force -h -? --help -t --test -v --verbose \
- --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvremove lvremove
-
-_lvrename()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
- -? --help -t --test -v --verbose --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvrename lvrename
-
-_lvreduce()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(L|-size))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup -d \
- --debug -f --force -h --help -l --extents \
- -L --size -n --nofsck -r --resizefs -t --test \
- -v --verbose --version' -- $cur ) )
- else
- _logicalvolumes
- fi
-}
-complete -F _lvreduce lvreduce
-
-_lvresize()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(L|-size))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
- --debug -h --help -i --stripes -I --stripesize \
- -l --extents -L --size -n --nofsck -r --resizefs \
- -t --test --type -v --verbose --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 ]; then
- _logicalvolumes
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _lvresize lvresize
-
-_lvextend()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(A|-autobackup))
- COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
- return 0
- ;;
- -@(L|-size))
- _sizes
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
- --debug -h --help -i --stripes -I --stripesize \
- -l --extents -L --size -n --nofsck -r --resizefs \
- -t --test --type -v --verbose --version' -- $cur ) )
- else
- _args
- if [ $args -eq 0 ]; then
- _logicalvolumes
- else
- _physicalvolumes
- fi
- fi
-}
-complete -F _lvextend lvextend
-
-_lvm()
-{
- local prev
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
- lvcreate lvdisplay lvextend lvmchange \
- lvmdiskscan lvmsadc lvmsar lvreduce \
- lvremove lvrename lvresize lvs lvscan \
- pvchange pvcreate pvdata pvdisplay pvmove \
- pvremove pvresize pvs pvscan vgcfgbackup \
- vgcfgrestore vgchange vgck vgconvert \
- vgcreate vgdisplay vgexport vgextend \
- vgimport vgmerge vgmknodes vgreduce \
- vgremove vgrename vgs vgscan vgsplit \
- version' -- $cur ) )
- else
- case ${COMP_WORDS[1]} in
- pvchange)
- _pvchange
- ;;
- pvcreate)
- _pvcreate
- ;;
- pvdisplay)
- _pvdisplay
- ;;
- pvmove)
- _pvmove
- ;;
- pvremove)
- _pvremove
- ;;
- pvresize)
- _pvresize
- ;;
- pvs)
- _pvs
- ;;
- pvscan)
- _pvscan
- ;;
- vgcfgbackup)
- _vgcfgbackup
- ;;
- vgcfgrestore)
- _vgcfgrestore
- ;;
- vgchange)
- _vgchange
- ;;
- vgck)
- _vgck
- ;;
- vgconvert)
- _vgconvert
- ;;
- vgcreate)
- _vgcreate
- ;;
- vgdisplay)
- _vgdisplay
- ;;
- vgexport)
- _vgexport
- ;;
- vgextend)
- _vgextend
- ;;
- vgimport)
- _vgimport
- ;;
- vgmerge)
- _vgmerge
- ;;
- vgmknodes)
- _vgmknodes
- ;;
- vgreduce)
- _vgreduce
- ;;
- vgremove)
- _vgremove
- ;;
- vgrename)
- _vgrename
- ;;
- vgs)
- _vgs
- ;;
- vgscan)
- _vgscan
- ;;
- vgsplit)
- _vgsplit
- ;;
- lvchange)
- _lvchange
- ;;
- lvcreate)
- _lvcreate
- ;;
- lvdisplay)
- _lvdisplay
- ;;
- lvextend)
- _lvextend
- ;;
- lvreduce)
- _lvreduce
- ;;
- lvremove)
- _lvremove
- ;;
- lvrename)
- _lvrename
- ;;
- lvresize)
- _lvresize
- ;;
- lvs)
- _lvs
- ;;
- lvscan)
- _lvscan
- ;;
- esac
- fi
-}
-complete -F _lvm lvm
-}
-
-# mkinitrd(8) completion
-#
-have mkinitrd &&
-_mkinitrd()
-{
- local cur args
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case "$prev" in
- --preload)
- _modules
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --@(with|builtin))
- _modules
- return 0
- ;;
- --@(fstab|dsdt))
- _filedir
- return 0
- ;;
- --tmpdir)
- _filedir -d
- return 0
- ;;
- esac
- fi
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version -v -f --preload \
- --with= --omit-scsi-modules --omit-raid-modules \
- --images-version --fstab= --nocompress --builtin= \
- --nopivot --noudev --allow-missing --tmpdir= \
- --initrdfs= --dsdt= --lvm-version= --froce-usb' \
- -- $cur ) )
- else
- _count_args
-
- case $args in
- 1)
- _filedir
- ;;
- 2)
- COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
- ;;
- esac
- fi
-
-} &&
-complete -F _mkinitrd mkinitrd
-
-# pkgconfig(1) completion
-#
-have pkg-config &&
-_pkg_config()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '-version --modversion \
- --atleast-pkgconfig-version= --libs --libs-only-l \
- --libs-only-other --libs-only-L --cflags \
- --cflags-only-I --cflags-only-other --variable= \
- --define-variable= --exists --uninstalled \
- --atleast-version= --exact-version= --max-version= \
- --list-all --debug --print-errors --silence-errors \
- --errors-to-stdout -? --help --usage' -- $cur))
- else
- COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
- awk '{print $1}' | grep "^$cur" ) )
- fi
+ if [ $COMP_CWORD = 1 ]; then
+ COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' ) )
+ fi
} &&
-complete -F _pkg_config pkg-config
-
-
-# cpio(1) completion
-#
-have cpio && {
-_cpio_format()
-{
- COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
-}
-
-_cpio()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case $prev in
- -H)
- _cpio_format
- return 0
- ;;
- -@(E|F|I))
- _filedir
- return 0
- ;;
- -R)
- _usergroup
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _cpio_format
- return 0
- ;;
- --@(file|pattern-file))
- _filedir
- return 0
- ;;
- --owner)
- _usergroup
- return 0
- ;;
- --rsh-command)
- COMPREPLY=( $( compgen -c -- $cur ) )
- return 0
- ;;
- esac
- fi
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
- else
- case ${COMP_WORDS[1]} in
- -@(o|-create))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
- -L -V -C -H -M -O -F --file= --format=\
- --message= --null --reset-access-time\
- --verbose --dot --append --block-size=\
- --dereference --io-size= --quiet\
- --force-local --rsh-command= --help\
- --version' -- $cur ) )
- fi
- ;;
- -@(i|-extract))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
- -t -s -u -v -B -S -V -C -E -H -M -R -I\
- -F --file= --make-directories\
- --nonmatching\
- --preserve-modification-time\
- --numeric-uid-gid --rename -t --list\
- --swap-bytes --swap --dot\
- --unconditional --verbose --block-size=\
- --swap-halfwords --io-size=\
- --pattern-file= --format= --owner=\
- --no-preserve-owner --message=\
- --force-local --no-absolute-filenames\
- --sparse --only-verify-crc --quiet\
- --rsh-command= --help\
- --version' -- $cur ) )
- fi
- ;;
- -@(p|-pass-through))
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
- -L -V -R --null --reset-access-time\
- --make-directories --link --quiet\
- --preserve-modification-time\
- --unconditional --verbose --dot\
- --dereference --owner=\
- --no-preserve-owner --sparse --help\
- --version' -- $cur ) )
- else
- _filedir -d
- fi
- ;;
- esac
- fi
-}
-complete -F _cpio cpio
-}
+complete -F _look $default look
# id(1) completion
#
have id &&
_id()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
- -r --real -u --user --help --version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -u $cur ) )
- fi
-} &&
-complete -F _id id
-
-# getent(1) completion
-#
-have getent &&
-_getent()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- passwd)
- COMPREPLY=( $( compgen -u $cur ) )
- return 0
- ;;
- group)
- COMPREPLY=( $( compgen -g $cur ) )
- return 0
- ;;
- services)
- COMPREPLY=( $( compgen -s $cur ) )
- return 0
- ;;
- hosts)
- COMPREPLY=( $( compgen -A hostname $cur ) )
- return 0
- ;;
- protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
- COMPREPLY=( $( getent $prev | \
- sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ) )
- return 0
- ;;
- aliases|shadow)
- COMPREPLY=( $( getent $prev | \
- sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ) )
- return 0
- ;;
- esac
-
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'passwd group hosts services \
- protocols networks ahosts ahostsv4 \
- ahostsv6 aliases ethers netgroup \
- rpc shadow' -- $cur ) )
- fi
-} &&
-complete -F _getent getent
-
-# ntpdate(1) completion
-#
-have ntpdate &&
-_ntpdate()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -k)
- _filedir
- return 0
- ;;
- -U)
- COMPREPLY=( $( compgen -u $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
- -e -k -p -o -r -t' -- $cur ) )
- else
- _known_hosts
- fi
-} &&
-complete -F _ntpdate ntpdate
-
-# smartctl(8) completion
-#
-have smartctl && {
-_smartctl_quietmode()
-{
- COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) )
-}
-_smartctl_device()
-{
- COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) )
-}
-_smartctl_tolerance()
-{
- COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
-}
-_smartctl_badsum()
-{
- COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) )
-}
-_smartctl_report()
-{
- COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
-}
-_smartctl_feature()
-{
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
-}
-_smartctl_log()
-{
- COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
-}
-_smartctl_vendorattribute()
-{
- COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
- 9,temp 192,emergencyretractcyclect 193,loadunload \
- 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
- 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
-}
-_smartctl_firmwarebug()
-{
- COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) )
-}
-_smartctl_presets()
-{
- COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
-}
-_smartctl_test()
-{
- COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) )
-}
-
-_smartctl()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case "$prev" in
- -q)
- _smartctl_quietmode
- ;;
- -d)
- _smartctl_device
- return 0
- ;;
- -t)
- _smartctl_tolerance
- return 0
- ;;
- -b)
- _smartctl_badsum
- return 0
- ;;
- -r)
- _smartctl_report
- return 0
- ;;
- -s)
- _smartctl_feature
- return 0
- ;;
- -o)
- _smartctl_feature
- return 0
- ;;
- -S)
- _smartctl_feature
- return 0
- ;;
- -l)
- _smartctl_log
- return 0
- ;;
- -v)
- _smartctl_vendorattribute
- return 0
- ;;
- -F)
- _smartctl_firmwarebug
- return 0
- ;;
- -P)
- _smartctl_presets
- return 0
- ;;
- -t)
- _smartctl_test
- return 0
- ;;
- esac
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --quietmode)
- _smartctl_quietmode
- return 0
- ;;
- --device)
- _smartctl_device
- return 0
- ;;
- --tolerance)
- _smartctl_tolerance
- return 0
- ;;
- --badsum)
- _smartctl_badsum
- return 0
- ;;
- --report)
- _smartctl_report
- return 0
- ;;
- --smart)
- _smartctl_feature
- return 0
- ;;
- --offlineauto)
- _smartctl_feature
- return 0
- ;;
- --saveauto)
- _smartctl_feature
- return 0
- ;;
- --log)
- _smartctl_log
- return 0
- ;;
- --vendorattribute)
- _smartctl_vendorattribute
- return 0
- ;;
- --firmwarebug)
- _smartctl_firmwarebug
- return 0
- ;;
- --presets)
- _smartctl_presets
- return 0
- ;;
- --test)
- _smartctl_test
- return 0
- ;;
- esac
- fi
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
- --copyright --license-i --info -a --all -q \
- --quietmode= -d --device= -T --tolerance= -b --badsum= \
- -r --report= -s --smart= -o --offlineauto= -S \
- --saveauto= -H --health -c --capabilities -A \
- --attributes -l --log= -v --vendorattribute= -F \
- --firmwarebug= -P --presets= -t --test= -C \
- --captive -X --abort' -- $cur ) )
- else
- cur=${cur:=/dev/}
- _filedir
- fi
-}
-complete -F _smartctl smartctl
-}
-
-# sysctl(8) completion
-#
-have sysctl &&
-_sysctl()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
-
- return 0
-} &&
-complete -F _sysctl sysctl
-
-# update-rc.d(8) completion
-#
-# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
-#
-have update-rc.d &&
-_update_rc_d()
-{
- local cur prev sysvdir services options valid_options
+ local cur
+ COMPREPLY=()
cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
-
- services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
- services=( ${services[@]#$sysvdir/} )
- options=( -f -n )
-
- if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
- valid_options=( $( \
- echo "${COMP_WORDS[@]} ${options[@]}" \
- | tr " " "\n" \
- | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
- | sort | uniq -u \
- ) )
- COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
- -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) )
- elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
- COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) )
- elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
- COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
- elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
- COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
- elif [[ "$prev" == defaults && -z "$cur" ]]; then
- COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k )
- elif [[ "$prev" == ?(start|stop) ]]; then
- if [[ "$cur" == [0-9] || -z "$cur" ]]; then
- COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
- elif [[ "$cur" == [0-9][0-9] ]]; then
- COMPREPLY=( $cur )
- else
- COMPREPLY=()
- fi
- elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
- if [[ -z "$cur" ]]; then
- if [[ $prev == [0-9][0-9] ]]; then
- COMPREPLY=( 0 1 2 3 4 5 6 S )
- else
- COMPREPLY=( 0 1 2 3 4 5 6 S . )
- fi
- elif [[ "$cur" == [0-6S.] ]]; then
- COMPREPLY=( $cur )
- else
- COMPREPLY=()
- fi
- elif [[ "$prev" == "." ]]; then
- COMPREPLY=( $(compgen -W "start stop" -- $cur) )
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
+ -r --real -u --user --help --version' -- "$cur" ) )
else
- COMPREPLY=()
+ COMPREPLY=( $( compgen -u "$cur" ) )
fi
-
- return 0
} &&
-complete -F _update_rc_d update-rc.d
+complete -F _id id
-# invoke-rc.d(8) completion
-#
-# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
-#
-have invoke-rc.d &&
-_invoke_rc_d()
+_filedir_xspec()
{
- local cur prev sysvdir services options valid_options
+ local IFS cur xspec
+ IFS=$'\t\n'
+ COMPREPLY=()
cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
- || sysvdir=/etc/init.d
-
- services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
- services=( ${services[@]#$sysvdir/} )
- options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback )
-
- if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
- valid_options=( $( \
- echo ${COMP_WORDS[@]} ${options[@]} \
- | tr " " "\n" \
- | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
- | sort | uniq -u \
- ) )
- COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \
- $cur ) )
- elif [ -x $sysvdir/$prev ]; then
- COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
- s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
- $sysvdir/$prev`' -- \
- $cur ) )
- else
- COMPREPLY=()
- fi
- return 0
-} &&
-complete -F _invoke_rc_d invoke-rc.d
-
-# minicom(1) completion
-#
-have minicom &&
-_minicom()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -@(a|c))
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
- return 0
- ;;
- -@(S|C))
- _filedir
- return 0
- ;;
- -P)
- COMPREPLY=( $( command ls /dev/tty* ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
- -c -S -d -p -C -T -8' -- $cur ) )
- else
- COMPREPLY=( $( command ls /etc/minicom/minirc.* 2>/dev/null | sed -e 's|/etc/minicom/minirc.||' | grep "^$cur" ) )
- fi
-} &&
-complete -F _minicom minicom
-
-have rrdtool &&
-_rrdtool ()
-{
- cur=`_get_cword`
- COMPREPLY=( $( compgen -W 'create update updatev graph dump \
- restore last lastupdate first info \
- fetch tune resize xport' -- $cur ) )
-} &&
-complete -F _rrdtool rrdtool
-
-_filedir_xspec()
-{
- local IFS cur xspec
-
- IFS=$'\t\n'
- COMPREPLY=()
- cur=`_get_cword`
-
- _expand || return 0
-
- # get first exclusion compspec that matches this command
- xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
- $BASH_COMPLETION )
- # prune to leave nothing but the -X spec
- xspec=${xspec#*-X }
- xspec=${xspec%% *}
-
- local -a toks
- local tmp
-
- toks=( ${toks[@]-} $(
- compgen -d -- "$(quote_readline "$cur")" | {
- while read -r tmp; do
- # see long TODO comment in _filedir() --David
- echo $tmp
- done
- }
- ))
-
- toks=( ${toks[@]-} $(
- eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
- while read -r tmp; do
- [ -n $tmp ] && echo $tmp
- done
- }
- ))
-
- COMPREPLY=( "${toks[@]}" )
-}
-list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
- $BASH_COMPLETION | \
- # read exclusion compspecs
- (
- while read line
- do
- # ignore compspecs that are commented out
- if [ "${line#\#}" != "$line" ]; then continue; fi
- line=${line%# START exclude*}
- line=${line%# FINISH exclude*}
- line=${line##*\'}
- list=( "${list[@]}" $line )
- done
- echo "${list[@]}"
- )
- ) )
+ _expand || return 0
+
+ # get first exclusion compspec that matches this command
+ xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
+ $BASH_COMPLETION )
+ # prune to leave nothing but the -X spec
+ xspec=${xspec#*-X }
+ xspec=${xspec%% *}
+
+ local -a toks
+ local tmp
+
+ toks=( ${toks[@]-} $(
+ compgen -d -- "$(quote_readline "$cur")" | {
+ while read -r tmp; do
+ # see long TODO comment in _filedir() --David
+ echo $tmp
+ done
+ }
+ ))
+
+ toks=( ${toks[@]-} $(
+ eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
+ while read -r tmp; do
+ [ -n $tmp ] && echo $tmp
+ done
+ }
+ ))
+
+ COMPREPLY=( "${toks[@]}" )
+}
+list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
+ # read exclusion compspecs
+ (
+ while read line
+ do
+ # ignore compspecs that are commented out
+ if [ "${line#\#}" != "$line" ]; then continue; fi
+ line=${line%# START exclude*}
+ line=${line%# FINISH exclude*}
+ line=${line##*\'}
+ list=( "${list[@]}" $line )
+ done
+ echo "${list[@]}"
+ )
+ ) )
# remove previous compspecs
if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]}
@@ -9320,21 +1631,37 @@ fi
unset list
# source completion directory definitions
+if [ -d $BASH_COMPLETION_COMPAT_DIR -a -r $BASH_COMPLETION_COMPAT_DIR -a \
+ -x $BASH_COMPLETION_COMPAT_DIR ]; then
+ for i in $BASH_COMPLETION_COMPAT_DIR/*; do
+ [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] &&
+ [ \( -f $i -o -h $i \) -a -r $i ] && . $i
+ done
+fi
if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
- -x $BASH_COMPLETION_DIR ]; then
- for i in $BASH_COMPLETION_DIR/*; do
- [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] &&
- [ \( -f $i -o -h $i \) -a -r $i ] && . $i
- done
+ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR -a \
+ -x $BASH_COMPLETION_DIR ]; then
+ for i in $BASH_COMPLETION_DIR/*; do
+ [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] &&
+ [ \( -f $i -o -h $i \) -a -r $i ] && . $i
+ done
fi
unset i
# source user completion file
[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
- && . ~/.bash_completion
+ && . ~/.bash_completion
unset -f have
-unset UNAME RELEASE default dirnames filenames have nospace bashdefault \
- plusdirs
+unset UNAME USERLAND default dirnames filenames have nospace bashdefault \
+ plusdirs compopt
set $BASH_COMPLETION_ORIGINAL_V_VALUE
unset BASH_COMPLETION_ORIGINAL_V_VALUE
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/bash_completion.sh b/bash_completion.sh
deleted file mode 100644
index 915960b6..00000000
--- a/bash_completion.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# Check for interactive bash and that we haven't already been sourced.
-[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
-
-# Check for recent enough version of bash.
-bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
-if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
- if [ -r /etc/bash_completion ]; then
- # Source completion code.
- . /etc/bash_completion
- fi
-fi
-unset bash bminor bmajor
diff --git a/configure b/configure
index 60b1ed16..0ec532f3 100755
--- a/configure
+++ b/configure
@@ -1,18 +1,20 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for bash-completion 1.0.
+# Generated by GNU Autoconf 2.64 for bash-completion 1.1.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
+#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -20,23 +22,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
as_nl='
'
export as_nl
@@ -44,7 +38,13 @@ export as_nl
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
@@ -55,7 +55,7 @@ else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
- case $arg in
+ case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -78,13 +78,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
}
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
@@ -94,15 +87,15 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -114,12 +107,16 @@ if test "x$as_myself" = x; then
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
@@ -131,330 +128,298 @@ export LC_ALL
LANGUAGE=C
export LANGUAGE
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
# CDPATH.
-$as_unset CDPATH
-
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
else
- as_have_required=no
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
else
- exitcode=1
- echo positional parameters were not saved.
+ as_have_required=no
fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- case $as_dir in
+ as_found=:
+ case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
done;;
esac
+ as_found=false
done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
IFS=$as_save_IFS
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
fi
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
fi
-
-
fi
-
fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
-exitcode=0
-if as_func_success; then
- :
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
else
- exitcode=1
- echo as_func_success failed.
-fi
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-if as_func_ret_success; then
- :
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
else
- exitcode=1
- echo as_func_ret_success failed.
+ as_expr=false
fi
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
fi
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
else
- exitcode=1
- echo positional parameters were not saved.
+ as_dirname=false
fi
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell bug-autoconf@gnu.org about your system,
- echo including any error possibly output before this message.
- echo This can help us improve future autoconf versions.
- echo Configuration will now proceed without shell functions.
-}
-
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
@@ -471,8 +436,7 @@ test \$exitcode = 0") || {
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
@@ -482,29 +446,18 @@ test \$exitcode = 0") || {
exit
}
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
@@ -534,7 +487,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
@@ -553,10 +506,10 @@ else
if test -d "$1"; then
test -d "$1/.";
else
- case $1 in
+ case $1 in #(
-*)set "./$1";;
esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
@@ -570,7 +523,6 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
exec 7<&0 </dev/null 6>&1
# Name of the host.
@@ -589,14 +541,14 @@ cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='bash-completion'
PACKAGE_TARNAME='bash-completion'
-PACKAGE_VERSION='1.0'
-PACKAGE_STRING='bash-completion 1.0'
+PACKAGE_VERSION='1.1'
+PACKAGE_STRING='bash-completion 1.1'
PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
@@ -653,6 +605,7 @@ bindir
program_transform_name
prefix
exec_prefix
+PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
@@ -775,8 +728,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -802,8 +754,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1007,8 +958,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1024,8 +974,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1055,17 +1004,17 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
+ -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
@@ -1082,15 +1031,13 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { $as_echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
- fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
- { (exit 1); exit 1; }; } ;;
+ fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
@@ -1113,8 +1060,7 @@ do
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1144,11 +1090,9 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { $as_echo "$as_me: error: working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "pwd does not report name of working directory"
# Find the source files, if location was not specified.
@@ -1187,13 +1131,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1219,7 +1161,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bash-completion 1.0 to adapt to many kinds of systems.
+\`configure' configures bash-completion 1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1285,10 +1227,11 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bash-completion 1.0:";;
+ short | recursive ) echo "Configuration of bash-completion 1.1:";;
esac
cat <<\_ACEOF
+Report bugs to the package provider.
_ACEOF
ac_status=$?
fi
@@ -1351,22 +1294,25 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bash-completion configure 1.0
-generated by GNU Autoconf 2.63
+bash-completion configure 1.1
+generated by GNU Autoconf 2.64
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bash-completion $as_me 1.0, which was
-generated by GNU Autoconf 2.63. Invocation command line was
+It was created by bash-completion $as_me 1.1, which was
+generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@@ -1402,8 +1348,8 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
-done
+ $as_echo "PATH: $as_dir"
+ done
IFS=$as_save_IFS
} >&5
@@ -1440,9 +1386,9 @@ do
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1458,13 +1404,13 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
@@ -1489,13 +1435,13 @@ _ASBOX
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -1567,39 +1513,41 @@ _ASBOX
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
+$as_echo "/* confdefs.h */" > confdefs.h
+
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
@@ -1618,7 +1566,7 @@ for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test -r "$ac_site_file"; then
- { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
@@ -1629,7 +1577,7 @@ if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
- { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
@@ -1637,7 +1585,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;}
esac
fi
else
- { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
@@ -1652,11 +1600,11 @@ for ac_var in $ac_precious_vars; do
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
@@ -1666,17 +1614,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
- { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
- { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
@@ -1688,43 +1636,20 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1733,28 +1658,20 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-am__api_version='1.10'
+am__api_version='1.11'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
- if test -f "$ac_dir/install-sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f "$ac_dir/install.sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f "$ac_dir/shtool"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
+ for ac_t in install-sh install.sh shtool; do
+ if test -f "$ac_dir/$ac_t"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/$ac_t -c"
+ break 2
+ fi
+ done
done
if test -z "$ac_aux_dir"; then
- { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -1780,10 +1697,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
+if test "${ac_cv_path_install+set}" = set; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -1791,11 +1708,11 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
@@ -1832,7 +1749,7 @@ case $as_dir/ in
;;
esac
-done
+ done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
@@ -1848,7 +1765,7 @@ fi
INSTALL=$ac_install_sh
fi
fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -1859,21 +1776,34 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
$as_echo_n "checking whether build environment is sane... " >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftest.file`
+ set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$*" != "X $srcdir/configure conftest.file" \
@@ -1883,11 +1813,8 @@ if (
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
- { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" >&5
-$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
fi
test "$2" = conftest.file
@@ -1896,13 +1823,10 @@ then
# Ok.
:
else
- { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-$as_echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
@@ -1917,20 +1841,136 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
- { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
fi
-{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then
+ if test "${ac_cv_path_mkdir+set}" = set; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -1938,7 +1978,7 @@ for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in mkdir gmkdir; do
+ for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
{ test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
@@ -1950,7 +1990,7 @@ do
esac
done
done
-done
+ done
IFS=$as_save_IFS
fi
@@ -1966,7 +2006,7 @@ fi
MKDIR_P="$ac_install_sh -d"
fi
fi
-{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
mkdir_p="$MKDIR_P"
@@ -1979,9 +2019,9 @@ for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
+if test "${ac_cv_prog_AWK+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -1992,24 +2032,24 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AWK="$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
- { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
@@ -2017,11 +2057,11 @@ fi
test -n "$AWK" && break
done
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
@@ -2039,11 +2079,11 @@ esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
SET_MAKE=
else
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -2063,9 +2103,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
- { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
@@ -2081,7 +2119,7 @@ fi
# Define the identity of the package.
PACKAGE='bash-completion'
- VERSION='1.0'
+ VERSION='1.1'
cat >>confdefs.h <<_ACEOF
@@ -2109,108 +2147,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
- ac_ct_STRIP=$STRIP
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_STRIP="strip"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
-else
- STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility.
@@ -2252,13 +2188,13 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -2266,8 +2202,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -2290,11 +2226,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
test "x$cache_file" != "x/dev/null" &&
- { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
- { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
@@ -2350,8 +2286,8 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -2359,13 +2295,15 @@ LTLIBOBJS=$ac_ltlibobjs
+
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -2375,17 +2313,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -2393,23 +2332,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
as_nl='
'
export as_nl
@@ -2417,7 +2348,13 @@ export as_nl
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
@@ -2428,7 +2365,7 @@ else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
- case $arg in
+ case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -2451,13 +2388,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
}
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
@@ -2467,15 +2397,15 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -2487,12 +2417,16 @@ if test "x$as_myself" = x; then
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
@@ -2504,7 +2438,89 @@ export LC_ALL
LANGUAGE=C
export LANGUAGE
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
@@ -2518,8 +2534,12 @@ else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
@@ -2539,76 +2559,25 @@ $as_echo X/"$0" |
}
s/.*/./; q'`
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
@@ -2637,8 +2606,56 @@ fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
@@ -2657,10 +2674,10 @@ else
if test -d "$1"; then
test -d "$1/.";
else
- case $1 in
+ case $1 in #(
-*)set "./$1";;
esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
@@ -2675,13 +2692,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bash-completion $as_me 1.0, which was
-generated by GNU Autoconf 2.63. Invocation command line was
+This file was extended by bash-completion $as_me 1.1, which was
+generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -2708,10 +2731,11 @@ _ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
@@ -2725,16 +2749,16 @@ Usage: $0 [OPTION]... [FILE]...
Configuration files:
$config_files
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to the package provider."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-bash-completion config.status 1.0
-configured by $0, generated by GNU Autoconf 2.63,
+bash-completion config.status 1.1
+configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -2777,7 +2801,7 @@ do
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
- CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
@@ -2786,11 +2810,10 @@ do
ac_cs_silent=: ;;
# This is an error.
- -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1"
+ *) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
@@ -2838,9 +2861,7 @@ do
case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
+ *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -2865,7 +2886,7 @@ $debug ||
trap 'exit_status=$?
{ test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
@@ -2876,11 +2897,7 @@ $debug ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} ||
-{
- $as_echo "$as_me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -2888,10 +2905,16 @@ $debug ||
if test -n "$CONFIG_FILES"; then
-ac_cr=' '
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
+ ac_cs_awk_cr='\r'
else
ac_cs_awk_cr=$ac_cr
fi
@@ -2905,24 +2928,18 @@ _ACEOF
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -3011,9 +3028,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
else
cat
fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
- { (exit 1); exit 1; }; }
+ || as_fn_error "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
@@ -3044,9 +3059,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
- { (exit 1); exit 1; }; };;
+ :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -3074,12 +3087,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
+ as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- ac_file_inputs="$ac_file_inputs '$ac_f'"
+ as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -3090,7 +3101,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
@@ -3103,9 +3114,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; } ;;
+ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -3133,47 +3142,7 @@ $as_echo X"$ac_file" |
q
}
s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
@@ -3230,7 +3199,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
-
ac_sed_dataroot='
/datarootdir/ {
p
@@ -3240,12 +3208,11 @@ ac_sed_dataroot='
/@docdir@/p
/@infodir@/p
/@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -3255,7 +3222,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
+ s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
@@ -3284,14 +3251,12 @@ s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&2;}
@@ -3301,9 +3266,7 @@ which seems to be undefined. Please make sure it is defined." >&2;}
-) cat "$tmp/out" && rm -f "$tmp/out";;
*) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
esac \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
;;
@@ -3313,15 +3276,12 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
done # for ac_tag
-{ (exit 0); exit 0; }
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
- { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
@@ -3342,10 +3302,10 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
+ $ac_cs_success || as_fn_exit $?
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
diff --git a/configure.ac b/configure.ac
index 3c7bf00a..c8d66cd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.59])
-AC_INIT([bash-completion], [1.0])
+AC_INIT([bash-completion], [1.1])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/contrib/_subversion b/contrib/_subversion
index 5489f8a3..0168ecd4 100644
--- a/contrib/_subversion
+++ b/contrib/_subversion
@@ -1,8 +1,5 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# svn completion
-#
+
have svn &&
{
_svn()
@@ -424,3 +421,11 @@ _svnlook()
}
complete -F _svnlook $default svnlook
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/_yum b/contrib/_yum
new file mode 100644
index 00000000..b2283078
--- /dev/null
+++ b/contrib/_yum
@@ -0,0 +1,180 @@
+# yum(8) completion
+
+have yum && {
+_yum_list()
+{
+ if [[ "$1" == all ]] ; then
+ # Try to strip in between headings like "Available Packages"
+ # This will obviously only work for English :P
+ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+ sed -ne '/^\(Available\|Installed\|Updated\) /d' \
+ -e 's/[[:space:]].*//p' ) )
+ else
+ # Drop first line (e.g. "Updated Packages")
+ COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+ sed -ne 1d -e 's/[[:space:]].*//p' ) )
+ fi
+}
+
+_yum_repolist()
+{
+ # -d 0 causes repolist to output nothing as of yum 3.2.22:
+ # http://yum.baseurl.org/ticket/83
+ # Drop first ("repo id repo name") and last ("repolist: ...") rows
+ yum --noplugins -C repolist $1 2>/dev/null | \
+ sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p'
+}
+
+_yum_plugins()
+{
+ command ls /usr/lib/yum-plugins/*.py{,c,o} 2>/dev/null \
+ | sed -ne 's|.*/\([^./]*\)\.py[co]\?$|\1|p' | sort -u
+}
+
+_yum()
+{
+ local cur prev special split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
+
+ if [ -n "$special" ]; then
+ # TODO: install|update|upgrade should not match *src.rpm
+ if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+ _filedir rpm
+ return 0
+ fi
+ case $special in
+ install)
+ _yum_list available
+ return 0
+ ;;
+ deplist|info)
+ _yum_list all
+ return 0
+ ;;
+ upgrade|update)
+ _yum_list updates
+ return 0
+ ;;
+ remove|erase)
+ # _rpm_installed_packages is not arch-qualified
+ _yum_list installed
+ return 0
+ ;;
+ esac
+ fi
+
+ _split_longopt && split=true
+
+ case $prev in
+ list)
+ COMPREPLY=( $( compgen -W 'all available updates \
+ installed extras obsoletes recent' -- $cur ) )
+ ;;
+ clean)
+ COMPREPLY=( $( compgen -W 'packages headers metadata \
+ cache dbcache all' -- $cur ) )
+ ;;
+ repolist)
+ COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
+ ;;
+ localinstall|localupdate)
+ # TODO: should not match *src.rpm
+ _filedir rpm
+ ;;
+ -d|-e)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
+ ;;
+ -c)
+ _filedir
+ ;;
+ --installroot)
+ _filedir -d
+ ;;
+ --enablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
+ ;;
+ --disablerepo)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
+ ;;
+ --disableexcludes)
+ COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \
+ all main' -- $cur ) )
+ ;;
+ --enableplugin|--disableplugin)
+ COMPREPLY=( $( compgen -W '$( _yum_plugins )' -- $cur ))
+ ;;
+ --color)
+ COMPREPLY=( $( compgen -W 'always auto never' -- $cur ))
+ ;;
+ -R|-x|--exclude)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|--version)
+ # no other options useful with these
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W 'install update \
+ check-update upgrade remove erase list info \
+ provides whatprovides clean makecache \
+ groupinstall groupupdate grouplist \
+ groupremove groupinfo search shell resolvedep \
+ localinstall localupdate deplist repolist \
+ help' -- $cur ) )
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -t --tolerant -C -c -R \
+ -d --showduplicates -e -q --quiet -v --verbose -y \
+ --version --installroot --enablerepo --disablerepo -x \
+ --exclude --disableexcludes --obsoletes --noplugins \
+ --nogpgcheck --disableplugin --enableplugin \
+ --skip-broken --color' -- $cur ) )
+ return 0
+ fi
+}
+} &&
+complete -F _yum $filenames yum
+
+# yum-arch(8) completion
+#
+have yum-arch &&
+_yum_arch()
+{
+ local cur
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
+ ;;
+ *)
+ _filedir -d
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _yum_arch $filenames yum-arch
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ant b/contrib/ant
new file mode 100644
index 00000000..58423f71
--- /dev/null
+++ b/contrib/ant
@@ -0,0 +1,74 @@
+# bash completion for ant
+
+have ant && {
+_ant()
+{
+ local cur prev buildfile i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -buildfile|-file|-f)
+ _filedir 'xml'
+ return 0
+ ;;
+ -logfile|-l)
+ _filedir
+ return 0
+ ;;
+ -propertyfile)
+ _filedir properties
+ return 0
+ ;;
+ -nice)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -lib|-logger|-listener|-D|-inputhandler|-main)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -h -projecthelp -p -version \
+ -diagnostics -quiet -q -verbose -v -debug -d -emacs -e \
+ -lib -logfile -l -logger -listener -noinput -buildfile \
+ -file -f -D -keep-going -k -propertyfile -inputhandler \
+ -find -s -nice -nouserlib -noclasspath -autoproxy \
+ -main' -- "$cur" ) )
+ else
+ # available targets completion
+ # find which buildfile to use
+ buildfile=build.xml
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
+ buildfile=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ [ ! -f $buildfile ] && return 0
+
+ # parse buildfile for targets
+ # some versions of sed complain if there's no trailing linefeed,
+ # hence the 2>/dev/null
+ COMPREPLY=( $( compgen -W "$( cat $buildfile | \
+ tr "'\t\n>" "\" \n" | \
+ sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' \
+ 2>/dev/null )" -- "$cur" ) )
+ fi
+}
+have complete-ant-cmd.pl && \
+ complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
+ complete -F _ant $filenames ant
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/apache2ctl b/contrib/apache2ctl
index 8794b4a9..1987d245 100644
--- a/contrib/apache2ctl
+++ b/contrib/apache2ctl
@@ -1,18 +1,24 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# apache2ctl(1) completion
-#
+
have apache2ctl && {
_apache2ctl() {
- local APWORDS
-
- COMPREPLY=()
- cur=`_get_cword`
-
- APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | tr "|" " ")
-
- COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
+ local APWORDS
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | \
+ tr "|" " ")
+
+ COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
}
complete -F _apache2ctl apache2ctl
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/apt b/contrib/apt
new file mode 100644
index 00000000..36c66c99
--- /dev/null
+++ b/contrib/apt
@@ -0,0 +1,155 @@
+# Debian apt-get(8) completion.
+
+have apt-get &&
+_apt_get()
+{
+ local cur prev special i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
+
+ if [ -n "$special" ]; then
+ case $special in
+ remove|autoremove|purge)
+ if [ -f /etc/debian_version ]; then
+ # Debian system
+ COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
+ else
+ # assume RPM based
+ _rpm_installed_packages
+ fi
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
+ 2> /dev/null ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ case "$prev" in
+ -@(c|-config-file))
+ _filedir
+ return 0
+ ;;
+ -@(t|-target-release|-default-release))
+ COMPREPLY=( $( apt-cache policy | \
+ grep "release.o=Debian,a=$cur" | \
+ sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \
+ --download-only --fix-broken --help --version --ignore-missing \
+ --fix-missing --no-download --quiet --simulate --just-print \
+ --dry-run --recon --no-act --yes --assume-yes --show-upgraded \
+ --only-source --compile --build --ignore-hold --target-release \
+ --no-upgrade --force-yes --print-uris --purge --reinstall \
+ --list-cleanup --default-release --trivial-only --no-remove \
+ --diff-only --no-install-recommends --tar-only --config-file \
+ --option --auto-remove' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
+ dist-upgrade install remove purge source build-dep \
+ check clean autoclean autoremove' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _apt_get $filenames apt-get
+
+# Debian apt-cache(8) completion.
+#
+have apt-cache &&
+_apt_cache()
+{
+ local cur prev special i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+
+ if [ "$cur" != show ]; then
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
+ fi
+
+
+ if [ -n "$special" ]; then
+ case $special in
+ add)
+ _filedir
+ return 0
+ ;;
+
+ showsrc)
+ COMPREPLY=( $( apt-cache dumpavail | \
+ grep "^Source: $cur" | sort | \
+ uniq | cut -f2 -d" " ) )
+ return 0
+ ;;
+
+ *)
+ COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) )
+ return 0
+ ;;
+
+ esac
+ fi
+
+
+ case "$prev" in
+ -@(c|p|s|-config-file|-@(pkg|src)-cache))
+ _filedir
+ return 0
+ ;;
+ search)
+ if [[ "$cur" != -* ]]; then
+ return 0
+ fi
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+
+ COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
+ -o --help --version --pkg-cache --src-cache \
+ --quiet --important --full --all-versions \
+ --no-all-versions --generate --no-generate \
+ --names-only --all-names --recurse \
+ --config-file --option --installed' -- "$cur" ) )
+ else
+
+ COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
+ stats dump dumpavail unmet search search \
+ depends rdepends pkgnames dotty xvcg \
+ policy madison' -- "$cur" ) )
+
+ fi
+
+
+ return 0
+} &&
+complete -F _apt_cache $filenames apt-cache
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/apt-build b/contrib/apt-build
new file mode 100644
index 00000000..6031d61f
--- /dev/null
+++ b/contrib/apt-build
@@ -0,0 +1,67 @@
+# Debian apt-build(1) completion.
+
+have apt-build &&
+_apt_build()
+{
+ local cur prev special i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
+ special=${COMP_WORDS[i]}
+ fi
+ done
+
+ if [ -n "$special" ]; then
+ case $special in
+ @(install|source|info))
+ COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) )
+ return 0
+ ;;
+ remove)
+ COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ return 0
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+ fi
+
+ case "$prev" in
+ --@(patch|build-dir|repository-dir))
+ _filedir
+ return 0
+ ;;
+ -@(h|-help))
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
+ --repository-dir --build-only --build-command --reinstall \
+ --rebuild --remove-builddep --no-wrapper --purge --patch \
+ --patch-strip -p --yes -y --version -v --no-source' -- "$cur" ) )
+
+ else
+ COMPREPLY=( $( compgen -W 'update upgrade install remove source \
+ dist-upgrade world clean info clean-build update-repository' \
+ -- "$cur" ) )
+ fi
+
+
+ return 0
+} &&
+complete -F _apt_build $filenames apt-build
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/aptitude b/contrib/aptitude
new file mode 100644
index 00000000..b83440ed
--- /dev/null
+++ b/contrib/aptitude
@@ -0,0 +1,96 @@
+# Debian aptitude(1) completion
+
+have aptitude && {
+have grep-status && {
+_comp_dpkg_hold_packages()
+{
+ grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
+}
+} || {
+_comp_dpkg_hold_packages()
+{
+ grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" | cut -d\ -f2
+}
+}
+
+_aptitude()
+{
+ local cur dashoptions prev special i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+
+ dashoptions='-S -u -i -h --help --version -s --simulate -d \
+ --download-only -P --prompt -y --assume-yes -F \
+ --display-format -O --sort -w --width -f -r -g \
+ --with-recommends -R -G --without-recommends -t \
+ --target-release -V --show-versions -D --show-deps\
+ -Z -v --verbose --purge-unused --schedule-only'
+
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ 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
+ special=${COMP_WORDS[i]}
+ fi
+ #exclude some mutually exclusive options
+ [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
+ [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
+ done
+
+ if [[ -n "$special" ]]; then
+ case $special in
+ @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
+ COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
+ return 0
+ ;;
+ @(purge|remove|reinstall|forbid-version))
+ COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ return 0
+ ;;
+ unhold)
+ COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ case $prev in
+ # don't complete anything if these options are found
+ @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
+ return 0
+ ;;
+ -S)
+ _filedir
+ return 0
+ ;;
+ -@(t|-target-release|-default-release))
+ COMPREPLY=( $( apt-cache policy | \
+ grep "release.o=Debian,a=$cur" | \
+ sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$dashoptions" -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new \
+ clean autoclean install reinstall remove \
+ hold unhold purge markauto unmarkauto why why-not \
+ dist-upgrade full-upgrade download search show \
+ forbid-version changelog keep-all build-dep' -- "$cur" ) )
+ fi
+
+ return 0
+}
+complete -F _aptitude $default aptitude
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/aspell b/contrib/aspell
new file mode 100644
index 00000000..7a5b04ee
--- /dev/null
+++ b/contrib/aspell
@@ -0,0 +1,98 @@
+# bash completion for aspell
+
+have aspell && {
+_aspell_dictionary()
+{
+ local datadir
+ datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
+ # First, get aliases (dicts dump does not list them)
+ COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
+ COMPREPLY=( ${COMPREPLY[@]%.alias} )
+ COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
+ # Then, add the canonical dicts
+ COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+}
+
+_aspell()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -c|-p|check|--@(conf|personal|repl|per-conf))
+ _filedir
+ return 0
+ ;;
+ --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
+ _filedir -d
+ return 0
+ ;;
+ dump|create|merge)
+ COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) )
+ return 0
+ ;;
+ --mode)
+ COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) )
+ return 0
+ ;;
+ --sug-mode)
+ COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- "$cur" ) )
+ return 0
+ ;;
+ --keymapping)
+ COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) )
+ return 0
+ ;;
+ -d|--master)
+ _aspell_dictionary
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
+ --encoding --add-filter --rem-filter --mode -e \
+ -H -t --add-extra-dicts --rem-extra-dicts \
+ --home-dir -W --ignore --ignore-accents \
+ --dont-ignore-accents --ignore-case --dont-ignore-case \
+ --ignore-repl --dont-ignore-repl --jargon --keyboard \
+ --lang --language-tag --local-data-dir -d --master \
+ --module --add-module-search-order \
+ --rem-module-search-order --per-conf -p --personal \
+ --prefix --repl -C -B --run-together --dont-run-together \
+ --run-together-limit --run-together-min --save-repl \
+ --dont-save-repl --set-prefix --dont-set-prefix --size \
+ --spelling --strip-accents --dont-strip-accents \
+ --sug-mode --add-word-list-path --rem-word-list-path \
+ -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
+ --time --dont-time --keymapping --add-email-quote \
+ --rem-email-quote --email-margin --add-tex-command \
+ --rem-tex-command --tex-check-comments \
+ --dont-tex-check-comments --add-tex-extension \
+ --rem-tex-extension --add-sgml-check --rem-sgml-check \
+ --add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
+ config config soundslike filter -v version dump \
+ create merge' -- "$cur" ) )
+ fi
+
+}
+complete -F _aspell $filenames aspell
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/autorpm b/contrib/autorpm
new file mode 100644
index 00000000..e111af02
--- /dev/null
+++ b/contrib/autorpm
@@ -0,0 +1,23 @@
+# autorpm(8) completion
+
+have autorpm &&
+_autorpm()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \
+ fullinfo info help install list remove set' -- "$cur" ) )
+
+} &&
+complete -F _autorpm autorpm
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bash-builtins b/contrib/bash-builtins
new file mode 100644
index 00000000..c0af45d4
--- /dev/null
+++ b/contrib/bash-builtins
@@ -0,0 +1,133 @@
+# bash alias completion
+#
+_alias()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ case "$COMP_LINE" in
+ *[^=])
+ COMPREPLY=( $( compgen -A alias -- "$cur" ) )
+ ;;
+ *=)
+ COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \
+ -e 's|^alias '"$cur"'\(.*\)$|\1|' )" )
+ ;;
+ esac
+}
+complete -F _alias $nospace alias
+
+# bash export completion
+#
+_export()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ case "$COMP_LINE" in
+ *=\$*)
+ COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
+ ;;
+ *[^=])
+ COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
+ ;;
+ *=)
+ COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
+ ( echo -n \'
+ sed -e 's/'\''/'\''\\\'\'''\''/g'
+ echo -n \' ) )" )
+ ;;
+ esac
+}
+complete -F _export $default $nospace export
+
+# bash shell function completion
+#
+_function()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ $1 == @(declare|typeset) ]]; then
+ if [ "$prev" = -f ]; then
+ COMPREPLY=( $( compgen -A function -- "$cur" ) )
+ elif [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
+ fi
+ elif [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -A function -- "$cur" ) )
+ else
+ COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
+ fi
+}
+complete -F _function function declare typeset
+
+# bash complete completion
+#
+_complete()
+{
+ local cur prev options
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -o)
+ options="default dirnames filenames"
+ [ -n "$bash205b" ] && options="$options nospace"
+ [ -n "$bash3" ] && options="$options bashdefault plusdirs"
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ return 0
+ ;;
+
+ -A)
+ COMPREPLY=( $( compgen -W 'alias arrayvar binding \
+ builtin command directory disabled enabled \
+ export file function group helptopic hostname \
+ job keyword running service setopt shopt \
+ signal stopped user variable' -- "$cur" ) )
+ return 0
+ ;;
+
+ -C)
+ COMPREPLY=( $( compgen -A command -- "$cur" ) )
+ return 0
+ ;;
+ -F)
+ COMPREPLY=( $( compgen -A function -- "$cur" ) )
+ return 0
+ ;;
+ -@(p|r))
+ COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # relevant options completion
+ options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
+ [ -n "$bash205" ] && options="$options -o"
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -A command -- "$cur" ) )
+ fi
+}
+complete -F _complete complete
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bind-utils b/contrib/bind-utils
new file mode 100644
index 00000000..6c005392
--- /dev/null
+++ b/contrib/bind-utils
@@ -0,0 +1,23 @@
+# bash completion for nslookup
+
+have nslookup &&
+_nslookup()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]#-}
+
+ COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \
+ defname search port= querytype= type= recurse retry root timeout vc \
+ ignoretc' -- "$cur" ) )
+} &&
+complete -F _nslookup nslookup
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bitkeeper b/contrib/bitkeeper
index 8e1cc3cd..737837e1 100644
--- a/contrib/bitkeeper
+++ b/contrib/bitkeeper
@@ -1,20 +1,25 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# BitKeeper completion adapted from code by Bart Trojanowski <bart@jukie.net>
+have bk &&
_bk() {
local BKCMDS
COMPREPLY=()
cur=`_get_cword`
- BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | \
- xargs echo )"
+ BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )"
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
_filedir
return 0
-}
+} &&
complete -F _bk bk
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bittorrent b/contrib/bittorrent
index a240d47c..cc1e95ea 100644
--- a/contrib/bittorrent
+++ b/contrib/bittorrent
@@ -1,38 +1,42 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# btdownloadheadless(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+have btdownloadheadless.py || have btdownloadcurses.py || \
+have btdownloadgui.py &&
_btdownload()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- --@(responsefile|saveas))
- _filedir
- return 0
- ;;
- esac
+ case "$prev" in
+ --@(responsefile|saveas))
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval \
- --download_slice_size --request_backlog \
- --max_message_length --ip --minport --maxport \
- --responsefile --url --saveas --timeout \
- --timeout_check_interval --max_slice_length \
- --max_rate_period --bind --upload_rate_fudge \
- --display_interval --rerequest_interval \
- --min_peers --http_timeout --max_initiate \
- --max_allow_in --check_hashes \
- --max_upload_rate --snub_time --spew \
- --rarest_first_cutoff --min_uploads \
- --report_hash_failures' -- $cur ) )
- else
- _filedir
- fi
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval \
+ --download_slice_size --request_backlog --max_message_length \
+ --ip --minport --maxport --responsefile --url --saveas --timeout \
+ --timeout_check_interval --max_slice_length --max_rate_period \
+ --bind --upload_rate_fudge --display_interval --rerequest_interval \
+ --min_peers --http_timeout --max_initiate --max_allow_in \
+ --check_hashes --max_upload_rate --snub_time --spew \
+ --rarest_first_cutoff --min_uploads --report_hash_failures' \
+ -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
complete -F _btdownload btdownloadheadless.py btdownloadcurses.py btdownloadgui.py
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bluez-utils b/contrib/bluez-utils
new file mode 100644
index 00000000..f4d56ea5
--- /dev/null
+++ b/contrib/bluez-utils
@@ -0,0 +1,452 @@
+# bash completion for bluez-utils
+
+have hcitool && {
+_bluetooth_adresses()
+{
+ if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
+ awk '/^\t/{print $1}' )" -- "$cur" ) )
+ fi
+}
+
+_bluetooth_devices()
+{
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
+ awk '/^\t/{print $1}' )" -- "$cur" ) )
+}
+
+_bluetooth_services()
+{
+ COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG \
+ SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE \
+ UDITE SYNCML' -- "$cur" ) )
+}
+
+_bluetooth_packet_types()
+{
+ COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \
+ -- "$cur" ) )
+}
+
+_get_command()
+{
+ local i
+
+ command=
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ command=${COMP_WORDS[i]}
+ break
+ fi
+ done
+}
+
+_hcitool()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -i)
+ _bluetooth_devices
+ return 0;
+ ;;
+ --role)
+ COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) )
+ return 0;
+ ;;
+ --pkt-type)
+ _bluetooth_packet_types
+ return 0;
+ ;;
+ esac
+
+ $split && return 0
+
+ _get_command
+ if [ -z $command ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -i' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'dev inq scan name info \
+ spinq epinq cmd con cc dc sr cpt rssi lq tpl \
+ afh lst auth enc key clkoff clock' -- "$cur" ) )
+ fi
+ else
+ case $command in
+ @(name|info|dc|rssi|lq|afh|auth|key|clkoff|lst))
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ fi
+ ;;
+ cc)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--role --pkt-type' -- "$cur" ) )
+ else
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ fi
+ fi
+ ;;
+ sr)
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ else
+ COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) )
+ fi
+ ;;
+ cpt)
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ else
+ _bluetooth_packet_types
+ fi
+ ;;
+ @(tpl|enc|clock))
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ else
+ COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _hcitool hcitool
+
+_sdptool()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ --bdaddr)
+ _bluetooth_adresses
+ return 0;
+ ;;
+ esac
+
+ $split && return 0
+
+ _get_command
+ if [ -z $command ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'search browse records add \
+ del get setattr setseq' -- "$cur" ) )
+ fi
+ else
+ case $command in
+ search)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--bdaddr \
+ --tree --raw --xml' -- "$cur" ) )
+ else
+ _bluetooth_services
+ fi
+ ;;
+ @(browse|records))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) )
+ else
+ _bluetooth_adresses
+ fi
+ ;;
+ add)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--handle --channel' -- "$cur" ) )
+ else
+ _bluetooth_services
+ fi
+ ;;
+ get)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--bdaddr \
+ --tree --raw --xml' -- "$cur" ) )
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _sdptool sdptool
+
+_l2ping()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -i)
+ _bluetooth_devices
+ return 0;
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- "$cur" ) )
+ else
+ _bluetooth_adresses
+ fi
+
+}
+complete -F _l2ping l2ping
+
+_rfcomm()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(f|-config))
+ _filedir
+ return 0;
+ ;;
+ -i)
+ _bluetooth_devices
+ _bluetooth_adresses
+ return 0;
+ ;;
+ esac
+
+ _get_command
+ if [ -z $command ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -a -r --raw -f \
+ --config -i -A --auth -E --encrypt -S --secure \
+ -M --master' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'show connect listen watch \
+ bind release' -- "$cur" ) )
+ fi
+ else
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_devices
+ else
+ case $command in
+ @(connect|bind))
+ if [ $args -eq 3 ]; then
+ _bluetooth_adresses
+ fi
+ ;;
+ esac
+ fi
+ fi
+}
+complete -F _rfcomm rfcomm
+
+_ciptool()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -i)
+ _bluetooth_devices
+ _bluetooth_adresses
+ return 0;
+ ;;
+ esac
+
+ _get_command
+ if [ -z $command ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -i' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'show search connect release \
+ loopback' -- "$cur" ) )
+ fi
+ else
+ case $command in
+ @(connect|release|loopback))
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _ciptool ciptool
+
+_dfutool()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(d|-device))
+ _bluetooth_devices
+ return 0;
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -d --device' -- "$cur" ) )
+ else
+ _count_args
+ case $args in
+ 1)
+ COMPREPLY=( $( compgen -W 'verify modify \
+ upgrade archive' -- "$cur" ) )
+ ;;
+ 2)
+ _filedir
+ ;;
+ esac
+ fi
+}
+complete -F _dfutool dfutool
+
+_hciconfig()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _get_command
+ if [ -z $command ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -a --all' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'up down reset rstat auth \
+ noauth encrypt noencrypt secmgr nosecmgr \
+ piscan noscan iscan pscan ptype name class \
+ voice iac inqmode inqdata inqtype inqparams \
+ pageparms pageto afhmode aclmtu scomtu putkey \
+ delkey commands features version revision lm' \
+ -- "$cur" ) )
+ fi
+ else
+ case $command in
+ @(putkey|delkey))
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_adresses
+ fi
+ ;;
+ lm)
+ _count_args
+ if [ $args -eq 2 ]; then
+ COMPREPLY=( $( compgen -W 'MASTER \
+ SLAVE NONE ACCEPT' -- "$cur" ) )
+ fi
+ ;;
+ ptype)
+ _count_args
+ if [ $args -eq 2 ]; then
+ _bluetooth_packet_types
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _hciconfig hciconfig
+
+_hciattach()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
+ else
+ _count_args
+ case $args in
+ 1)
+ COMPREPLY=( $( command ls /dev/tty* ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} \
+ ${COMPREPLY[@]#/dev/}' -- "$cur" ) )
+ ;;
+ 2)
+ COMPREPLY=( $( compgen -W 'any ericsson digi \
+ xircom csr bboxes swave bcsp 0x0105 \
+ 0x080a 0x0160 0x0002' -- "$cur" ) )
+ ;;
+ 3)
+ COMPREPLY=( $( compgen -W '9600 19200 38400 \
+ 57600 115200 230400 460800 921600' -- "$cur" ) )
+ ;;
+ 4)
+ COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) )
+ ;;
+ 5)
+ _bluetooth_adresses
+ ;;
+ esac
+ fi
+
+}
+complete -F _hciattach hciattach
+
+_hid2hci()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -q --quiet -0 --tohci -1 \
+ --tohid' -- "$cur" ) )
+ fi
+}
+complete -F _hid2hci hid2hci
+
+_avctrl()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- "$cur" ) )
+ else
+ _count_args
+ if [ $args -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) )
+ fi
+ fi
+}
+complete -F _avctrl avctrl
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/brctl b/contrib/brctl
index 1ecdc127..a612034c 100644
--- a/contrib/brctl
+++ b/contrib/brctl
@@ -1,44 +1,48 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for brctl
have brctl &&
_brctl()
{
- local cur command
+ local cur command
- COMPREPLY=()
- cur=`_get_cword`
- command=${COMP_WORDS[1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ command=${COMP_WORDS[1]}
- case $COMP_CWORD in
- 1)
- COMPREPLY=( $( compgen -W "addbr delbr addif delif \
- setageing setbridgeprio setfd sethello \
- setmaxage setpathcost setportprio show \
- showmacs showstp stp" -- $cur ) )
- ;;
- 2)
- case $command in
- show)
- ;;
- *)
- COMPREPLY=( $( compgen -W "$(brctl \
- show | sed '1d' | \
- awk '{print $1}' )" -- $cur ) )
- esac
- ;;
- 3)
- case $command in
- @(add|del)if)
- _configured_interfaces
- ;;
- stp)
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
- ;;
- esac
- ;;
- esac
+ case $COMP_CWORD in
+ 1)
+ COMPREPLY=( $( compgen -W "addbr delbr addif delif \
+ setageing setbridgeprio setfd sethello \
+ setmaxage setpathcost setportprio show \
+ showmacs showstp stp" -- "$cur" ) )
+ ;;
+ 2)
+ case $command in
+ show)
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
+ awk '{print $1}' )" -- "$cur" ) )
+ esac
+ ;;
+ 3)
+ case $command in
+ @(add|del)if)
+ _configured_interfaces
+ ;;
+ stp)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ ;;
+ esac
+ ;;
+ esac
} &&
complete -F _brctl $default brctl
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/bzip2 b/contrib/bzip2
new file mode 100644
index 00000000..5572d09a
--- /dev/null
+++ b/contrib/bzip2
@@ -0,0 +1,47 @@
+# bash completion for bzip2
+
+have bzip2 &&
+_bzip2()
+{
+ local cur prev xspec
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
+ -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
+ --help --decompress --compress --keep --force \
+ --test --stdout --quiet --verbose --license \
+ --version --small --fast --best' -- "$cur" ) )
+ return 0
+ fi
+
+ local IFS=$'\t\n'
+
+ xspec="*.bz2"
+ if [[ "$prev" == --* ]]; then
+ [[ "$prev" == --decompress || \
+ "$prev" == --list || \
+ "$prev" == --test ]] && xspec="!"$xspec
+ [[ "$prev" == --compress ]] && xspec=
+ elif [[ "$prev" == -* ]]; then
+ [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
+ [[ "$prev" == -*z* ]] && xspec=
+ fi
+
+ _expand || return 0
+
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
+} &&
+complete -F _bzip2 $filenames bzip2
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cardctl b/contrib/cardctl
new file mode 100644
index 00000000..c16c52d5
--- /dev/null
+++ b/contrib/cardctl
@@ -0,0 +1,24 @@
+# Linux cardctl(8) completion
+
+have cardctl &&
+_cardctl()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'status config ident suspend \
+ resume reset eject insert scheme' -- "$cur" ) )
+ fi
+} &&
+complete -F _cardctl cardctl
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cfengine b/contrib/cfengine
new file mode 100644
index 00000000..0f40e0cd
--- /dev/null
+++ b/contrib/cfengine
@@ -0,0 +1,93 @@
+# bash completion for cfengine
+
+have cfagent && {
+_cfagent_options()
+{
+ COMPREPLY=( $( compgen -W '-a --sysadm -b --force-net-copy -c \
+ --no-check-files -C --no-check-mounts -d --debug -D --define \
+ -e --no-edits -E --enforce-links -f --file -h --help -H \
+ --no-hard-classes -i --no-ifconfig -I --inform -k --no-copy \
+ -K --no-lock -l --traverse-links -L --delete-stale-links -m \
+ --no-mount -M --no-modules -n --recon --dry-run --just-print \
+ -N --negate --undefine -p --parse-only -P --no-processes -q \
+ --no-splay -s --no-commands -S --silent -t --no-tidy -u \
+ --use-env -U --underscore-classes -v --verbose -V --version \
+ -x --no-preconf -X --no-links -w --no-warn --quiet' -- "$cur" ) )
+}
+
+_cfagent()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(f|-file))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ _cfagent_options
+ fi
+}
+complete -F _cfagent cfagent
+
+_cfrun()
+{
+ local i section cfinputs
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ section=1
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -- ]]; then
+ section=$((section + 1))
+ fi
+ done
+
+ case $section in
+ 1)
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case $prev in
+ -f)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- $cur ) )
+ else
+ hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -f ]]; then
+ hostfile=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ [ ! -f $hostfile ] && return 0
+
+ COMPREPLY=( $(compgen -W "$( grep -v \
+ -E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
+ fi
+ ;;
+ 2)
+ _cfagent_options
+ ;;
+ esac
+}
+complete -F _cfrun cfrun
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/chkconfig b/contrib/chkconfig
new file mode 100644
index 00000000..7c12c0d8
--- /dev/null
+++ b/contrib/chkconfig
@@ -0,0 +1,45 @@
+# chkconfig(8) completion
+
+have chkconfig &&
+_chkconfig()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ @(?(--level=)[1-6]|--@(list|add|del|override)))
+ _services
+ return 0
+ ;;
+ --level)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) )
+ else
+ if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
+ COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
+ else
+ _services
+ fi
+ fi
+} &&
+complete -F _chkconfig chkconfig
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/chsh b/contrib/chsh
new file mode 100644
index 00000000..46ee029f
--- /dev/null
+++ b/contrib/chsh
@@ -0,0 +1,27 @@
+# chsh(1) completion
+
+_chsh()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [ "$prev" = "-s" ]; then
+ _shells
+ else
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ fi
+
+ return 0
+}
+complete -F _chsh chsh
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cksfv b/contrib/cksfv
index f759e9ee..0ddea02f 100644
--- a/contrib/cksfv
+++ b/contrib/cksfv
@@ -1,30 +1,36 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# cksfv completion by Chris <xris@forevermore.net>
+have cksfv &&
_cksfv()
{
- COMPREPLY=()
- cur=`_get_cword`
-
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- $cur ) )
- return 0
- fi
-
- case "${COMP_WORDS[$COMP_CWORD-1]}" in
- -C)
- _filedir -d
- return 0
- ;;
- -f)
- _filedir 'sfv'
- return 0
- ;;
- esac
-
- _filedir
- return 0
-}
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
+ return 0
+ fi
+
+ case "${COMP_WORDS[$COMP_CWORD-1]}" in
+ -C)
+ _filedir -d
+ return 0
+ ;;
+ -f)
+ _filedir 'sfv'
+ return 0
+ ;;
+ esac
+
+ _filedir
+ return 0
+} &&
complete -F _cksfv cksfv
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/clisp b/contrib/clisp
index 6c6d9b63..322faabb 100644
--- a/contrib/clisp
+++ b/contrib/clisp
@@ -1,9 +1,7 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash brogrammable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
+have clisp &&
_clisp()
{
local cur
@@ -13,14 +11,21 @@ _clisp()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \
- -M -m -L -N -E -q --quiet --silent -w -I -ansi \
- -traditional -p -C -norc -i -c -l -o -x ' \
- -- $cur ) )
+ COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \
+ -M -m -L -N -E -q --quiet --silent -w -I -ansi \
+ -traditional -p -C -norc -i -c -l -o -x ' -- "$cur" ) )
else
- _filedir
+ _filedir
fi
return 0
-}
+} &&
complete -F _clisp $default clisp
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/configure b/contrib/configure
new file mode 100644
index 00000000..3195bcb9
--- /dev/null
+++ b/contrib/configure
@@ -0,0 +1,32 @@
+# bash completion for configure
+
+_configure()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
+ # --option=SETTING will include 'SETTING' as a contextual hint
+ [[ "$cur" != -* ]] && return 0
+
+ if [ -n "$COMP_CONFIGURE_HINTS" ]; then
+ COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \
+ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | \
+ grep ^$cur ) )
+ else
+ COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \
+ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | \
+ grep ^$cur ) )
+ fi
+}
+complete -F _configure $default configure
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cowsay b/contrib/cowsay
index d9f8bc46..0a441446 100644
--- a/contrib/cowsay
+++ b/contrib/cowsay
@@ -1,26 +1,32 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for cowsay
have cowsay &&
_cowsay()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -f)
- COMPREPLY=( $( cowsay -l | tail -n +2 | tr " " "\n" | grep "^$cur" ) )
- return 0
- ;;
- esac
+ case $prev in
+ -f)
+ COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2)' -- "$cur" ) )
+ return 0
+ ;;
+ esac
- # relevant options completion
- COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' -- $cur ) )
+ # relevant options completion
+ COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \
+ -- "$cur" ) )
} &&
complete -F _cowsay $default cowsay cowthink
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cpan2dist b/contrib/cpan2dist
index caec18fa..e2147bfa 100644
--- a/contrib/cpan2dist
+++ b/contrib/cpan2dist
@@ -1,45 +1,53 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for cpan2dist
have cpan2dist &&
_cpan2dist()
{
- local cur prev packagelist cpandirs
+ local cur prev packagelist cpandirs
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- --format)
- # should remove ":" from COMP_WORDBREAKS, but doesn't work (?)
- COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" ) )
- return 0
- ;;
- --@(banlist|ignorelist|modulelist|logfile))
- _filedir
- return 0
- ;;
- esac
+ case $prev in
+ --format)
+ # should remove ":" from COMP_WORDBREAKS, but doesn't work (?)
+ COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \
+ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --@(banlist|ignorelist|modulelist|logfile))
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
- --verbose --keepsource --makefile --buildprereq \
- --archive --flushcache --defaults --edit-metafile \
- --format --ban --banlist --ignore --ignorelist \
- --modulelist --logfile --timeout --set-config \
- --set-program --dist-opts --default-banlist \
- --default-ignorelist' -- $cur ) )
- else
- cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
- for dir in ${cpandirs[@]}; do
- [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz"
- done
- COMPREPLY=( $( zgrep "^${cur//-/::}" \
- $packagelist 2>/dev/null \
- | awk '{print $1}' | sed -e 's/::/-/g' ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
+ --verbose --keepsource --makefile --buildprereq \
+ --archive --flushcache --defaults --edit-metafile \
+ --format --ban --banlist --ignore --ignorelist \
+ --modulelist --logfile --timeout --set-config \
+ --set-program --dist-opts --default-banlist \
+ --default-ignorelist' -- $cur ) )
+ else
+ cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
+ for dir in ${cpandirs[@]}; do
+ [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && \
+ packagelist="$dir/02packages.details.txt.gz"
+ done
+ COMPREPLY=( $( zgrep "^${cur//-/::}" \
+ $packagelist 2>/dev/null \
+ | awk '{print $1}' | sed -e 's/::/-/g' ) )
+ fi
} &&
complete -F _cpan2dist $default cpan2dist
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cpio b/contrib/cpio
new file mode 100644
index 00000000..f28b1b21
--- /dev/null
+++ b/contrib/cpio
@@ -0,0 +1,101 @@
+# bash completion for cpio
+
+have cpio && {
+_cpio_format()
+{
+ COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
+}
+
+_cpio()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ # --name value style option
+ case $prev in
+ -H|--format)
+ _cpio_format
+ return 0
+ ;;
+ -@(E|F|I|-?(pattern-)file))
+ _filedir
+ return 0
+ ;;
+ -R|--owner)
+ _usergroup
+ return 0
+ ;;
+ --rsh-command)
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- "$cur" ) )
+ else
+ case ${COMP_WORDS[1]} in
+ -@(o|-create))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
+ -L -V -C -H -M -O -F --file --format\
+ --message --null --reset-access-time\
+ --verbose --dot --append --block-size\
+ --dereference --io-size --quiet\
+ --force-local --rsh-command --help\
+ --version' -- "$cur" ) )
+ fi
+ ;;
+ -@(i|-extract))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
+ -t -s -u -v -B -S -V -C -E -H -M -R -I\
+ -F --file --make-directories\
+ --nonmatching\
+ --preserve-modification-time\
+ --numeric-uid-gid --rename -t --list\
+ --swap-bytes --swap --dot\
+ --unconditional --verbose --block-size\
+ --swap-halfwords --io-size\
+ --pattern-file --format --owner\
+ --no-preserve-owner --message\
+ --force-local --no-absolute-filenames\
+ --sparse --only-verify-crc --quiet\
+ --rsh-command --help\
+ --version' -- "$cur" ) )
+ fi
+ ;;
+ -@(p|-pass-through))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
+ -L -V -R --null --reset-access-time\
+ --make-directories --link --quiet\
+ --preserve-modification-time\
+ --unconditional --verbose --dot\
+ --dereference --owner\
+ --no-preserve-owner --sparse --help\
+ --version' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _cpio cpio
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cups b/contrib/cups
new file mode 100644
index 00000000..0d7ceaba
--- /dev/null
+++ b/contrib/cups
@@ -0,0 +1,21 @@
+# bash completion for cups
+
+have cancel &&
+_cancel()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
+} &&
+complete -F _cancel $filenames cancel
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/cvs b/contrib/cvs
new file mode 100644
index 00000000..aa2d46c9
--- /dev/null
+++ b/contrib/cvs
@@ -0,0 +1,266 @@
+# cvs(1) completion
+
+have cvs && {
+set_prefix()
+{
+ [ -z ${prefix:-} ] || prefix=${cur%/*}/
+ [ -r ${prefix:-}CVS/Entries ] || prefix=""
+}
+
+get_entries()
+{
+ local IFS=$'\n'
+ [ -r ${prefix:-}CVS/Entries ] && \
+ entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
+}
+
+get_modules()
+{
+ if [ -n "$prefix" ]; then
+ COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
+ else
+ COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
+ fi
+}
+
+_cvs()
+{
+ local cur count mode i cvsroot cvsroots pwd
+ local -a flags miss files entries changed newremoved
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ count=0
+ for i in "${COMP_WORDS[@]}"; do
+ [ $count -eq $COMP_CWORD ] && break
+ # Last parameter was the CVSROOT, now go back to mode selection
+ if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
+ mode=""
+ fi
+ if [ -z "$mode" ]; then
+ case $i in
+ -d)
+ mode=cvsroot
+ cvsroot=${COMP_WORDS[((count+1))]}
+ ;;
+ @(ad?(d)|new))
+ mode=add
+ ;;
+ @(adm?(in)|rcs))
+ mode=admin
+ ;;
+ ann?(notate))
+ mode=annotate
+ ;;
+ @(checkout|co|get))
+ mode=checkout
+ ;;
+ @(com?(mit)|ci))
+ mode=commit
+ ;;
+ di?(f?(f)))
+ mode=diff
+ ;;
+ ex?(p?(ort)))
+ mode=export
+ ;;
+ ?(un)edit)
+ mode=$i
+ ;;
+ hi?(s?(tory)))
+ mode=history
+ ;;
+ im?(p?(ort)))
+ mode=import
+ ;;
+ re?(l?(ease)))
+ mode=release
+ ;;
+ ?(r)log)
+ mode=log
+ ;;
+ @(rdiff|patch))
+ mode=rdiff
+ ;;
+ @(remove|rm|delete))
+ mode=remove
+ ;;
+ @(rtag|rfreeze))
+ mode=rtag
+ ;;
+ st?(at?(us)))
+ mode=status
+ ;;
+ @(tag|freeze))
+ mode=tag
+ ;;
+ up?(d?(ate)))
+ mode=update
+ ;;
+ *)
+ ;;
+ esac
+ elif [[ "$i" = -* ]]; then
+ flags=( "${flags[@]}" $i )
+ fi
+ count=$((++count))
+ done
+
+ case "$mode" in
+ add)
+ if [[ "$cur" != -* ]]; then
+ set_prefix
+ if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
+ get_entries
+ [ -z "$cur" ] && \
+ files=$( command ls -Ad !(CVS) ) || \
+ files=$( command ls -d ${cur}* 2>/dev/null )
+ for i in "${entries[@]}"; do
+ files=( ${files[@]/#$i//} )
+ done
+ COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
+ fi
+ else
+ COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) )
+ fi
+ ;;
+ admin)
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u -L -U -m -M \
+ -n -N -o -q -I -s -t -t- -T -V -x -z' -- $cur ) )
+ fi
+ ;;
+ annotate)
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) )
+ else
+ get_entries
+ COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
+ fi
+ ;;
+ checkout)
+ if [[ "$cur" != -* ]]; then
+ [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
+ awk '{print $1}' ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
+ -s -r -D -d -k -j' -- "$cur" ) )
+ fi
+ ;;
+ commit)
+ set_prefix
+
+ if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
+ # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
+ # complete on remotely checked-out files (requires
+ # passwordless access to the remote repository
+ if [ -n "${COMP_CVS_REMOTE:-}" ]; then
+ # this is the least computationally intensive
+ # way found so far, but other changes
+ # (something other than changed/removed/new)
+ # may be missing
+ changed=( $( cvs -q diff --brief 2>&1 | \
+ sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
+ newremoved=( $( cvs -q diff --brief 2>&1 | \
+ sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
+ COMPREPLY=( $( compgen -W '${changed[@]:-} \
+ ${newremoved[@]:-}' -- "$cur" ) )
+ else
+ COMPREPLY=( $(compgen $default -- "$cur") )
+ fi
+ else
+ COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- $cur ) )
+ fi
+ ;;
+ cvsroot)
+ if [ -r ~/.cvspass ]; then
+ # Ugly escaping because of bash treating ':' specially
+ cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
+ COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
+ fi
+ ;;
+ export)
+ if [[ "$cur" != -* ]]; then
+ [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '-N -f -l -R -n -r -D -d -k' \
+ -- "$cur" ) )
+ fi
+ ;;
+ diff)
+ if [[ "$cur" == -* ]]; then
+ _longopt diff
+ else
+ get_entries
+ COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
+ fi
+ ;;
+ remove)
+ if [[ "$cur" != -* ]]; then
+ set_prefix
+ if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
+ get_entries
+ # find out what files are missing
+ for i in "${entries[@]}"; do
+ [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
+ done
+ COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
+ fi
+ else
+ COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) )
+ fi
+ ;;
+ import)
+ if [[ "$cur" != -* ]]; then
+ # starts with same algorithm as checkout
+ [ -z "$cvsroot" ] && cvsroot=$CVSROOT
+ prefix=${cur%/*}
+ if [ -r ${cvsroot}/${prefix} ]; then
+ get_modules
+ COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
+ COMPREPLY=( ${COMPREPLY[@]#\/} )
+ fi
+ pwd=$( pwd )
+ pwd=${pwd##*/}
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
+ else
+ COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" ))
+ fi
+ ;;
+ update)
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
+ -k -r -D -j -I -W' -- "$cur" ) )
+ fi
+ ;;
+ "")
+ COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
+ commit diff delete edit export \
+ freeze get history import log new \
+ patch rcs rdiff release remove \
+ rfreeze rlog rm rtag stat status \
+ tag unedit up update -H -Q -q -b \
+ -d -e -f -l -n -t -r -v -w -x -z \
+ --help --version' -- "$cur" ) )
+ ;;
+ *)
+ ;;
+ esac
+
+ return 0
+}
+complete -F _cvs $default cvs
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dcop b/contrib/dcop
new file mode 100644
index 00000000..6f384f71
--- /dev/null
+++ b/contrib/dcop
@@ -0,0 +1,26 @@
+# bash completion for dcop
+
+have dcop &&
+_dcop()
+{
+ local cur compstr
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ if [ -z $cur ]; then
+ compstr=${COMP_WORDS[*]}
+ else
+ compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
+ fi
+ COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' \
+ -- "$cur" ) )
+} &&
+complete -F _dcop dcop
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dd b/contrib/dd
new file mode 100644
index 00000000..3c1d3c37
--- /dev/null
+++ b/contrib/dd
@@ -0,0 +1,39 @@
+# bash completion for dd
+
+have dd &&
+_dd()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword =`
+
+ case "$cur" in
+ if=*|of=*)
+ cur=${cur#*=}
+ _filedir
+ return 0
+ ;;
+ conv=*)
+ cur=${cur#*=}
+ COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
+ lcase notrunc ucase swab noerror sync' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ _expand || return 0
+
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
+ $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
+ -S '=' -- "$cur" ) )
+} &&
+complete -F _dd $nospace $filenames dd
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dhclient b/contrib/dhclient
new file mode 100644
index 00000000..9ea79f34
--- /dev/null
+++ b/contrib/dhclient
@@ -0,0 +1,37 @@
+# bash completion for dhclient
+
+have dhclient && _dhclient()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(cf|lf|pf|sf))
+ _filedir
+ return 0
+ ;;
+ -s)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
+ -cf -sf -s -g -n -nw -w' -- "$cur" ) )
+ else
+ _available_interfaces
+ fi
+} &&
+complete -F _dhclient dhclient
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dict b/contrib/dict
new file mode 100644
index 00000000..c45310f4
--- /dev/null
+++ b/contrib/dict
@@ -0,0 +1,78 @@
+# dict(1) completion
+
+{ have dict || have rdict; } && {
+_dictdata()
+{
+ dict $host $port $1 2>/dev/null | sed -ne \
+ 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
+}
+
+_dict()
+{
+ local cur prev host port db dictfile
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ dictfile=/usr/share/dict/words
+
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ case "${COMP_WORDS[i]}" in
+ -@(h|--host))
+ host=${COMP_WORDS[i+1]}
+ [ -n "$host" ] && host="-h $host"
+ i=$((++i))
+ ;;
+ -@(p|-port))
+ port=${COMP_WORDS[i+1]}
+ [ -n "$port" ] && port="-p $port"
+ i=$((++i))
+ ;;
+ -@(d|-database))
+ db=${COMP_WORDS[i+1]}
+ [ -n "$db" ] && host="-d $db"
+ i=$((++i))
+ ;;
+ *)
+ ;;
+ esac
+ done
+
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
+ -m --match -s --strategy -c --config -C \
+ --nocorrect -D --dbs -S --strats -H \
+ --serverhelp -i --info -I --serverinfo \
+ -a --noauth -u --user -k --key -V --version \
+ -L --license --help -v --verbose -r --raw \
+ -P --pager --debug --html --pipesize --client' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ case "$prev" in
+ -@(d|-database|i|info))
+ COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
+ return 0
+ ;;
+ -@(s|-strategy))
+ COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ [ -r $dictfile ] && \
+ COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
+}
+complete -F _dict $default dict rdict
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dpkg b/contrib/dpkg
new file mode 100644
index 00000000..6437b8af
--- /dev/null
+++ b/contrib/dpkg
@@ -0,0 +1,268 @@
+# This function is required by _dpkg() and _dpkg-reconfigure()
+have dpkg && {
+have grep-status && {
+_comp_dpkg_installed_packages()
+{
+ grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package
+}
+} || {
+_comp_dpkg_installed_packages()
+{
+ 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
+}
+}
+
+# Debian dpkg(8) completion
+#
+_dpkg()
+{
+ local cur prev i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ i=$COMP_CWORD
+
+ _expand || return 0
+
+ _split_longopt
+
+ # find the last option flag
+ if [[ $cur != -* ]]; then
+ while [[ $prev != -* && $i != 1 ]]; do
+ i=$((i-1))
+ prev=${COMP_WORDS[i-1]}
+ done
+ fi
+
+ case "$prev" in
+ -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
+ _filedir '?(u)deb'
+ return 0
+ ;;
+ -@(b|-build))
+ _filedir -d
+ return 0
+ ;;
+ -@(s|p|l|-@(status|print-avail|list)))
+ COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) )
+ return 0
+ ;;
+ -@(S|-search))
+ _filedir
+ return 0
+ ;;
+ -@(r|L|P|-@(remove|purge|listfiles)))
+ COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
+ --configure -r --remove -P --purge --get-selections \
+ --set-selections --update-avail --merge-avail \
+ --clear-avail --command-fd --forget-old-unavail -s \
+ --status -p --print-avail -L --listfiles -l --list \
+ -S --search -C --audit --print-architecture \
+ --print-gnu-build-architecture \
+ --print-installation-architecture \
+ --compare-versions --help --version --force-help \
+ --force-all --force-auto-select --force-downgrade \
+ --force-configure-any --force-hold --force-bad-path \
+ --force-not-root --force-overwrite \
+ --force-overwrite-diverted --force-bad-verify \
+ --force-depends-version --force-depends \
+ --force-confnew --force-confold --force-confdef \
+ --force-confmiss --force-conflicts --force-architecture\
+ --force-overwrite-dir --force-remove-reinstreq \
+ --force-remove-essential -Dh \
+ --debug=help --licence --admindir --root --instdir \
+ -O --selected-only -E --skip-same-version \
+ -G --refuse-downgrade -B --auto-deconfigure \
+ --no-debsig --no-act -D --debug --status-fd \
+ -b --build -I --info -f --field -c --contents \
+ -x --extract -X --vextract --fsys-tarfile -e --control \
+ --ignore-depends --abort-after' -- "$cur" ) )
+ ;;
+ esac
+
+
+}
+complete -F _dpkg $filenames dpkg dpkg-deb
+}
+
+# Debian GNU dpkg-reconfigure(8) completion
+#
+have dpkg-reconfigure &&
+_dpkg_reconfigure()
+{
+ local cur prev opt
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+
+ case "$prev" in
+ -@(f|-frontend))
+ opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
+ opt=( ${opt[@]##*/} )
+ opt=( ${opt[@]%.pm} )
+ COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -@(p|-priority))
+ COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all -u \
+ --unseen-only -h --help -s --showold --force --terse' -- "$cur" ) )
+ else
+ COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
+ fi
+} &&
+complete -F _dpkg_reconfigure $default dpkg-reconfigure
+
+# Debian dpkg-source completion
+#
+have dpkg-source &&
+_dpkg_source()
+{
+ local cur prev options work i action packopts unpackopts
+
+ packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
+ unpackopts="-sp -sn -su"
+ options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
+
+ COMPREPLY=()
+ if [ "$1" != "dpkg-source" ]; then
+ return 1
+ fi
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ action="options"
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
+ action=unpack
+ elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
+ action=pack
+ elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
+ action=help
+ fi
+ done
+ # if currently seeing a complete option, return just itself.
+ for i in $options; do
+ if [ "$cur" = "$i" ]; then
+ COMPREPLY=( "$cur" )
+ return 0
+ fi
+ done
+ case "$action" in
+ "unpack")
+ if [ "$cur" = "-" -o "$cur" = "-s" ]; then
+ COMPREPLY=( $unpackopts )
+ return 0
+ fi
+ case "$prev" in
+ "-x")
+ COMPREPLY=( $( compgen -d -- "$cur" ) \
+ $( compgen -f -X '!*.dsc' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ return 0
+ ;;
+ "pack")
+ if [ "$cur" = "-" ]; then
+ COMPREPLY=( $packopts )
+ return 0
+ fi
+ if [ "$cur" = "-s" ]; then
+ COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
+ "-sA" "-sK" "-sP" "-sU" "-sR" )
+ return 0
+ fi
+ case "$prev" in
+ "-b")
+ COMPREPLY=( $( compgen -d -- "$cur" ) )
+ return 0
+ ;;
+ "-c"|"-l"|"-T"|"-i"|"-I")
+ # -c: get controlfile
+ # -l: get per-version info from this file
+ # -T: read variables here, not debian/substvars
+ # -i: <regexp> filter out files to ignore diffs of.
+ # -I: filter out files when building tarballs.
+ # return directory names and file names
+ COMPREPLY=( $( compgen -d -f ) )
+ return 0
+ ;;
+ "-F")
+ # -F: force change log format
+ COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
+ return 0
+ ;;
+ "-V"|"-D")
+ # -V: set a substitution variable
+ # we don't know anything about possible variables or values
+ # so we don't try to suggest any completion.
+ COMPREPLY=()
+ return 0
+ ;;
+ "-D")
+ # -D: override or add a .dsc field and value
+ # if $cur doesn't contain a = yet, suggest variable names
+ if echo -- "$cur" | grep -q "="; then
+ # $cur contains a "="
+ COMPREPLY=()
+ return 0
+ else
+ COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
+ return 0
+ fi
+ ;;
+ "-U")
+ # -U: remove a field
+ # Suggest possible fieldnames
+ COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $packopts )
+ return 0
+ ;;
+ esac
+ return 0
+ ;;
+ *)
+ # if seeing a partial option, return possible completions.
+ if [ "$cur" = "-s" ]; then
+ COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
+ "-sA" "-sK" "-sP" "-sU" "-sR" )
+ return 0
+ fi
+ # else return all possible options.
+ COMPREPLY=( $options )
+ return 0
+ ;;
+ esac
+} &&
+complete -F _dpkg_source dpkg-source
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dselect b/contrib/dselect
new file mode 100644
index 00000000..31ad2de8
--- /dev/null
+++ b/contrib/dselect
@@ -0,0 +1,42 @@
+# Debian Linux dselect(8) completion.
+
+have dselect &&
+_dselect()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --admindir)
+ _filedir -d
+ return 0
+ ;;
+ -@(D|debug))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
+ --license --expert --debug' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'access update select install config \
+ remove quit' -- "$cur" ) )
+ fi
+
+
+ return 0
+} &&
+complete -F _dselect $filenames dselect
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/dsniff b/contrib/dsniff
index 614005a2..901fa8e2 100644
--- a/contrib/dsniff
+++ b/contrib/dsniff
@@ -1,272 +1,287 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# dsniff util completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
# arpspoof(8) completion
#
+have arpspoof &&
_arpspoof()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- -t)
- _known_hosts
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -t' -- $cur ) )
- else
- _known_hosts
- fi
-
-}
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ -t)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -t' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+
+} &&
complete -F _arpspoof arpspoof
# dnsspoof(8) completion
#
+have dnsspoof &&
_dnsspoof()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- -f)
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -f' -- $cur ) )
- fi
-
-}
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ -f)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -f' -- "$cur" ) )
+ fi
+
+} &&
complete -F _dnsspoof dnsspoof
# dsniff(8) completion
#
+have dsniff &&
_dsniff()
{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(r|w|f))
- _filedir
- return 0
- ;;
- -i)
- _interfaces
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t \
- -r -w' -- $cur ) )
- fi
-
-}
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(r|w|f))
+ _filedir
+ return 0
+ ;;
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t -r -w' -- "$cur" ) )
+ fi
+
+} &&
complete -F _dsniff dsniff
# filesnarf(8), mailsnarf(8) and msgsnarf (8) completion
#
+have filesnarf || have mailsnarf || have msgsnarf &&
_snarf()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -v' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -v' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _snarf filesnarf mailsnarf msgsnarf
# macof(8) completion
#
+have macof &&
_macof()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _macof macof
# sshmitm(8) completion
#
+have sshmitm &&
_sshmitm()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -I -p' -- $cur ) )
- else
- _known_hosts
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
-}
+} &&
complete -F _sshmitm sshmitm
# sshow(8) completion
#
+have sshow &&
_sshow()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -i' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -i' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _sshow sshow
# tcpkill(8) completion
#
+have tcpkill &&
_tcpkill()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _tcpkill tcpkill
# tcpnice(8) completion
#
+have tcpnice &&
_tcpnice()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A -I -M -i' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A -I -M -i' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _tcpnice tcpnice
# urlsnarf(8) completion
#
+have urlsnarf &&
_urlsnarf()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -i)
- _interfaces
- return 0
- ;;
- esac
+ case "$prev" in
+ -i)
+ _interfaces
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n -i -v' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -i -v' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _urlsnarf urlsnarf
# webmitm(8) completion
#
+have webmitm &&
_webmitm()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d' -- $cur ) )
- else
- _known_hosts
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
-}
+} &&
complete -F _webmitm webmitm
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/findutils b/contrib/findutils
new file mode 100644
index 00000000..d77c892d
--- /dev/null
+++ b/contrib/findutils
@@ -0,0 +1,122 @@
+# bash completion for GNU find. This makes heavy use of ksh style extended
+# globs and contains Linux specific code for completing the parameter
+# to the -fstype option.
+
+have find &&
+_find()
+{
+ local cur prev i exprfound onlyonce
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(max|min)depth)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
+ _filedir
+ return 0
+ ;;
+ -fstype)
+ # this is highly non-portable
+ [ -e /proc/filesystems ] &&
+ COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -gid)
+ _gids
+ return 0
+ ;;
+ -group)
+ if [ -n "$bash205" ]; then
+ COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
+ fi
+ return 0
+ ;;
+ -?(x)type)
+ COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) )
+ return 0
+ ;;
+ -uid)
+ _uids
+ return 0
+ ;;
+ -user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -exec|-ok)
+ COMP_WORDS=(COMP_WORDS[0] "$cur")
+ COMP_CWORD=1
+ _command
+ return 0
+ ;;
+ -[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \
+ -links|-perm|-size|-used|-printf)
+ # do nothing, just wait for a parameter to be given
+ return 0
+ ;;
+ esac
+
+ _expand || return 0
+
+ # set exprfound to 1 if there is already an expression present
+ for i in ${COMP_WORDS[@]}; do
+ [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
+ done
+
+ # handle case where first parameter is not a dash option
+ if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
+ _filedir -d
+ return 0
+ fi
+
+ # complete using basic options
+ COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
+ -mindepth -mount -noleaf -version -xdev -amin -anewer \
+ -atime -cmin -cnewer -ctime -empty -false -fstype \
+ -gid -group -ilname -iname -inum -ipath -iregex \
+ -wholename \
+ -links -lname -mmin -mtime -name -newer -nouser \
+ -nogroup -perm -regex -size -true -type -uid -used \
+ -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
+ -print -print0 -printf -prune -ls -wholename -iwholename' -- "$cur" ) )
+
+ # this removes any options from the list of completions that have
+ # already been specified somewhere on the command line, as long as
+ # these options can only be used once (in a word, "options", in
+ # opposition to "tests" and "actions", as in the find(1) manpage).
+ onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
+ -noleaf -version -xdev '
+ COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
+ (while read -d ' ' i; do
+ [ "$i" == "" ] ||
+ [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
+ continue
+ # flatten array with spaces on either side,
+ # otherwise we cannot grep on word boundaries of
+ # first and last word
+ COMPREPLY=" ${COMPREPLY[@]} "
+ # remove word from list of completions
+ COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
+ done
+ echo "${COMPREPLY[@]}")
+ ) )
+
+ _filedir
+
+ return 0
+} &&
+complete -F _find $filenames find
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/freeciv b/contrib/freeciv
index 0a5cf359..202596d0 100644
--- a/contrib/freeciv
+++ b/contrib/freeciv
@@ -1,64 +1,69 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# civserver completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+have civserver &&
_civserver()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(f|g|l|r|-file|-log|-gamelog|-read))
- _filedir
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(f|g|l|r|-file|-log|-gamelog|-read))
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
- --debug --file --gamelog --help --info --log --meta \
- --Metaserver --port --quitidle --read --version' \
- -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
+ --debug --file --gamelog --help --info --log --meta \
+ --Metaserver --port --quitidle --read --version' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _civserver civserver
# civclient completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
#
+have civclient &&
_civclient()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(l|S|t|-log|-Sound|-tiles))
- _filedir
- return 0
- ;;
- -@(P|-Plugin))
- COMPREPLY=( $( compgen -W 'none esd sdl' -- $cur ) )
- return 0
- ;;
- -@(s|-server))
- _known_hosts
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(l|S|t|-log|-Sound|-tiles))
+ _filedir
+ return 0
+ ;;
+ -@(P|-Plugin))
+ COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
+ return 0
+ ;;
+ -@(s|-server))
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
- --autoconnect --debug --help --log --meta --name \
- --port --Plugin --server --Sound --tiles --version' \
- -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
+ --autoconnect --debug --help --log --meta --name --port \
+ --Plugin --server --Sound --tiles --version' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _civclient civclient
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gcc b/contrib/gcc
new file mode 100644
index 00000000..a4f80952
--- /dev/null
+++ b/contrib/gcc
@@ -0,0 +1,59 @@
+# gcc(1) completion
+#
+# The only unusual feature is that we don't parse "gcc --help -v" output
+# directly, because that would include the options of all the other backend
+# tools (linker, assembler, preprocessor, etc) without any indication that
+# you cannot feed such options to the gcc driver directly. (For example, the
+# linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we
+# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
+# --help output of the compiler.
+
+have gcc &&
+_gcc()
+{
+ local cur cc backend
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _expand || return 0
+
+ case "$1" in
+ gcj)
+ backend=jc1
+ ;;
+ gpc)
+ backend=gpc1
+ ;;
+ *77)
+ backend=f771
+ ;;
+ *)
+ backend=cc1 # (near-)universal backend
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ cc=$( $1 -print-prog-name=$backend )
+ # sink stderr:
+ # for C/C++/ObjectiveC it's useless
+ # for FORTRAN/Java it's an error
+ COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \
+ tr '\t' ' ' | \
+ sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
+ sort -u )" -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
+[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
+[ -n "${have:-}" ] && complete $filenames -F _gcc cc
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gcl b/contrib/gcl
index dd4f25e0..ce6923fc 100644
--- a/contrib/gcl
+++ b/contrib/gcl
@@ -1,9 +1,7 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
+have gcl &&
_gcl()
{
local cur
@@ -13,13 +11,20 @@ _gcl()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \
- -compile -o-file -c-file -h-file -data-file -system-p '\
- -- $cur ) )
+ COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \
+ -compile -o-file -c-file -h-file -data-file -system-p '-- "$cur" ) )
else
- _filedir
+ _filedir
fi
return 0
-}
-complete -F _gcl -o default gcl
+} &&
+complete -F _gcl $default gcl
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gdb b/contrib/gdb
new file mode 100644
index 00000000..7ea304e1
--- /dev/null
+++ b/contrib/gdb
@@ -0,0 +1,43 @@
+# bash completion for gdb
+
+have gdb &&
+_gdb()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ local IFS
+ if [[ "$cur" == */* ]]; then
+ # compgen -c works as expected if $cur contains any slashes.
+ IFS=$'\n'
+ COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) )
+ else
+ # otherwise compgen -c contains Bash's built-in commands,
+ # functions and aliases. Thus we need to retrieve the program
+ # names manually.
+ IFS=":"
+ local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') )
+ IFS=$'\n'
+ COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
+ -mindepth 1 -maxdepth 1 -not -type d -executable \
+ -printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
+ fi
+ elif [ $COMP_CWORD -eq 2 ]; then
+ prev=${prev##*/}
+ COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
+ awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
+ fi
+} &&
+complete -F _gdb $default gdb
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/genisoimage b/contrib/genisoimage
new file mode 100644
index 00000000..7f3abfe6
--- /dev/null
+++ b/contrib/genisoimage
@@ -0,0 +1,79 @@
+# bash completion for mkisofs/genisoimage
+
+(have mkisofs || have genisoimage) &&
+_mkisofs()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
+ _filedir
+ return 0
+ ;;
+ -*-charset)
+ COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \
+ help 2>&1 | tail -n +3 )' -- "$cur" ) )
+ return 0
+ ;;
+ -uid)
+ _uids
+ return 0
+ ;;
+ -gid)
+ _gids
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
+ -allow-multidot -biblio -cache-inodes \
+ -no-cache-inodes -b -eltorito-alt-boot -B -G \
+ -hard-disk-boot -no-emul-boot -no-boot \
+ -boot-load-seg -boot-load-size \
+ -boot-info-table -C -c -check-oldname \
+ -check-session -copyright -d -D -dir-mode \
+ -dvd-video -f -file-mode -gid -gui \
+ -graft-points -hide -hide-list -hidden \
+ -hidden-list -hide-joliet -hide-joliet-list \
+ -hide-joliet-trans-tbl -hide-rr-moved \
+ -input-charset -output-charset -iso-level -J \
+ -joliet-long -jcharset -l -L -log-file -m \
+ -exclude-list -max-iso9660-filenames -M -N \
+ -new-dir-mode -nobak -no-bak -force-rr -no-rr \
+ -no-split-symlink-components \
+ -no-split-symlink-fields -o -pad -no-pad \
+ -path-list -P -p -print-size -quiet -R -r \
+ -relaxed-filenames -sort -split-output \
+ -stream-media-size -stream-file-name -sysid -T\
+ -table-name -ucs-level -udf -uid \
+ -use-fileversion -U -no-iso-translate -V \
+ -volset -volset-size -volset-seqno -v -x -z \
+ -hfs -apple -map -magic -hfs-creator \
+ -hfs-type -probe -no-desktop -mac-name \
+ -boot-hfs-file -part -auto -cluster-size \
+ -hide-hfs -hide-hfs-list -hfs-volid \
+ -icon-position -root-info -prep-boot \
+ -input-hfs-charset -output-hfs-charset \
+ -hfs-unlock -hfs-bless -hfs-parms --cap \
+ --netatalk --double --ethershare --ushare \
+ --exchange --sgi --xinet --macbin --single \
+ --dave --sfm --osx-double --osx-hfs' -- "$cur" ))
+ else
+ _filedir
+ fi
+
+} &&
+complete -F _mkisofs $filenames mkisofs genisoimage
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/getent b/contrib/getent
new file mode 100644
index 00000000..ec49e2e7
--- /dev/null
+++ b/contrib/getent
@@ -0,0 +1,56 @@
+# bash completion for getent
+
+have getent &&
+_getent()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ passwd)
+ COMPREPLY=( $( compgen -u "$cur" ) )
+ return 0
+ ;;
+ group)
+ COMPREPLY=( $( compgen -g "$cur" ) )
+ return 0
+ ;;
+ services)
+ COMPREPLY=( $( compgen -s "$cur" ) )
+ return 0
+ ;;
+ hosts)
+ COMPREPLY=( $( compgen -A hostname "$cur" ) )
+ return 0
+ ;;
+ protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
+ COMPREPLY=( $( getent "$prev" | \
+ sed -ne 's|^\('"$cur"'[^[:space:]]*\).*|\1|p' ) )
+ return 0
+ ;;
+ aliases|shadow)
+ COMPREPLY=( $( getent "$prev" | \
+ sed -ne 's|^\('"$cur"'[^:]*\).*|\1|p' ) )
+ return 0
+ ;;
+ esac
+
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \
+ networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \
+ shadow' -- "$cur" ) )
+ fi
+} &&
+complete -F _getent getent
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gkrellm b/contrib/gkrellm
index 43603b10..64144102 100644
--- a/contrib/gkrellm
+++ b/contrib/gkrellm
@@ -1,37 +1,42 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# gkrellm(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+have gkrellm || have gkrellm2 &&
_gkrellm()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(t|-theme))
- _filedir -d
- return 0
- ;;
- -@(p|-plugin))
- _filedir 'so'
- return 0
- ;;
- -@(s|-server))
- _known_hosts
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(t|-theme))
+ _filedir -d
+ return 0
+ ;;
+ -@(p|-plugin))
+ _filedir 'so'
+ return 0
+ ;;
+ -@(s|-server))
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--help -t --theme -s --server \
- -g --geometry -wm -w --withdrawn -c --config -nc \
- -f --force-host-config -demo -p --plugin -P \
- --port' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help -t --theme -s --server \
+ -g --geometry -wm -w --withdrawn -c --config -nc \
+ -f --force-host-config -demo -p --plugin -P --port' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _gkrellm gkrellm gkrellm2
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gnatmake b/contrib/gnatmake
index e4d4e41f..3b66aa31 100644
--- a/contrib/gnatmake
+++ b/contrib/gnatmake
@@ -1,32 +1,37 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# Gnatmake completion by Ralf_Schroth@t-online.de (Ralf Schroth)
+have gnatmake &&
_gnatmake()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- # relevant (and less relevant ;-) )options completion
- COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o \
- -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \
- -nostdlib -cargs -bargs -largs -fstack-check \
- -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \
- -gnatb -gnatc -gnatd -gnatD -gnate -gnatE \
- -gnatf -gnatF -gnatg -gnatG -gnath -gnati \
- -gnatk -gnatl -gnatL -gnatm -gnatn -gnato \
- -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
- -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
- -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
- -gnaty -gnatz -gnatZ -gnat83' -- $cur ) )
- else
- # source file completion
- _filedir '@(adb|ads)'
-
- fi
-}
-complete -F _gnatmake -o filenames gnatmake
+ if [[ "$cur" == -* ]]; then
+ # relevant (and less relevant ;-) )options completion
+ COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o \
+ -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \
+ -nostdlib -cargs -bargs -largs -fstack-check \
+ -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \
+ -gnatb -gnatc -gnatd -gnatD -gnate -gnatE \
+ -gnatf -gnatF -gnatg -gnatG -gnath -gnati \
+ -gnatk -gnatl -gnatL -gnatm -gnatn -gnato \
+ -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
+ -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
+ -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
+ -gnaty -gnatz -gnatZ -gnat83' -- "$cur" ) )
+ else
+ # source file completion
+ _filedir '@(adb|ads)'
+ fi
+} &&
+complete -F _gnatmake $filenames gnatmake
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gpg b/contrib/gpg
new file mode 100644
index 00000000..a0dea7d1
--- /dev/null
+++ b/contrib/gpg
@@ -0,0 +1,49 @@
+# bash completion for gpg
+
+have gpg &&
+_gpg()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
+ _filedir
+ return 0
+ ;;
+ --@(export|@(?(l|nr|nrl)sign|edit)-key))
+ # return list of public keys
+ COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
+ sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
+ return 0
+ ;;
+ -@(r|-recipient))
+ COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
+ sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
+ if [ -e ~/.gnupg/gpg.conf ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
+ ~/.gnupg/gpg.conf )" -- "$cur") )
+ fi
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
+ -q -n -N $(gpg --dump-options)' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _gpg $default gpg
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gpg2 b/contrib/gpg2
index c41aa0af..56e3c6eb 100644
--- a/contrib/gpg2
+++ b/contrib/gpg2
@@ -1,44 +1,53 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# gpg2(1) completion
-#
+
have gpg2 && {
_gpg2 ()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --homedir)
- _filedir -d
- return 0
- ;;
- -@(s|-sign|-clearsign|-options|-decrypt))
- _filedir
- return 0
- ;;
- --@(export|@(?(l|nr|nrl)sign|edit)-key))
- # return list of public keys
- COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
- return 0
- ;;
- -@(r|-recipient))
- COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
- if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf)" -- "$cur"))
- fi
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
- -n -N -i -h -R -t $(gpg2 --dump-options)' -- $cur ) )
- fi
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --homedir)
+ _filedir -d
+ return 0
+ ;;
+ -@(s|-sign|-clearsign|-options|-decrypt))
+ _filedir
+ return 0
+ ;;
+ --@(export|@(?(l|nr|nrl)sign|edit)-key))
+ # return list of public keys
+ COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
+ sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
+ return 0
+ ;;
+ -@(r|-recipient))
+ COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
+ sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
+ if [ -e ~/.gnupg/gpg.conf ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
+ ~/.gnupg/gpg.conf)" -- "$cur"))
+ fi
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
+ -n -N -i -h -R -t $(gpg2 --dump-options)' -- "$cur" ) )
+ fi
} &&
complete -F _gpg2 $default gpg2
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/gzip b/contrib/gzip
new file mode 100644
index 00000000..0bfd748a
--- /dev/null
+++ b/contrib/gzip
@@ -0,0 +1,48 @@
+# bash completion for gzip
+
+have gzip &&
+_gzip()
+{
+ local cur prev xspec helpopts
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ helpopts=`_parse_help gzip`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" -- "$cur" ) )
+ return 0
+ fi
+
+ local IFS=$'\t\n'
+
+ xspec="*.?(t)gz"
+ if [[ "$prev" == --* ]]; then
+ [[ "$prev" == --decompress || \
+ "$prev" == --list || \
+ "$prev" == --test ]] && xspec="!"$xspec
+ [[ "$prev" == --force ]] && xspec=
+ elif [[ "$prev" == -* ]]; then
+ [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
+ [[ "$prev" == -*f* ]] && xspec=
+ elif [ "$prev" = '>' -o "$prev" = '>>' ]; then
+ xspec=
+ elif [ "$prev" = '<' ]; then
+ xspec=
+ fi
+
+ _expand || return 0
+
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
+} &&
+complete -F _gzip $filenames gzip
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/harbour b/contrib/harbour
deleted file mode 100644
index 0d111bd1..00000000
--- a/contrib/harbour
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
-# harbour completion by Dave Pearson <davep@davep.org>
-# http://www.harbour-project.org/
-
-complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
-complete -f -X '!*.[Hh][Rr][Bb]' hbrun
diff --git a/contrib/heimdal b/contrib/heimdal
new file mode 100644
index 00000000..6d79d142
--- /dev/null
+++ b/contrib/heimdal
@@ -0,0 +1,134 @@
+# bash completion for heimdal
+
+have ktutil && {
+_heimdal_principals()
+{
+
+ COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \
+ awk '{print $1}' )" -- "$cur" ) )
+}
+
+_heimdal_realms()
+{
+
+ COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \
+ awk '{print $1}' | awk -F @ '{print $2}' )" -- "$cur" ) )
+}
+
+_heimdal_encodings()
+{
+
+ COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \
+ des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \
+ aes256-cts-hmac-sha1-96' -- "$cur" ) )
+}
+
+_ktutil()
+{
+ local cur prev command options split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -p|--principal)
+ _heimdal_principals
+ return 0
+ ;;
+ -e|--enctype)
+ _heimdal_encodings
+ return 0
+ ;;
+ -a|--admin-server)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -r|--realm)
+ _heimdal_realms
+ return 0
+ ;;
+ -@(s|k|-@(srv|key)tab))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ commands='add change copy get list remove rename purge srvconvert \
+ srv2keytab srvcreate key2srvtab'
+
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ case ${COMP_WORDS[i]} in
+ -@(k|-keytab))
+ i=$(($i+1))
+ ;;
+ -*)
+ ;;
+ *)
+ command=${COMP_WORDS[i]}
+ break
+ ;;
+ esac
+ done
+
+ if [[ "$cur" == -* ]]; then
+ case $command in
+ add)
+ options='-p --principal -V -e --enctype -w --password -r \
+ --random -s --no-salt -h --hex'
+ ;;
+ change)
+ options='-r --realm -a --admin-server -s --server-port'
+ ;;
+ get)
+ options='-p --principal -e --enctype -r --realm -a \
+ --admin-server -s server --server-port'
+ ;;
+ list)
+ options='--keys --timestamp'
+ ;;
+ remove)
+ options='-p --principal -V --kvno -e --enctype'
+ ;;
+ purge)
+ options='--age'
+ ;;
+ @(srv2keytab|key2srvtab))
+ options='-s --srvtab'
+ ;;
+ *)
+ options='-k --keytab -v --verbose --version -v --help'
+ ;;
+ esac
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ case $command in
+ copy)
+ _filedir
+ ;;
+ get)
+ _heimdal_principals
+ ;;
+ rename)
+ _heimdal_principals
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
+ ;;
+ esac
+ fi
+}
+complete -F _ktutil ktutil
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/iconv b/contrib/iconv
new file mode 100644
index 00000000..cf497e99
--- /dev/null
+++ b/contrib/iconv
@@ -0,0 +1,35 @@
+# iconv(1) completion
+
+have iconv &&
+_iconv()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(f|t|-@(from|to)-code))
+ COMPREPLY=( $( compgen -W \
+ '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+
+ if [[ "$cur" = -* ]]; then
+ COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
+ --output -o --verbose' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _iconv $default iconv
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/imagemagick b/contrib/imagemagick
new file mode 100644
index 00000000..ed2d01e0
--- /dev/null
+++ b/contrib/imagemagick
@@ -0,0 +1,532 @@
+# bash completion for ImageMagick
+
+have convert && {
+_ImageMagick()
+{
+ local prev
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -channel)
+ COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
+ Matte Cyan Magenta Yellow Black' -- "$cur" ) )
+ return 0
+ ;;
+ -colormap)
+ COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) )
+ return 0
+ ;;
+ -colorspace)
+ COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
+ XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) )
+ return 0
+ ;;
+ -compose)
+ COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
+ Minus Add Subtract Difference Multiply Bumpmap\
+ Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) )
+ return 0
+ ;;
+ -compress)
+ COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
+ Lossless LZW RLE Zip' -- "$cur" ) )
+ return 0
+ ;;
+ -dispose)
+ COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -encoding)
+ COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
+ AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
+ None SJIScode Symbol Unicode Wansung' -- "$cur"))
+ return 0
+ ;;
+ -endian)
+ COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) )
+ return 0
+ ;;
+ -filter)
+ COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
+ Hanning Hamming Blackman Gaussian Quadratic \
+ Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) )
+ return 0
+ ;;
+ -format)
+ COMPREPLY=( $( compgen -W "$( convert -list format | \
+ awk '/ [r-][w-][+-] / {print $1}' | \
+ tr -d '*' | tr [:upper:] [:lower:] )" -- "$cur" ) )
+ return 0
+ ;;
+ -gravity)
+ COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
+ West Center East SouthWest South SouthEast' -- "$cur" ) )
+ return 0
+ ;;
+ -intent)
+ COMPREPLY=( $( compgen -W 'Absolute Perceptual \
+ Relative Saturation' -- "$cur" ) )
+ return 0
+ ;;
+ -interlace)
+ COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) )
+ return 0
+ ;;
+ -limit)
+ COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) )
+ return 0
+ ;;
+ -list)
+ COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource \
+ Type' -- "$cur" ) )
+ return 0
+ ;;
+ -map)
+ COMPREPLY=( $( compgen -W 'best default gray red green blue' \
+ -- "$cur" ) )
+ _filedir
+ return 0
+ ;;
+ -noise)
+ COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative \
+ Impulse Laplacian Poisson' -- "$cur" ) )
+ return 0
+ ;;
+ -preview)
+ COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
+ Saturation Brightness Gamma Spiff \
+ Dull Grayscale Quantize Despeckle \
+ ReduceNoise AddNoise Sharpen Blur \
+ Treshold EdgeDetect Spread Shade \
+ Raise Segment Solarize Swirl Implode \
+ Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) )
+ return 0
+ ;;
+ -@(mask|profile|texture|tile|write))
+ _filedir
+ return 0
+ ;;
+ -type)
+ COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte \
+ TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte \
+ Optimize' -- "$cur" ) )
+ return 0
+ ;;
+ -units)
+ COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
+ PixelsPerCentimeter' -- "$cur" ) )
+ return 0
+ ;;
+ -virtual-pixel)
+ COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) )
+ return 0
+ ;;
+ -visual)
+ COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor \
+ PseudoColor TrueColor DirectColor defaut visualid' -- "$cur" ))
+ return 0
+ ;;
+ esac
+}
+
+_convert()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
+ -adaptive-sharpen -adjoin -affine -alpha -annotate \
+ -antialias -append -attenuate -authenticate \
+ -auto-orient -average -background -bench -bias \
+ -black-point-compensation -black-threshold \
+ -blue-primary -blur -border -bordercolor -caption \
+ -channel -charcoal -chop -clip -clip-mask -clip-path \
+ -clone -clut -coalesce -colorize -colors -colorspace \
+ -combine -comment -compose -composite -compress \
+ -contrast -contrast-stretch -convolve -crop -cycle \
+ -debug -decipher -deconstruct -define -delay -delete \
+ -density -depth -despeckle -display -dispose -distort \
+ -dither -draw -edge -emboss -encipher -encoding \
+ -endian -enhance -equalize -evaluate -extent -extract \
+ -family -fill -filter -flatten -flip -floodfill -flop \
+ -font -format -frame -fuzz -fx -gamma -gaussian-blur \
+ -geometry -gravity -green-primary -help -identify \
+ -implode -insert -intent -interlace -interpolate \
+ -label -lat -layers -level -limit -linear-stretch \
+ -liquid-rescale -list -log -loop -map -mask \
+ -mattecolor -median -modulate -monitor -monochrome \
+ -morph -mosaic -motion-blur -negate -noise -normalize \
+ -opaque -ordered-dither -orient -page -paint -ping \
+ -pointsize -polaroid -posterize -preview -print \
+ -process -profile -quality -quantize -quiet \
+ -radial-blur -raise -random-threshold -recolor \
+ -red-primary -regard-warnings -region -render -repage \
+ -resample -resize -respect-parenthesis -reverse -roll \
+ -rotate -sample -sampling-factor -scale -scene -seed \
+ -segment -separate -sepia-tone -set -shade -shadow \
+ -sharpen -shave -shear -sigmoidal-contrast -size \
+ -sketch -solarize -splice -spread -stretch -strip \
+ -stroke -strokewidth -style -swap -swirl -taint \
+ -texture -threshold -thumbnail -tile -tile-offset \
+ -tint -transform -transparent -transparent-color \
+ -transpose -transverse -treedepth -trim -type \
+ -undercolor -unique-colors -units -unsharp -verbose \
+ -version -view -vignette -virtual-pixel -wave \
+ -weight -white-point -white-threshold \
+ -write' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+adjoin +append +compress \
+ +contrast +debug +dither +endian +gamma +label +map \
+ +mask +matte +negate +noise +page +raise +render \
+ +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _convert $filenames convert
+
+_mogrify()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
+ -adaptive-sharpen -adjoin -affine -alpha -annotate \
+ -antialias -attenuate -authenticate -auto-orient \
+ -background -bias -black-point-compensation \
+ -black-threshold -blue-primary -blur -border \
+ -bordercolor -caption -channel -charcoal -chop -clip \
+ -clip-mask -clip-path -clut -colorize -colors \
+ -colorspace -comment -compose -compress -contrast \
+ -contrast-stretch -convolve -cycle -debug -decipher \
+ -define -delay -density -depth -despeckle -display \
+ -dispose -distort -dither -draw -edge -emboss \
+ -encipher -encoding -endian -enhance -equalize \
+ -evaluate -extent -extract -family -fill -filter \
+ -flip -floodfill -flop -font -format -frame -fuzz \
+ -gamma -gaussian-blur -geometry -gravity \
+ -green-primary -help -identify -implode -intent \
+ -interlace -interpolate -label -lat -layers -level \
+ -limit -linear-stretch -liquid-rescale -list -log \
+ -loop -mask -mattecolor -median -modulate -monitor \
+ -monochrome -motion-blur -negate -noise -normalize \
+ -opaque -ordered-dither -orient -page -paint -path \
+ -ping -pointsize -polaroid -posterize -preview -print \
+ -profile -quality -quantize -quiet -radial-blur \
+ -raise -random-threshold -recolor -red-primary \
+ -regard-warnings -region -render -repage -resample \
+ -resize -roll -rotate -sample -sampling-factor -scale \
+ -scene -seed -segment -sepia-tone -set -shade -shadow \
+ -sharpen -shave -shear -sigmoidal-contrast -size \
+ -sketch -solarize -splice -spread -stretch -strip \
+ -stroke -strokewidth -style -swirl -taint -texture \
+ -threshold -thumbnail -tile -tile-offset -tint \
+ -transform -transparent -transparent-color -transpose \
+ -transverse -treedepth -trim -type -undercolor \
+ -unique-colors -units -unsharp -verbose -version \
+ -view -vignette -virtual-pixel -wave -weight \
+ -white-point -white-threshold' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+ +endian +gamma +label +map +mask +matte +negate +page \
+ +raise' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _mogrify $filenames mogrify
+
+_display()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
+ -auto-orient -backdrop -background -border \
+ -bordercolor -borderwidth -channel -clip \
+ -clip-path -coalesce -colormap -colors -colorspace \
+ -comment -compress -contrast -crop -debug -decipher \
+ -define -delay -density -depth -despeckle -display \
+ -dispose -dither -edge -endian -enhance -extract \
+ -filter -flatten -flip -flop -font -foreground \
+ -format -frame -gamma -geometry -help -iconGeometry \
+ -iconic -identify -immutable -interlace -interpolate \
+ -label -limit -list -log -loop -map -mattecolor \
+ -monitor -monochrome -name -negate -page -profile \
+ -quality -quantize -quiet -raise -regard-warnings \
+ -remote -repage -resample -resize \
+ -respect-parenthesis -roll -rotate -sample \
+ -sampling-factor -scenes -seed -segment -set \
+ -shared-memory -sharpen -size -strip -texture -title \
+ -transparent-color -treedepth -trim -update \
+ -usePixmap -verbose -version -virtual-pixel -visual \
+ -window -window-group -write' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+ +endian +gamma +label +map +matte +negate +page \
+ +raise +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _display $filenames display
+
+_animate()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \
+ -background -bordercolor -borderwidth -channel \
+ -coalesce -colormap -colors -colorspace -crop -debug \
+ -decipher -define -delay -density -depth -display \
+ -dispose -dither -extract -filter -flatten -font \
+ -foreground -format -gamma -geometry -help \
+ -iconGeometry -iconic -identify -immutable -interlace \
+ -interpolate -limit -list -log -loop -map -mattecolor \
+ -mattecolor -monitor -monochrome -name -page -pause \
+ -quantize -quiet -regard-warnings -remote -repage \
+ -resample -resize -respect-parenthesis -rotate \
+ -sampling-factor -scenes -seed -set -shared-memory \
+ -size -strip -title -transparent-color -treedepth \
+ -trim -verbose -version -virtual-pixel -visual \
+ -window' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \
+ -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _animate $filenames animate
+
+_identify()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
+ -channel -colorspace -crop -debug -define -density \
+ -depth -extract -format -fuzz -gamma -help -interlace \
+ -interpolate -limit -list -log -monitor -ping -quiet \
+ -regard-warnings -respect-parenthesis \
+ -sampling-factor -seed -set -size -strip -units \
+ -verbose -version -virtual-pixel' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _identify $filenames identify
+
+_montage()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \
+ -authenticate -background -blue-primary -blur -border \
+ -bordercolor -borderwidth -caption -channel -clone \
+ -coalesce -colors -colorspace -comment -compose \
+ -compress -crop -debug -define -density -depth \
+ -display -dispose -dither -draw -encoding -endian \
+ -extract -fill -filter -flatten -flip -flop -font \
+ -format -frame -gamma -geometry -gravity \
+ -green-primary -help -identify -interlace \
+ -interpolate -label -limit -list -log -mattecolor \
+ -mode -monitor -monochrome -origin -page -pointsize \
+ -polaroid -profile -quality -quantize -quiet \
+ -red-primary -regard-warnings -repage -resize \
+ -respect-parenthesis -rotate -sampling-factor -scenes \
+ -seed -set -shadow -size -strip -stroke -texture \
+ -thumbnail -tile -title -transform -transparent \
+ -transparent-color -treedepth -trim -type -units \
+ -verbose -version -virtual-pixel \
+ -white-point' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
+ +endian +gamma +label +matte +page' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _montage $filenames montage
+
+_composite()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \
+ -blend -blue-primary -border -bordercolor -channel \
+ -colors -colorspace -comment -compose -compress \
+ -debug -decipher -define -density -depth -displace \
+ -display -dispose -dissolve -dither -encipher \
+ -encoding -endian -extract -filter -font -format \
+ -geometry -gravity -green-primary -help -identify \
+ -interlace -interpolate -label -limit -list -log \
+ -monitor -monochrome -negate -page -profile -quality \
+ -quantize -quiet -red-primary -regard-warnings \
+ -repage -resize -respect-parenthesis -rotate \
+ -sampling-factor -scene -seed -sharpen -shave -size \
+ -stegano -stereo -strip -swap -thumbnail -tile \
+ -transform -transparent-color -treedepth -type -units \
+ -unsharp -verbose -version -virtual-pixel -watermark \
+ -white-point -write' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
+ +matte +negate +page +write' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _composite $filenames composite
+
+_compare()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \
+ -colorspace -compress -debug -decipher -define \
+ -density -depth -encipher -extract -format -fuzz \
+ -help -highlight-color -identify -interlace -limit \
+ -list -log -metric -monitor -passphrase -profile \
+ -quality -quantize -quiet -regard-warnings \
+ -respect-parenthesis -sampling-factor -seed -set \
+ -size -transparent-color -type -verbose -version \
+ -virtual-pixel' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _compare $filenames compare
+
+_conjure()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor -quiet \
+ -regard-warnings -seed -verbose -version' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _conjure $filenames conjure
+
+_import()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \
+ -colors -colorspace -comment -compress -crop -debug \
+ -define -delay -density -depth -descend -display \
+ -dispose -dither -encipher -encoding -endian -filter \
+ -format -frame -geometry -gravity -help -identify \
+ -interlace -interpolate -label -limit -list -log \
+ -monitor -monochrome -negate -page -pause -pointsize \
+ -quality -quantize -quiet -regard-warnings -repage \
+ -resize -respect-parenthesis -rotate -sampling-factor \
+ -scene -screen -seed -set -silent -snaps -strip \
+ -thumbnail -transparent -transparent-color -treedepth \
+ -trim -type -verbose -version -virtual-pixel \
+ -window' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _import $filenames import
+
+_stream()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _ImageMagick
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \
+ -compress -debug -define -density -depth -extract \
+ -help -identify -interlace -interpolate -limit -list \
+ -log -map -monitor -quantize -quiet -regard-warnings \
+ -respect-parenthesis -sampling-factor -seed -set \
+ -size -storage-type -transparent-color -verbose \
+ -version -virtual-pixel' -- "$cur" ) )
+ elif [[ "$cur" == +* ]]; then
+ COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _stream $filenames stream
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/info b/contrib/info
new file mode 100644
index 00000000..5d491453
--- /dev/null
+++ b/contrib/info
@@ -0,0 +1,58 @@
+# bash completion for info
+
+have info &&
+_info()
+{
+ local cur i infopath
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ _expand || return 0
+
+ # default completion if parameter contains /
+ if [[ "$cur" == */* ]]; then
+ _filedir
+ return 0
+ fi
+
+ infopath='/usr/share/info'
+
+ if [ "${INFOPATH: -1:1}" == ':' ]; then
+ infopath=${INFOPATH}${infopath}
+ elif [ ${INFOPATH:+set} ]; then
+ infopath=$INFOPATH
+ fi
+
+ infopath=$infopath:
+ if [ -n "$cur" ]; then
+ infopath="${infopath//://$cur* }"
+ else
+ infopath="${infopath//:// }"
+ fi
+
+ # redirect stderr for when path doesn't exist
+ COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
+ # weed out directory path names and paths to info pages
+ COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
+ # weed out info dir file
+ for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
+ if [ "${COMPREPLY[$i]}" == 'dir' ]; then
+ unset COMPREPLY[$i];
+ fi;
+ done
+ # strip suffix from info pages
+ COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
+
+ return 0
+} &&
+complete -F _info $filenames info
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ipmitool b/contrib/ipmitool
new file mode 100644
index 00000000..3862491c
--- /dev/null
+++ b/contrib/ipmitool
@@ -0,0 +1,39 @@
+# bash completion for ipmitool
+
+have ipmitool &&
+_ipmitool()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -I)
+ COMPREPLY=( $( compgen -W 'open imb lan lanplus free' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
+ -e -C -k -y -K -A -P -E -K -m -b -r -B -T -l -o -O' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'raw i2c spd lan chassis power event \
+ mc sdr sensor fru gendev sel pef sol tsol isol user \
+ channel session sunoem kontronoem picmg fwum firewall \
+ exec set hpm ekanalyzer' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _ipmitool ipmitool
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/iptables b/contrib/iptables
new file mode 100644
index 00000000..849fd543
--- /dev/null
+++ b/contrib/iptables
@@ -0,0 +1,70 @@
+# bash completion for iptables
+
+have iptables &&
+_iptables()
+{
+ local cur prev table chain
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ chain='s/^Chain \([^ ]\+\).*$/\1/p'
+
+ if [[ $COMP_LINE == *-t\ *filter* ]]; then
+ table="-t filter"
+ elif [[ $COMP_LINE == *-t\ *nat* ]]; then
+ table="-t nat"
+ elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
+ table="-t mangle"
+ fi
+
+ _split_longopt
+
+ case "$prev" in
+ -*[AIDRPFXLZ])
+ COMPREPLY=( $( compgen -W '`iptables $table -nL | \
+ sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
+ ;;
+ -*t)
+ COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
+ ;;
+ -j)
+ if [ "$table" = "-t filter" -o "$table" = "" ]; then
+ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
+ `iptables $table -nL | sed -ne "$chain" \
+ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
+ "$cur" ) )
+ elif [ "$table" = "-t nat" ]; then
+ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
+ MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
+ sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
+ -- "$cur" ) )
+ elif [ "$table" = "-t mangle" ]; then
+ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
+ MARK TOS `iptables $table -nL | sed -ne "$chain" \
+ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
+ "$cur" ) )
+ fi
+ ;;
+ *)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
+ --delete --insert --replace --list --flush --zero --new \
+ --delete-chain --policy --rename-chain --proto --source \
+ --destination --in-interface --jump --match --numeric \
+ --out-interface --table --verbose --line-numbers --exact \
+ --fragment --modprobe --set-counters --version' -- "$cur") )
+ fi
+ ;;
+ esac
+
+} &&
+complete -F _iptables iptables
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/isql b/contrib/isql
index fd66af58..ff4ad888 100644
--- a/contrib/isql
+++ b/contrib/isql
@@ -1,13 +1,20 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# isql completion by Victor Bogado da Silva Lins <victor@bogado.net>
+have isql &&
_isql()
{
- local cur
- cur=`_get_cword`
-
- [ -f "$ODBCINI" ] && COMPREPLY=( $( grep \\[$cur "$ODBCINI" | tr -d \\[\\] ) )
-}
+ local cur
+ cur=`_get_cword`
+
+ [ -f "$ODBCINI" ] \
+ && COMPREPLY=( $( grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
+} &&
complete -F _isql isql
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/jar b/contrib/jar
new file mode 100644
index 00000000..6ef632bf
--- /dev/null
+++ b/contrib/jar
@@ -0,0 +1,36 @@
+# jar(1) completion
+
+have jar &&
+_jar()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD = 1 ]; then
+ COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
+ return 0
+ fi
+
+ case "${COMP_WORDS[1]}" in
+ *c*f)
+ _filedir
+ ;;
+ *f)
+ _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+} &&
+complete -F _jar $filenames jar
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/java b/contrib/java
new file mode 100644
index 00000000..9b8c95d5
--- /dev/null
+++ b/contrib/java
@@ -0,0 +1,260 @@
+# bash completion for java, javac and javadoc
+
+# available path elements completion
+have java && {
+_java_path()
+{
+ cur=${cur##*:}
+ _filedir '@(jar|zip)'
+}
+
+# exact classpath determination
+_java_find_classpath()
+{
+ local i
+
+ # search first in current options
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
+ classpath=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ # default to environment
+ [ -z "$classpath" ] && classpath=$CLASSPATH
+
+ # default to current directory
+ [ -z "$classpath" ] && classpath=.
+}
+
+# exact sourcepath determination
+_java_find_sourcepath()
+{
+ local i
+
+ # search first in current options
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
+ sourcepath=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ # default to classpath
+ if [ -z "$sourcepath" ]; then
+ _java_find_classpath
+ sourcepath=$classpath
+ fi
+}
+
+# available classes completion
+_java_classes()
+{
+ local classpath i
+
+ # find which classpath to use
+ _java_find_classpath
+
+ # convert package syntax to path syntax
+ cur=${cur//.//}
+ # parse each classpath element for classes
+ for i in ${classpath//:/ }; do
+ if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
+ if type zipinfo &>/dev/null; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
+ "$i" "$cur*" 2>/dev/null | \
+ grep '^[^$]*\.class$' ) )
+ else
+ COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
+ "$cur" | grep '^[^$]*\.class$' ) )
+ fi
+
+ elif [ -d $i ]; then
+ i=${i%/}
+
+ # See Debian bug #496828
+ COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
+ -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
+ grep -v "\\$" | sed -e "s|^$i/||" ) )
+
+ # FIXME: if we have foo.class and foo/, the completion
+ # returns "foo/"... how to give precedence to files
+ # over directories?
+ fi
+ done
+
+ # remove class extension
+ COMPREPLY=( ${COMPREPLY[@]%.class} )
+ # convert path syntax to package syntax
+ COMPREPLY=( ${COMPREPLY[@]//\//.} )
+}
+
+# available packages completion
+_java_packages()
+{
+ local sourcepath i
+
+ # find which sourcepath to use
+ _java_find_sourcepath
+
+ # convert package syntax to path syntax
+ cur=${cur//.//}
+ # parse each sourcepath element for packages
+ for i in ${sourcepath//:/ }; do
+ if [ -d $i ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
+ $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
+ fi
+ done
+ # keep only packages
+ COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
+ # remove packages extension
+ COMPREPLY=( ${COMPREPLY[@]%/} )
+ # convert path syntax to package syntax
+ cur=${COMPREPLY[@]//\//.}
+}
+
+# java completion
+#
+_java()
+{
+ local cur prev i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ for ((i=1; i < $COMP_CWORD; i++)); do
+ case ${COMP_WORDS[$i]} in
+ -cp|-classpath)
+ ((i++)) # skip the classpath string.
+ ;;
+ -*)
+ # this is an option, not a class/jarfile name.
+ ;;
+ *)
+ # once we've seen a class, just do filename completion
+ _filedir
+ return 0
+ ;;
+ esac
+ done
+
+ case $prev in
+ -@(cp|classpath))
+ _java_path
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # relevant options completion
+ COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
+ -cp -classpath -D -verbose -verbose:class \
+ -verbose:gc -version:jni -version \
+ -showversion -? -help -X -jar \
+ -ea -enableassertions -da -disableassertions \
+ -esa -enablesystemassertions \
+ -dsa -disablesystemassertions ' -- "$cur" ) )
+ else
+ if [[ "$prev" == -jar ]]; then
+ # jar file completion
+ _filedir jar
+ else
+ # classes completion
+ _java_classes
+ fi
+ fi
+}
+complete -F _java $filenames java
+}
+
+have javadoc &&
+_javadoc()
+{
+ COMPREPLY=()
+ local cur prev
+
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(overview|helpfile|stylesheetfile))
+ _filedir
+ return 0
+ ;;
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
+ _java_path
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # relevant options completion
+ COMPREPLY=( $( compgen -W '-overview -public -protected \
+ -package -private -help -doclet -docletpath \
+ -sourcepath -classpath -exclude -subpackages \
+ -breakiterator -bootclasspath -source -extdirs \
+ -verbose -locale -encoding -J -d -use -version \
+ -author -docfilessubdirs -splitindex \
+ -windowtitle -doctitle -header -footer -bottom \
+ -link -linkoffline -excludedocfilessubdir \
+ -group -nocomment -nodeprecated -noqualifier \
+ -nosince -nodeprecatedlist -notree -noindex \
+ -nohelp -nonavbar -quiet -serialwarn -tag \
+ -taglet -tagletpath -charset -helpfile \
+ -linksource -stylesheetfile -docencoding' -- "$cur" ) )
+ else
+ # source files completion
+ _filedir java
+ # packages completion
+ _java_packages
+ fi
+} &&
+complete -F _javadoc $filenames javadoc
+
+have javac &&
+_javac()
+{
+ COMPREPLY=()
+ local cur prev
+
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -@(classpath|bootclasspath|sourcepath|extdirs))
+ _java_path
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # relevant options completion
+ COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
+ -g:source -O -nowarn -verbose -deprecation -classpath\
+ -sourcepath -bootclasspath -extdirs -d -encoding -source\
+ -target -help' -- "$cur" ) )
+ else
+ # source files completion
+ _filedir java
+ fi
+} &&
+complete -F _javac $filenames javac
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/kldload b/contrib/kldload
new file mode 100644
index 00000000..36207afb
--- /dev/null
+++ b/contrib/kldload
@@ -0,0 +1,38 @@
+# bash completion for FreeBSD kernel module commands
+
+[ $UNAME = FreeBSD ] &&
+{
+
+_kldload()
+{
+ local cur moddir
+
+ moddir=/modules/
+ [ -d $moddir ] || moddir=/boot/kernel/
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -f "$moddir$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]#$moddir} )
+ COMPREPLY=( ${COMPREPLY[@]%.ko} )
+
+ return 0
+}
+complete -F _kldload $filenames kldload
+
+_kldunload()
+{
+ local cur
+ cur=`_get_cword`
+ COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
+}
+complete -F _kldunload $filenames kldunload
+
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/larch b/contrib/larch
index 3ec04014..c3a55199 100644
--- a/contrib/larch
+++ b/contrib/larch
@@ -1,39 +1,49 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# larch(1) completion by Alex Shinn <foof@synthcode.com>
+have larch &&
_larch()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
- COMPREPLY=( $( compgen -W ' \
-my-id my-default-archive register-archive whereis-archive archives \
-init-tree tree-root tree-version set-tree-version inventory tagging-method \
-tree-lint missing-tags add delete move explicit-default set-manifest \
-manifest check-manifest mkpatch dopatch patch-report empty-patch \
-make-archive make-category make-branch make-version categories \
-branches versions revisions cat-archive-log archive-cache-revision \
-archive-cached-revisions archive-uncache-revision category-readme \
-branch-readme version-readme make-log logs add-log log-ls cat-log \
-log-header-field changelog log-for-merge merge-points new-on-branch \
-import commit get get-patch lock-branch lock-revision push-mirror \
-build-config update-config replay-config record-config show-config \
-config-history update replay delta-patch star-merge tag prepare-branch \
-finish-branch join-branch whats-missing what-changed file-diffs pristines \
-lock-pristine my-revision-library library-find library-add library-remove \
-library-archives library-categories library-branches library-versions \
-library-revisions library-log library-file touched-files-prereqs \
-patch-set-web update-distributions distribution-name notify my-notifier \
-mail-new-categories mail-new-branches mail-new-versions mail-new-revisions \
-notify-library notify-browser push-new-revisions sendmail-mailx' $cur ))
- fi
+ if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
+ COMPREPLY=( $( compgen -W ' \
+ my-id my-default-archive register-archive whereis-archive archives \
+ init-tree tree-root tree-version set-tree-version inventory \
+ tagging-method tree-lint missing-tags add delete \
+ move explicit-default set-manifest manifest check-manifest mkpatch \
+ dopatch patch-report empty-patch make-archive make-category \
+ make-branch make-version categories branches versions revisions \
+ cat-archive-log archive-cache-revision archive-cached-revisions \
+ archive-uncache-revision category-readme branch-readme \
+ version-readme make-log logs add-log log-ls cat-log \
+ log-header-field changelog log-for-merge merge-points \
+ new-on-branch import commit get get-patch lock-branch \
+ lock-revision push-mirror build-config update-config replay-config \
+ record-config show-config config-history update replay delta-patch \
+ star-merge tag prepare-branch finish-branch join-branch \
+ whats-missing what-changed file-diffs pristines lock-pristine \
+ my-revision-library library-find library-add library-remove \
+ library-archives library-categories library-branches \
+ library-versions library-revisions library-log library-file \
+ touched-files-prereqs patch-set-web update-distributions \
+ distribution-name notify my-notifier mail-new-categories \
+ mail-new-branches mail-new-versions mail-new-revisions \
+ notify-library notify-browser push-new-revisions sendmail-mailx' \
+ "$cur" ))
+ fi
- return 0
-}
-complete -F _larch -o default larch
+ return 0
+} &&
+complete -F _larch $default larch
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ldapvi b/contrib/ldapvi
new file mode 100644
index 00000000..e006f56e
--- /dev/null
+++ b/contrib/ldapvi
@@ -0,0 +1,73 @@
+# bash completion for ldapvi
+
+have ldapvi &&
+_ldapvi()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(h|-host))
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -@(Y|-sasl-mech))
+ COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 \
+ CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) )
+ return 0
+ ;;
+ --bind)
+ COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) )
+ return 0
+ ;;
+ --bind-dialog)
+ COMPREPLY=( $( compgen -W 'never auto always' -- $cur ) )
+ return 0
+ ;;
+ --scope)
+ COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) )
+ return 0
+ ;;
+ --deref)
+ COMPREPLY=( $( compgen -W 'never searching finding always' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --encoding)
+ COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) )
+ return 0
+ ;;
+ --tls)
+ COMPREPLY=( $( compgen -W 'never allow try strict' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--discover --out --in --delete \
+ --rename -h --host -D --user -w --password --bind \
+ --bind-dialog -I --sasl-interactive --bind-dialog -O \
+ --sasl-secprops -Q --sasl-quiet -R --sasl-realm -U \
+ --sasl-authcid -X --sasl-authzid -Y --sasl-mech -b \
+ --base -s --scope -S --sort --add -o --class --config \
+ -c --continue --deleteoldrdn -a --deref -d --discover \
+ -A --empty --ncoding -H --help --ldap-conf -m --may -M \
+ --managedsait --noquestions -! --noninteractive -q \
+ --quiet -R --read -Z --starttls --tls -v --verbose \
+ --ldapsearch --ldapmodify --ldapdelete --ldapmoddn' \
+ -- "$cur" ) )
+ fi
+} &&
+complete -F _ldapvi ldapvi
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lftp b/contrib/lftp
new file mode 100644
index 00000000..feb8af62
--- /dev/null
+++ b/contrib/lftp
@@ -0,0 +1,26 @@
+# bash completion for lftp
+
+have lftp &&
+_lftp()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
+ COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
+ ~/.lftp/bookmarks )' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _lftp $default lftp
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lilo b/contrib/lilo
new file mode 100644
index 00000000..afff3722
--- /dev/null
+++ b/contrib/lilo
@@ -0,0 +1,61 @@
+# bash completion for lilo(8)
+
+have lilo && {
+_lilo_labels()
+{
+ COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \
+ /etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) )
+}
+
+_lilo()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(C|i|m|s|S))
+ _filedir
+ return 0
+ ;;
+ -r)
+ _filedir -d
+ return 0
+ ;;
+ -@(I|D|R))
+ # label completion
+ _lilo_labels
+ return 0
+ ;;
+ -@(A|b|M|u|U))
+ # device completion
+ cur=${cur:=/dev/}
+ _filedir
+ return 0
+ ;;
+ -T)
+ # topic completion
+ COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
+ table= video' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # relevant options completion
+ COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
+ -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur" ) )
+ fi
+}
+complete -F _lilo lilo
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lilypond b/contrib/lilypond
deleted file mode 100644
index 9c523efd..00000000
--- a/contrib/lilypond
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
-# lilypond completion by Laurent Martelli <laurent@bearteam.org>
-
-complete -f -X '!*.ly' lilypond ly2dvi
diff --git a/contrib/links b/contrib/links
new file mode 100644
index 00000000..b2b41cff
--- /dev/null
+++ b/contrib/links
@@ -0,0 +1,43 @@
+# bash completion for links
+
+have links &&
+_links()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ case "$cur" in
+ --*)
+ COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
+ ;;
+ -*)
+ COMPREPLY=( $( compgen -W '-async-dns -max-connections \
+ -max-connections-to-host -retries -receive-timeout \
+ -unrestartable-receive-timeout -format-cache-size \
+ -memory-cache-size -http-proxy -ftp-proxy -download-dir \
+ -assume-codepage -anonymous -dump -no-connect \
+ -source -version -help' -- "$cur" ) )
+ ;;
+ *)
+ if [ -r ~/.links/links.his ]; then
+ COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
+ -- "$cur" ) )
+ fi
+ _filedir '@(htm|html)'
+ return 0
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _links $filenames links
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lisp b/contrib/lisp
index be8e1f92..cf9e2f8b 100644
--- a/contrib/lisp
+++ b/contrib/lisp
@@ -1,9 +1,7 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
+have lisp &&
_lisp()
{
local cur
@@ -13,14 +11,21 @@ _lisp()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \
- -dynamic-space-size -hinit -noinit -nositeinit -load \
- -slave ' \
- -- $cur ) )
+ COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \
+ -dynamic-space-size -hinit -noinit -nositeinit -load -slave ' \
+ -- "$cur" ) )
else
- _filedir
+ _filedir
fi
return 0
-}
-complete -F _lisp -o default lisp
+} &&
+complete -F _lisp $default lisp
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lvm b/contrib/lvm
new file mode 100644
index 00000000..647564ab
--- /dev/null
+++ b/contrib/lvm
@@ -0,0 +1,1128 @@
+# bash completion for lvm
+
+have lvm && {
+_volumegroups()
+{
+ COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
+ sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) )
+}
+
+_physicalvolumes()
+{
+ COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
+ sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) )
+}
+
+_logicalvolumes()
+{
+ COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
+ sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) )
+}
+
+_units()
+{
+ COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) )
+}
+
+_sizes()
+{
+ COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) )
+}
+
+_args()
+{
+ args=0
+ if [[ "${COMP_WORDS[0]}" == lvm ]]; then
+ offset=2
+ else
+ offset=1
+ fi
+ for (( i=$offset; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ args=$(($args + 1))
+ fi
+ done
+}
+
+_lvmdiskscan()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
+ --lvmpartition -v --verbose --version' -- "$cur" ) )
+ fi
+}
+complete -F _lvmdiskscan lvmdiskscan
+
+_pvscan()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -e \
+ --exported -n --novolumegroup -h -? \
+ --help --ignorelockingfailure -P \
+ --partial -s --short -u --uuid -v \
+ --verbose --version' -- "$cur" ) )
+ fi
+}
+complete -F _pvscan pvscan
+
+_pvs()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(o|O|-options|-sort))
+ COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
+ pv_size pv_free pv_used pv_name \
+ pv_attr pv_pe_count \
+ pv_pe_alloc_count' -- "$cur" ) )
+ return 0
+ ;;
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
+ -h -? --help --ignorelockingfailure --noheadings \
+ --nosuffix -o --options -O --sort \
+ --separator --unbuffered --units \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvs pvs
+
+_pvdisplay()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
+ -v --verbose -d --debug -h --help --version' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvdisplay pvdisplay
+
+_pvchange()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|x|-autobackup|--allocatable))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
+ -d --debug -h --help -t --test -u --uuid -x \
+ --allocatable -v --verbose --addtag --deltag \
+ --version' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvchange pvchange
+
+_pvcreate()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --restorefile)
+ _filedir
+ return 0
+ ;;
+ -@(M|-metadatatype))
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return 0
+ ;;
+ --metadatacopies)
+ COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
+ return 0
+ ;;
+ --@(metadatasize|setphysicalvolumesize))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
+ --force -h -? --help --labelsector -M --metadatatype \
+ --metadatacopies --metadatasize \
+ --setphysicalvolumesize -t --test -u --uuid uuid -v \
+ --verbose -y --yes --version' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvcreate pvcreate
+
+_pvmove()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(n|-name))
+ _logicalvolumes
+ return 0
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--abort -A --autobackup \
+ -b --background -d --debug -f --force -h -? \
+ --help -i --interval -t --test -v --verbose \
+ --version -n --name' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvmove pvmove
+
+_pvremove()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
+ --help -y --yes -t --test -v --verbose \
+ --version' -- "$cur" ) )
+ else
+ _physicalvolumes
+ fi
+}
+complete -F _pvremove pvremove
+
+_vgscan()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h --help \
+ --ignorelockingfailure --mknodes -P \
+ --partial -v --verbose --version' -- "$cur" ) )
+ fi
+}
+complete -F _vgscan vgscan
+
+_vgs()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(o|O|-options|-sort))
+ COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
+ vg_attr vg_size vg_free vg_sysid \
+ vg_extent_size vg_extent_count vg_free_count \
+ max_lv max_pv pv_count lv_count snap_count \
+ vg_seqno' -- "$cur" ) )
+ return 0
+ ;;
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--aligned -d --debug \
+ -h --help --ignorelockingfailure --noheadings \
+ --nosuffix -o --options -O --sort -P --partial \
+ --separator --unbuffered --units \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgs vgs
+
+_vgdisplay()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
+ -P --partial -A --activevolumegroups -v --verbose \
+ -d --debug -h --help --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgdisplay vgdisplay
+
+_vgchange()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(a|A|x|-available|-autobackup|-resizeable))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
+ --partial -d --debug -h --help --ignorelockingfailure \
+ -t --test -u --uuid -v --verbose --version -a \
+ --available -x --resizeable -l --logicalvolume \
+ --addtag --deltag' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgchange vgchange
+
+_vgcreate()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(M|-metadatatype))
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return 0
+ ;;
+ -@(s|-physicalextentsize))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc -d \
+ --debug -h --help -l --maxlogicalvolumes -M --metadatatype -p \
+ --maxphysicalvolumes -s --physicalextentsize -t --test -v \
+ --verbose --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _volumegroups
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _vgcreate vgcreate
+
+_vgremove()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgremove vgremove
+
+_vgrename()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
+ -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgrename vgrename
+
+_vgreduce()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
+ --debug -h --help --removemissing -t --test -v \
+ --verbose --version' -- "$cur" ) )
+
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _volumegroups
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _vgreduce vgreduce
+
+_vgextend()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(L|-size))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
+ -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _volumegroups
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _vgextend vgextend
+
+_vgport()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
+ -? --help -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgport vgimport vgexport
+
+_vgck()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h \
+ -? --help -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgck vgck
+
+_vgconvert()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(M|-metadatatype))
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return 0
+ ;;
+ --metadatacopies)
+ COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
+ return 0
+ ;;
+ --metadatasize)
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
+ -M --metadatatype --metadatacopies --metadatasize \
+ -t --test -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgconvert vgconvert
+
+_vgcfgbackup()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(f|-file))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
+ --ignorelockingfailure -P --partial -v --verbose \
+ --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgcfgbackup vgcfgbackup
+
+_vgcfgrestore()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(f|-file))
+ _filedir
+ return 0
+ ;;
+ -@(M|-metadatatype))
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return 0
+ ;;
+ -@(n|-name))
+ _volumegroups
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
+ -h --help -M --Metadatatype -n --name -t --test \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgcfgrestore vgcfgrestore
+
+_vgmerge()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h --help -l \
+ --list -t --test -v --verbose --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgmerge vgmerge
+
+_vgsplit()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(M|-metadatatype))
+ COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
+ -h --help -l --list -M --metadatatype -t --test \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 -o $args -eq 1 ]; then
+ _volumegroups
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _vgsplit vgsplit
+
+_vgmknodes()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
+ --version' -- "$cur" ) )
+ else
+ _volumegroups
+ fi
+}
+complete -F _vgmknodes vgmknodes
+
+_lvscan()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
+ -h -? --help --ignorelockingfailure -P \
+ --partial -v --verbose --version' -- "$cur" ) )
+ fi
+}
+complete -F _lvscan lvscan
+
+_lvs()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(o|O|-options|-sort))
+ COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor \
+ lv_size seg_count origin snap_percent segtype stripes \
+ stripesize chunksize seg_start seg_size' -- "$cur" ) )
+ return 0
+ ;;
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--aligned -d --debug -h --help \
+ --ignorelockingfailure --noheadings --nosuffix -o --options -O \
+ --sort -P --partial --segments --separator --unbuffered --units \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvs lvs
+
+_lvdisplay()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --units)
+ _units
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
+ -P --partial -m --maps -v --verbose -d --debug -h \
+ --help --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvdisplay lvdisplay
+
+_lvchange()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(p|-permission))
+ COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
+ --addtag --alloc -C --contiguous -d --debug --deltag \
+ -f --force -h --help --ignorelockingfailure -M \
+ --persistent --major major --minor minor -P --partial \
+ -p --permission -r --readahead --refresh -t --test \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvchange lvchange
+
+_lvcreate()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(L|-size))
+ _sizes
+ return 0
+ ;;
+ -@(p|-permission))
+ COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
+ return 0
+ ;;
+ -@(n|-name))
+ _logicalvolumes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
+ -C --contiguous -d --debug -h -? --help -i --stripes \
+ -I --stripesize -l --extents -L --size -M --persistent \
+ --major --minor -n --name -p --permission -r \
+ --readahead -t --test --type -v --verbose -Z --zero \
+ --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _volumegroups
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _lvcreate lvcreate
+
+_lvremove()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
+ --force -h -? --help -t --test -v --verbose \
+ --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvremove lvremove
+
+_lvrename()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
+ -? --help -t --test -v --verbose --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvrename lvrename
+
+_lvreduce()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(L|-size))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup -d \
+ --debug -f --force -h --help -l --extents \
+ -L --size -n --nofsck -r --resizefs -t --test \
+ -v --verbose --version' -- "$cur" ) )
+ else
+ _logicalvolumes
+ fi
+}
+complete -F _lvreduce lvreduce
+
+_lvresize()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(L|-size))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
+ --debug -h --help -i --stripes -I --stripesize \
+ -l --extents -L --size -n --nofsck -r --resizefs \
+ -t --test --type -v --verbose --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _logicalvolumes
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _lvresize lvresize
+
+_lvextend()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(A|-autobackup))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ -@(L|-size))
+ _sizes
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
+ --debug -h --help -i --stripes -I --stripesize \
+ -l --extents -L --size -n --nofsck -r --resizefs \
+ -t --test --type -v --verbose --version' -- "$cur" ) )
+ else
+ _args
+ if [ $args -eq 0 ]; then
+ _logicalvolumes
+ else
+ _physicalvolumes
+ fi
+ fi
+}
+complete -F _lvextend lvextend
+
+_lvm()
+{
+ local prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
+ lvcreate lvdisplay lvextend lvmchange \
+ lvmdiskscan lvmsadc lvmsar lvreduce \
+ lvremove lvrename lvresize lvs lvscan \
+ pvchange pvcreate pvdata pvdisplay pvmove \
+ pvremove pvresize pvs pvscan vgcfgbackup \
+ vgcfgrestore vgchange vgck vgconvert \
+ vgcreate vgdisplay vgexport vgextend \
+ vgimport vgmerge vgmknodes vgreduce \
+ vgremove vgrename vgs vgscan vgsplit \
+ version' -- "$cur" ) )
+ else
+ case ${COMP_WORDS[1]} in
+ pvchange)
+ _pvchange
+ ;;
+ pvcreate)
+ _pvcreate
+ ;;
+ pvdisplay)
+ _pvdisplay
+ ;;
+ pvmove)
+ _pvmove
+ ;;
+ pvremove)
+ _pvremove
+ ;;
+ pvresize)
+ _pvresize
+ ;;
+ pvs)
+ _pvs
+ ;;
+ pvscan)
+ _pvscan
+ ;;
+ vgcfgbackup)
+ _vgcfgbackup
+ ;;
+ vgcfgrestore)
+ _vgcfgrestore
+ ;;
+ vgchange)
+ _vgchange
+ ;;
+ vgck)
+ _vgck
+ ;;
+ vgconvert)
+ _vgconvert
+ ;;
+ vgcreate)
+ _vgcreate
+ ;;
+ vgdisplay)
+ _vgdisplay
+ ;;
+ vgexport)
+ _vgexport
+ ;;
+ vgextend)
+ _vgextend
+ ;;
+ vgimport)
+ _vgimport
+ ;;
+ vgmerge)
+ _vgmerge
+ ;;
+ vgmknodes)
+ _vgmknodes
+ ;;
+ vgreduce)
+ _vgreduce
+ ;;
+ vgremove)
+ _vgremove
+ ;;
+ vgrename)
+ _vgrename
+ ;;
+ vgs)
+ _vgs
+ ;;
+ vgscan)
+ _vgscan
+ ;;
+ vgsplit)
+ _vgsplit
+ ;;
+ lvchange)
+ _lvchange
+ ;;
+ lvcreate)
+ _lvcreate
+ ;;
+ lvdisplay)
+ _lvdisplay
+ ;;
+ lvextend)
+ _lvextend
+ ;;
+ lvreduce)
+ _lvreduce
+ ;;
+ lvremove)
+ _lvremove
+ ;;
+ lvrename)
+ _lvrename
+ ;;
+ lvresize)
+ _lvresize
+ ;;
+ lvs)
+ _lvs
+ ;;
+ lvscan)
+ _lvscan
+ ;;
+ esac
+ fi
+}
+complete -F _lvm lvm
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lzma b/contrib/lzma
index 99005bc8..42d2bfb1 100644
--- a/contrib/lzma
+++ b/contrib/lzma
@@ -1,42 +1,47 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# lzma(1) completion by Per Øyvind Karlsen <peroyvind@mandriva.org>
-#
+
have lzma &&
_lzma()
{
- local cur prev xspec
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
- -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
- --help --decompress --compress --keep --force \
- --test --stdout --quiet --verbose --license \
- --version --small --fast --best --text' -- $cur ) )
- return 0
- fi
-
- local IFS=$'\t\n'
-
- xspec="*.lzma"
- if [[ "$prev" == --* ]]; then
- [[ "$prev" == --decompress || \
- "$prev" == --list || \
- "$prev" == --test ]] && xspec="!"$xspec
- [[ "$prev" == --compress ]] && xspec=
- elif [[ "$prev" == -* ]]; then
- [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
- [[ "$prev" == -*z* ]] && xspec=
- fi
-
- _expand || return 0
-
- COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
- $( compgen -d -- $cur ) )
+ local cur prev xspec
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
+ -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
+ --help --decompress --compress --keep --force \
+ --test --stdout --quiet --verbose --license \
+ --version --small --fast --best --text' -- "$cur" ) )
+ return 0
+ fi
+
+ local IFS=$'\t\n'
+
+ xspec="*.lzma"
+ if [[ "$prev" == --* ]]; then
+ [[ "$prev" == --decompress || \
+ "$prev" == --list || \
+ "$prev" == --test ]] && xspec="!"$xspec
+ [[ "$prev" == --compress ]] && xspec=
+ elif [[ "$prev" == -* ]]; then
+ [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
+ [[ "$prev" == -*z* ]] && xspec=
+ fi
+
+ _expand || return 0
+
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
} &&
complete -F _lzma $filenames lzma
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/lzop b/contrib/lzop
index 59a7a429..9090bac4 100644
--- a/contrib/lzop
+++ b/contrib/lzop
@@ -1,53 +1,74 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# lzop(1) completion
have lzop &&
_lzop()
{
- local cur prev xspec
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # TODO: -p: takes a dir argument, without a separating space
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \
- -4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \
- -S --fast --best --decompress --uncompress --extract \
- --test --list --ls --info --sysinfo --license --help \
- --version --stdout --to-stdout --output --path \
- --force --no-checksum --no-name --name --no-mode \
- --no-time --suffix --keep --unlink --delete --crc32 \
- --no-warn --ignore-warn --quiet --silent --verbose \
- --no-stdin --filter --checksum --no-color --mono \
- --color' -- $cur ) )
- return 0
- fi
-
- case "$prev" in
- -o|--output) _filedir ; return 0 ;;
- --path) _filedir -d ; return 0 ;;
- -S|--suffix) return 0 ;;
- esac
-
- xspec="*.?(t)lzo"
- case "$prev" in
- --@(@(de|un)compress|extract|list|ls|info|test))
- xspec="!"$xspec ;;
- --force) xspec= ;;
- --*) ;;
- -*f*|'<'|'>') xspec= ;;
- -*[dltx]*) xspec="!"$xspec ;;
- esac
-
- _expand || return 0
-
- local IFS=$'\t\n'
- COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
- $( compgen -d -- $cur ) )
+ local cur prev xspec
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ # TODO: -p: takes a dir argument, without a separating space
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \
+ -4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \
+ -S --fast --best --decompress --uncompress --extract \
+ --test --list --ls --info --sysinfo --license --help \
+ --version --stdout --to-stdout --output --path \
+ --force --no-checksum --no-name --name --no-mode \
+ --no-time --suffix --keep --unlink --delete --crc32 \
+ --no-warn --ignore-warn --quiet --silent --verbose \
+ --no-stdin --filter --checksum --no-color --mono \
+ --color' -- "$cur" ) )
+ return 0
+ fi
+
+ case "$prev" in
+ -o|--output)
+ _filedir
+ return 0
+ ;;
+ --path)
+ _filedir -d
+ return 0
+ ;;
+ -S|--suffix)
+ return 0
+ ;;
+ esac
+
+ xspec="*.?(t)lzo"
+ case "$prev" in
+ --@(@(de|un)compress|extract|list|ls|info|test))
+ xspec="!"$xspec
+ ;;
+ --force)
+ xspec=
+ ;;
+ --*)
+ ;;
+ -*f*|'<'|'>')
+ xspec=
+ ;;
+ -*[dltx]*)
+ xspec="!"$xspec
+ ;;
+ esac
+
+ _expand || return 0
+
+ local IFS=$'\t\n'
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
} &&
complete -F _lzop $filenames lzop
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mailman b/contrib/mailman
index 45b7db36..8cfec3e8 100644
--- a/contrib/mailman
+++ b/contrib/mailman
@@ -1,533 +1,601 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# Mailman completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+have list_lists && {
_mailman_lists()
{
- COMPREPLY=( $( list_lists -b | grep "^$cur") )
+ COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) )
}
-_add_members()
+_list_lists()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(r|d|-regular-members-file=|-digest-members-file=))
- _filedir
- return 0
- ;;
- -@(w|a|-welcome-msg=|-admin-notify=))
- COMPREPLY=( $( compgen -W 'y n' -- $cur) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--regular-members-file= -r \
- --digest-members-file= -d --welcome-msg= -w \
- --admin-notify= -a --help -h' -- $cur ) )
- else
- _mailman_lists
- fi
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --advertised --virtual-host-overview -V \
+ -b --bare -h --help' -- "$cur" ) )
+ fi
+} &&
+complete -F _list_lists list_lists
}
+
+have add_members &&
+_add_members()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -@(r|d|-regular-members-file|-digest-members-file))
+ _filedir
+ return 0
+ ;;
+ -@(w|a|-welcome-msg|-admin-notify))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--regular-members-file -r \
+ --digest-members-file -d --welcome-msg -w \
+ --admin-notify -a --help -h' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
+
+} &&
complete -F _add_members add_members
+have remove_members &&
_remove_members()
{
+ local cur prev split=false
- local cur prev
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
- case "$prev" in
- -@(f|-file=))
- _filedir
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(f|-file))
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--file= -f --all -a \
- --fromall --nouserack -n --noadminack -N \
- --help -h' -- $cur ) )
- else
- _mailman_lists
- fi
+ $split && return 0
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--file -f --all -a --fromall --nouserack -n \
+ --noadminack -N --help -h' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
+
+} &&
complete -F _remove_members remove_members
+have find_member &&
_find_member()
{
+ local cur prev split=false
- local cur prev
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
- case "$prev" in
- -@(l|x|-listname=|-exclude=))
- _mailman_lists
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(l|x|-listname|-exclude))
+ _mailman_lists
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname= -x \
- --exclude= --owners -w --help -h' -- $cur ) )
- fi
+ $split && return 0
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --listname -x --exclude --owners -w \
+ --help -h' -- "$cur" ) )
+ fi
+
+} &&
complete -F _find_member find_member
+have clone_member &&
_clone_member()
{
+ local cur prev split=false
- local cur prev
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
- case "$prev" in
- -@(l|-listname=))
- _mailman_lists
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(l|-listname))
+ _mailman_lists
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname= --remove -r \
- --admin -a --quiet -q --nomodify -n --help -h' -- $cur ) )
- fi
+ $split && return 0
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --listname --remove -r --admin -a \
+ --quiet -q --nomodify -n --help -h' -- "$cur" ) )
+ fi
+
+} &&
complete -F _clone_member clone_member
+have sync_members &&
_sync_members()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
- COMPREPLY=( $( compgen -W 'y n' -- $cur) )
- return 0
- ;;
- -@(d|-file))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg= -w \
- --goodbye-msg= -g --digest= -d --notifyadmin= -a \
- -f --file -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
-
-}
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
+ return 0
+ ;;
+ -@(d|-file))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \
+ --goodbye-msg -g --digest -d --notifyadmin -a -f --file -h --help' \
+ -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
+
+} &&
complete -F _sync_members sync_members
-_list_lists()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --advertised \
- --virtual-host-overview= -V -b --bare \
- -h --help' -- $cur ) )
- fi
-
-}
-complete -F _list_lists list_lists
-
+have unshunt &&
_unshunt()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h --help' -- $cur ) )
- else
- _filedir -d
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
-}
+} &&
complete -F _unshunt unshunt
+have list_admins &&
_list_admins()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all-vhost= -v \
- --all -a -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all-vhost -v --all -a -h --help' \
+ -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _list_admins list_admins
+have list_owners &&
_list_owners()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-w --with-listnames \
- -m --moderators -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-w --with-listnames -m --moderators -h \
+ --help' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _list_owners list_owners
+have list_members &&
_list_members()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(o|-output))
- _filedir
- return 0
- ;;
- -@(d|-digest=))
- COMPREPLY=( $( compgen -W 'mime plain' -- $cur) )
- return 0
- ;;
- -@(n|-nomail=))
- COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- $cur) )
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--output -o --regular -r \
- --digest= -d --nomail= -n --fullnames -f \
- --preserve -p -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
-
-}
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -@(o|-output))
+ _filedir
+ return 0
+ ;;
+ -@(d|-digest))
+ COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") )
+ return 0
+ ;;
+ -@(n|-nomail))
+ COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \
+ -- "$cur") )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--output -o --regular -r --digest -d \
+ --nomail -n --fullnames -f --preserve -p -h --help' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
+
+} &&
complete -F _list_members list_members
+have change_pw &&
_change_pw()
{
- local cur prev
+ local cur prev split=false
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(l|-listname=))
- _mailman_lists
- return 0
- ;;
- esac
+ _split_longopt && split=true
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all --domain= -d --listname= -l \
- --password= -p --quiet -q -h --help' -- $cur ) )
- fi
+ case "$prev" in
+ -@(l|-listname))
+ _mailman_lists
+ return 0
+ ;;
+ esac
-}
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \
+ --password -p --quiet -q -h --help' -- "$cur" ) )
+ fi
+
+} &&
complete -F _change_pw change_pw
+have withlist &&
_withlist()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --lock -i --interactive \
- -r --run -a --all -q --quiet -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --lock -i --interactive \
+ -r --run -a --all -q --quiet -h --help' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _withlist withlist
+have newlist &&
_newlist()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' \
+ -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _newlist newlist
+have rmlist &&
_rmlist()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--archives -a \
- -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--archives -a -h --help' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _rmlist rmlist
+have config_list &&
_config_list()
{
- local cur prev
+ local cur prev split=false
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(i|o|-inputfile|-outputfile))
- _filedir
- return 0
- ;;
- esac
+ _split_longopt && split=true
+ case "$prev" in
+ -@(i|o|-inputfile|-outputfile))
+ _filedir
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \
- --checkonly -c --verbose -v -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ $split && return 0
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \
+ --checkonly -c --verbose -v -h --help' -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
+
+} &&
complete -F _config_list $filenames config_list
+have arch &&
_arch()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
- COMPREPLY=( $( compgen -W 'y n' -- $cur) )
- return 0
- ;;
- -@(d|-file))
- _filedir
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--wipe -s --start= -e --end= \
- -q --quiet -h --help' -- $cur ) )
- else
- args=$COMP_CWORD
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -* ]]; then
- args=$(($args-1))
- fi
- done
- case $args in
- 1)
- _mailman_lists
- ;;
- 2)
- _filedir
- ;;
- esac
- fi
-
-}
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
+ return 0
+ ;;
+ -@(d|-file))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--wipe -s --start -e --end -q --quiet -h \
+ --help' -- "$cur" ) )
+ else
+ args=$COMP_CWORD
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -* ]]; then
+ args=$(($args-1))
+ fi
+ done
+ case $args in
+ 1)
+ _mailman_lists
+ ;;
+ 2)
+ _filedir
+ ;;
+ esac
+ fi
+
+} &&
complete -F _arch $filenames arch
+have cleanarch &&
_cleanarch()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s --status -n --dry-run \
- -q --quiet -h --help' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s --status -n --dry-run -q --quiet -h \
+ --help' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _cleanarch cleanarch
+have inject &&
_inject()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(l|-listname=))
- _mailman_lists
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --listname= -q --queue= \
- -h --help' -- $cur ) )
- else
- _filedir
- fi
+ local cur prev split=false
-}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -@(l|-listname))
+ _mailman_lists
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --listname -q --queue -h --help' \
+ -- "$cur" ) )
+ else
+ _filedir
+ fi
+
+} &&
complete -F _inject $filenames inject
+have dumpdb &&
_dumpdb()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- $cur ) )
- else
- _filedir
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h \
+ --help' -- "$cur" ) )
+ else
+ _filedir
+ fi
-}
+} &&
complete -F _dumpdb $filenames dumpdb
+have check_db &&
_check_db()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--all -a --verbose -v \
- -h --help' -- $cur ) )
- else
- _mailman_lists
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--all -a --verbose -v -h --help' \
+ -- "$cur" ) )
+ else
+ _mailman_lists
+ fi
-}
+} &&
complete -F _check_db check_db
+have check_perms &&
_check_perms()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-f -v -h' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _check_perms check_perms
+have genaliases &&
_genaliases()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _genaliases genaliases
+have mmsitepass &&
_mmsitepass()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _mmsitepass mmsitepass
+have qrunner &&
_qrunner()
{
- local cur
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --runner= --once -o \
- -l --list -v --verbose -s --subproc -h --help' -- $cur ) )
- fi
+ _split_longopt && return 0
-}
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r --runner --once -o \
+ -l --list -v --verbose -s --subproc -h --help' -- "$cur" ) )
+ fi
+
+} &&
complete -F _qrunner qrunner
+have mailmanctl &&
_mailmanctl()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \
- -s --stale-lock-cleanup --quiet -q -h --help' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W 'start stop restart reopen' -- $cur ) )
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \
+ -s --stale-lock-cleanup --quiet -q -h --help' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) )
+ fi
-}
+} &&
complete -F _mailmanctl mailmanctl
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/make b/contrib/make
new file mode 100644
index 00000000..ecbd56e3
--- /dev/null
+++ b/contrib/make
@@ -0,0 +1,79 @@
+# bash completion for GNU make
+
+have make || have gmake || have gnumake || have pmake &&
+_make()
+{
+ local file makef makef_dir="." makef_inc cur prev i split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -@(f|o|W|-@(?(make|old-|new-)file|assume-@(old|new)|what-if)))
+ _filedir
+ return 0
+ ;;
+ -I|-C|--directory|--include-dir)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
+ -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
+ --always-make --directory --debug \
+ --environment-overrides --file --makefile --help \
+ --ignore-errors --include-dir --jobs --load-average \
+ --max-load --keep-going --just-print --dry-run \
+ --recon --old-file --assume-old --print-data-base \
+ --question --no-builtin-rules --no-builtin-variables \
+ --silent --quiet --no-keep-goind --stop --touch \
+ --version --print-directory --no-print-directory \
+ --what-if --new-file --assume-new \
+ --warn-undefined-variables' -- "$cur" ) )
+ else
+ # before we check for makefiles, see if a path was specified
+ # with -C
+ for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -C ]]; then
+ # eval for tilde expansion
+ eval makef_dir=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ # before we scan for targets, see if a Makefile name was
+ # specified with -f
+ for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -f ]]; then
+ # eval for tilde expansion
+ eval makef=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ [ -n "$makef" ] && makef="-f ${makef}"
+ [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
+
+ COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \
+ awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
+ {split($1,A,/ /);for(i in A)print A[i]}' )" \
+ -- "$cur" ) )
+
+ fi
+} &&
+complete -F _make $filenames make gmake gnumake pmake
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/man b/contrib/man
new file mode 100644
index 00000000..4804a949
--- /dev/null
+++ b/contrib/man
@@ -0,0 +1,83 @@
+# man(1) completion
+
+[ $USERLAND = GNU -o $UNAME = Darwin \
+ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
+ -o $UNAME = OpenBSD ] &&
+_man()
+{
+ local cur i prev sect manpath manext mansect uname
+
+ manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@(gz|bz2|lzma))"
+ mansect="@([0-9lnp]|[0-9][px]|3pm)"
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ "$prev" == -l ]]; then
+ _filedir $manext
+ return 0
+ fi
+
+ _expand || return 0
+
+ # file based completion if parameter contains /
+ if [[ "$cur" == */* ]]; then
+ _filedir $manext
+ return 0
+ fi
+
+ uname=$( uname -s )
+ if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
+ manpath=$( manpath 2>/dev/null || command man --path )
+ else
+ manpath=$MANPATH
+ fi
+
+ if [ -z "$manpath" ]; then
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ fi
+
+ # determine manual section to search
+ [[ "$prev" == $mansect ]] && sect=$prev || sect='*'
+
+ manpath=$manpath:
+ if [ -n "$cur" ]; then
+ manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
+ else
+ manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
+ fi
+
+ # redirect stderr for when path doesn't exist
+ COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
+ # weed out directory path names and paths to man pages
+ COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
+ # strip suffix from man pages
+ COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
+
+ if [[ "$prev" != $mansect ]]; then
+ # File based completion for the rest, prepending ./ if needed
+ # (man 1.6f needs that for man pages in current dir)
+ local start=${#COMPREPLY[@]}
+ _filedir $manext
+ for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
+ [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
+ done
+ fi
+
+ return 0
+}
+[ $USERLAND = GNU -o $UNAME = Darwin \
+ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
+ -o $UNAME = OpenBSD ] && \
+complete -F _man $filenames man apropos whatis
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mc b/contrib/mc
new file mode 100644
index 00000000..c834e05e
--- /dev/null
+++ b/contrib/mc
@@ -0,0 +1,50 @@
+# bash completion for mc
+
+have mc &&
+_mc()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
+ _filedir
+ return 0
+ ;;
+ -C|--colors|-D|--debuglevel)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
+ --color -C --colors -d --nomouse -e --edit -f \
+ --datadir -k --resetsoft -l --ftplog -P --printwd \
+ -s --slow -t --termcap -u --nosubshell -U --subshell \
+ -v --view -V --version -x --xterm -D --debuglevel -h \
+ --help' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
+} &&
+complete -F _mc $filenames mc
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mcrypt b/contrib/mcrypt
index 81f5d8b3..3ee8c41e 100644
--- a/contrib/mcrypt
+++ b/contrib/mcrypt
@@ -1,80 +1,85 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# mcrypt(1) completion by Ariel Fermani <the_end@bbs.frc.utn.edu.ar>
+have mcrypt || have mdecrypt &&
_mcrypt()
{
- local cur prev i decrypt
+ local cur prev i decrypt
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -@(g|-openpgp-z))
- COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' \
- -- $cur ) )
- return 0
- ;;
- -@(o|-keymode))
- COMPREPLY=( $( mcrypt --list-keymodes 2> /dev/null |
- grep "^$cur" ) )
- return 0
- ;;
- -@(m|-mode))
- COMPREPLY=( $( mcrypt --list 2> /dev/null |
- sed -e 's/.*: //' -e 's/ $//' | sort |
- uniq | tr " " "\n" | grep "^$cur" ) )
- return 0
- ;;
- -@(a|-algorithm))
- COMPREPLY=( $( mcrypt --list 2> /dev/null |
- awk '{print $1}' | grep "^$cur" ) )
- return 0
- ;;
- -@(h|-hash))
- COMPREPLY=( $( mcrypt --list-hash 2> /dev/null |
- sed 1d | grep "^$cur" ) )
- return 0
- ;;
- -@(k|s|-@(key?(size))))
- return 0
- ;;
- -@(f|c|-@(keyfile|config)))
- _filedir
- return 0
- ;;
- --@(algorithm|mode)s-directory)
- _filedir -d
- return 0
- ;;
- esac
+ case "$prev" in
+ -@(g|-openpgp-z))
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ -@(o|-keymode))
+ COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
+ 2>/dev/null )' -- "$cur" ) )
+ return 0
+ ;;
+ -@(m|-mode))
+ COMPREPLY=( $( compgen -W "$( mcrypt --list \
+ 2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
+ sort | uniq )" -- "$cur" ) )
+ return 0
+ ;;
+ -@(a|-algorithm))
+ COMPREPLY=( $( compgen -W "$( mcrypt --list 2>/dev/null | \
+ awk '{print $1}' )" -- "$cur" ) )
+ return 0
+ ;;
+ -@(h|-hash))
+ COMPREPLY=( $( compgen -W '$( mcrypt --list-hash 2>/dev/null | \
+ sed -e 1d )' -- "$cur" ) )
+ return 0
+ ;;
+ -@(k|s|-@(key?(size))))
+ return 0
+ ;;
+ -@(f|c|-@(keyfile|config)))
+ _filedir
+ return 0
+ ;;
+ --@(algorithm|mode)s-directory)
+ _filedir -d
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \
- --decrypt -s --keysize -o --keymode -f --keyfile \
- -c --config -a --algorithm --algorithms-directory \
- -m --mode --modes-directory -h --hash -k --key \
- --noiv -b --bare -z --gzip -p --bzip2 --flush -l \
- --doublecheck -u --unlink --nodelete -t --time -F \
- --force --echo -r --random --list --list-keymodes \
- --list-hash -V --verbose -q --quiet --help -v \
- --version -L --license' -- $cur ) )
- elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
- _filedir '@(nc)'
- else
- decrypt=0
- for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
- _filedir '@(nc)'
- decrypt=1
- break
- fi
- done
- if [[ $decrypt -eq 0 ]]; then
- _filedir
- fi
- fi
-}
-complete -o filenames -F _mcrypt mcrypt mdecrypt
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \
+ --decrypt -s --keysize -o --keymode -f --keyfile \
+ -c --config -a --algorithm --algorithms-directory \
+ -m --mode --modes-directory -h --hash -k --key \
+ --noiv -b --bare -z --gzip -p --bzip2 --flush -l \
+ --doublecheck -u --unlink --nodelete -t --time -F \
+ --force --echo -r --random --list --list-keymodes \
+ --list-hash -V --verbose -q --quiet --help -v \
+ --version -L --license' -- "$cur" ) )
+ elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
+ _filedir '@(nc)'
+ else
+ decrypt=0
+ for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
+ _filedir '@(nc)'
+ decrypt=1
+ break
+ fi
+ done
+ if [[ $decrypt -eq 0 ]]; then
+ _filedir
+ fi
+ fi
+} &&
+complete $filenames -F _mcrypt mcrypt mdecrypt
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mdadm b/contrib/mdadm
new file mode 100644
index 00000000..0847b61f
--- /dev/null
+++ b/contrib/mdadm
@@ -0,0 +1,187 @@
+# bash completion for mdadm
+
+have mdadm && {
+_mdadm_raid_level()
+{
+ local mode
+
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ case ${COMP_WORDS[i]} in
+ -@(C|-create))
+ mode=create
+ break
+ ;;
+ -@(B|-build))
+ mode=build
+ break
+ ;;
+ esac
+ done
+
+ case $mode in
+ create)
+ COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror \
+ raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' \
+ -- "$cur" ) )
+ ;;
+ build)
+ COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath \
+ mp faulty' -- "$cur" ) )
+ ;;
+ esac
+}
+
+_mdadm_raid_layout()
+{
+ local level
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(l|-level) ]]; then
+ level=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ case $level in
+ raid5)
+ COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric \
+ right-asymmetric right-symmetric la ra ls rs' -- "$cur" ) )
+ ;;
+ raid10)
+ COMPREPLY=( $( compgen -W 'n o p' -- "$cur" ) )
+ ;;
+ faulty)
+ COMPREPLY=( $( compgen -W 'write-transient wt read-transient rt \
+ write-persistent wp read-persistent rp write-all read-fixable \
+ rf clear flush none' -- $cur ) )
+ ;;
+ esac
+}
+
+_mdadm_auto_flag()
+{
+ COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- "$cur" ) )
+}
+
+_mdadm_update_flag()
+{
+ COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync \
+ byteorder super-minor' -- "$cur" ) )
+}
+
+
+_mdadm()
+{
+ local cur prev mode options
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ # --name value style option
+ case $prev in
+ -@(c|b))
+ _filedir
+ return 0
+ ;;
+ -l)
+ _mdadm_raid_level
+ return 0
+ ;;
+ -p)
+ _mdadm_raid_layout
+ return 0
+ ;;
+ -a)
+ _mdadm_auto_flag
+ return 0
+ ;;
+ -U)
+ _mdadm_update_flag
+ return 0
+ ;;
+ esac
+
+ # --name=value style option
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur/=*/}
+ cur=${cur/*=/}
+ case "$prev" in
+ --@(config|bitmap|backup-file))
+ _filedir
+ return 0
+ ;;
+ --level)
+ _mdadm_raid_level
+ return 0
+ ;;
+ --@(layout|parity))
+ _mdadm_raid_layout
+ return 0
+ ;;
+ --auto)
+ _mdadm_auto_flag
+ return 0
+ ;;
+ --update)
+ _mdadm_update_flag
+ return 0
+ ;;
+ esac
+ fi
+
+ options='-h --help --help-options -V --version -v --verbose -q --quiet -b \
+ --brief -f --force -c --config= -s --scan -e --metadata= --homehost='
+
+ if [[ "$cur" == -* ]]; then
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C \
+ --create -F --follow --monitor -G --grow" -- "$cur" ) )
+ else
+ case ${COMP_WORDS[COMP_CWORD-1]} in
+ -@(A|-assemble))
+ COMPREPLY=( $( compgen -W "$options -u --uuid= -m \
+ --super-minor= -N --name= -f --force -R --run \
+ --no-degraded -a --auto -b --bitmap= --backup-file= \
+ -U --update= --auto-update-homehost" -- "$cur" ) )
+ ;;
+ -@(B|C|G|-build|-create|-grow))
+ COMPREPLY=( $( compgen -W "$options -n --raid-devices= -x \
+ --spare-devices= -z --size= -c --chunk= --rounding= -l \
+ --level= -p --layout= --parity= -b --bitmap= \
+ --bitmap-chunk= -W --write-mostly --write-behind= \
+ --assume-clean --backup-file= -N --name= -R --run -f \
+ --force -a --auto" -- "$cur" ) )
+ ;;
+ -@(F|-follow|-monitor))
+ COMPREPLY=( $( compgen -W "$options -m --mail -p --program \
+ --alert -y --syslog -d --delay -f --daemonise -i \
+ --pid-file -1 --oneshot -t --test" -- "$cur" ) )
+
+ ;;
+ @(/dev/*|--add|--fail|--remove))
+ COMPREPLY=( $( compgen -W "$options -a --add --re-add -r \
+ --remove -f --fail --set-faulty" -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$options -Q --query -D --detail \
+ -E --examine --sparc2.2 -X --examine-bitmap -R --run \
+ -S --stop -o --readonly -w --readwrite \
+ --zero-superblock -t --test" -- "$cur" ) )
+ ;;
+ esac
+ fi
+ else
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+}
+complete -F _mdadm mdadm
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/minicom b/contrib/minicom
index dcc4b5f2..4b6a9e71 100644
--- a/contrib/minicom
+++ b/contrib/minicom
@@ -1,46 +1,54 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for minicom
have minicom &&
_minicom()
{
- local cur prev confdir
+ local cur prev confdir
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -@(a|c))
- COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
- return 0
- ;;
- -@(S|C))
- _filedir
- return 0
- ;;
- -P)
- COMPREPLY=( $( command ls /dev/tty* ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
- return 0
- ;;
- esac
+ case $prev in
+ -@(a|c))
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ -@(S|C))
+ _filedir
+ return 0
+ ;;
+ -P)
+ COMPREPLY=( $( command ls /dev/tty* ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
- -c -S -d -p -C -T -7 -8' -- $cur ) )
- return 0
- else
- [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] && confdir=/etc
- [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] && confdir=/etc/minicom
- if [ -n "$confdir" ]; then
- COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
- sed -e "s|$confdir/minirc.||")' -- $cur ) )
- return 0
- fi
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
+ -c -S -d -p -C -T -7 -8' -- "$cur" ) )
+ return 0
+ else
+ [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
+ && confdir=/etc
+ [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
+ && confdir=/etc/minicom
+ if [ -n "$confdir" ]; then
+ COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
+ sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
+ return 0
+ fi
+ fi
} &&
complete -F _minicom $default minicom
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mkinitrd b/contrib/mkinitrd
new file mode 100644
index 00000000..040ab2ad
--- /dev/null
+++ b/contrib/mkinitrd
@@ -0,0 +1,60 @@
+# bash completion for mkinitrd
+
+have mkinitrd &&
+_mkinitrd()
+{
+ local cur prev args split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ --@(preload|with|builtin))
+ _modules
+ return 0
+ ;;
+ --@(fstab|dsdt))
+ _filedir
+ return 0
+ ;;
+ --net-dev)
+ _available_interfaces
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version --help -v -f --preload \
+ --force-scsi-probe --omit-scsi-modules \
+ --omit-ide-modules --image-version --force-raid-probe \
+ --omit-raid-modules --with --force-lvm-probe \
+ --omit-lvm-modules --builtin --omit-dmraid --net-dev \
+ --fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
+ else
+ _count_args
+
+ case $args in
+ 1)
+ _filedir
+ ;;
+ 2)
+ _kernel_versions
+ ;;
+ esac
+ fi
+
+} &&
+complete -F _mkinitrd mkinitrd
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mock b/contrib/mock
new file mode 100644
index 00000000..0c94e1b4
--- /dev/null
+++ b/contrib/mock
@@ -0,0 +1,85 @@
+# bash completion for mock
+
+have mock &&
+_mock()
+{
+ local cur prev plugins cfgdir split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ plugins='tmpfs root_cache yum_cache bind_mount ccache'
+ cfgdir=/etc/mock
+
+ count=0
+ for i in "${COMP_WORDS[@]}" ; do
+ [ $count -eq $COMP_CWORD ] && break
+ if [[ "$i" == --configdir ]] ; then
+ cfgdir="${COMP_WORDS[((count+1))]}"
+ elif [[ "$i" == --configdir=* ]] ; then
+ cfgdir=${i/*=/}
+ fi
+ count=$((++count))
+ done
+
+ _split_longopt && split=true
+
+ case $prev in
+ -@(h|-help|-copy@(in|out)|-arch|D|-define|-with?(out)|-uniqueext|-rpmbuild_timeout|-sources|-cwd))
+ return 0
+ ;;
+ -r|--root)
+ COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- $cur ) )
+ COMPREPLY=( ${COMPREPLY[@]/%.cfg/} )
+ return 0
+ ;;
+ --@(config|result)dir)
+ _filedir -d
+ return 0
+ ;;
+ --spec)
+ _filedir spec
+ return 0
+ ;;
+ --target)
+ # Yep, compatible archs, not compatible build archs
+ # (e.g. ix86 chroot builds in x86_64 mock host)
+ # This would actually depend on what the target root
+ # can be used to build for...
+ COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
+ sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --@(en|dis)able-plugin)
+ COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '--version -h --help --rebuild \
+ --buildsrpm --shell --chroot --clean --init \
+ --installdeps --install --update --orphanskill \
+ --copyin --copyout -r --root --offline --no-clean \
+ --cleanup-after --no-cleanup-after --arch --target \
+ -D --define --with --without --resultdir --uniqueext \
+ --configdir --rpmbuild_timeout --unpriv --cwd --spec \
+ --sources -v --verbose -q --quiet --trace \
+ --enable-plugin --disable-plugin --print-root-path' \
+ -- "$cur" ) )
+ else
+ _filedir '?(no)src.rpm'
+ fi
+} &&
+complete -F _mock $filenames mock
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/modules b/contrib/modules
index 9218d0b8..1f99534f 100644
--- a/contrib/modules
+++ b/contrib/modules
@@ -1,6 +1,3 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# module completion by Ted Stern <stern@cray.com>
#
# Completion for Environment Modules `module' alias.
@@ -17,7 +14,9 @@
# module command is an alias, and the `module avail' command returns
# its output as stderr.
-type module &>/dev/null && {
+# Test for existence of /etc/profile.d/modules.sh too because we may end up
+# being sourced before it and thus before the `module' alias has been defined.
+have module || [ -f /etc/profile.d/modules.sh ] && {
_module_list ()
{
@@ -55,30 +54,36 @@ _module () {
options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
awk '{print $2}' | sed -e 's/|/ /g' | sort )"
- COMPREPLY=( $(compgen -W "$options" -- $cur) )
-
- elif [ $COMP_CWORD -eq 2 ] ; then
+ COMPREPLY=( $(compgen -W "$options" -- "$cur") )
- case "$prev" in
- @(add|display|help|load|show|whatis))
- COMPREPLY=( $(_module_avail $cur) )
- ;;
-
- @(rm|switch|swap|unload|update))
- COMPREPLY=( $(_module_list $cur) )
- ;;
- unuse)
- COMPREPLY=( $(_module_path $cur) )
- ;;
- esac
- elif [ $COMP_CWORD -eq 3 ] ; then
- case ${COMP_WORDS[1]} in
- @(sw?(ap|itch)))
- COMPREPLY=( $(_module_avail $cur) )
- ;;
- esac
+ elif [ $COMP_CWORD -eq 2 ] ; then
+ case "$prev" in
+ @(add|display|help|load|show|whatis))
+ COMPREPLY=( $(_module_avail "$cur") )
+ ;;
+ @(rm|switch|swap|unload|update))
+ COMPREPLY=( $(_module_list "$cur") )
+ ;;
+ unuse)
+ COMPREPLY=( $(_module_path "$cur") )
+ ;;
+ esac
+ elif [ $COMP_CWORD -eq 3 ] ; then
+ case ${COMP_WORDS[1]} in
+ @(sw?(ap|itch)))
+ COMPREPLY=( $(_module_avail "$cur") )
+ ;;
+ esac
fi
return 0
}
-complete -o default -F _module module
+complete -F _module $default module
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/monodevelop b/contrib/monodevelop
index 3d8430cb..5ec82021 100644
--- a/contrib/monodevelop
+++ b/contrib/monodevelop
@@ -1,97 +1,86 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# Monodevelop completion
-#
+
have monodevelop &&
_monodevelop()
{
- local cur
- cur=`_get_cword`
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-? -help \
- -help2 \
- -ipc-tcp \
- -newwindow \
- -nologo \
- -usage \
- -V -version' -- "$cur" ) )
- else
- _filedir
- fi
- return 0
+ local cur
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
+ -usage -V -version' -- "$cur" ) )
+ else
+ _filedir
+ fi
+ return 0
} &&
complete -F _monodevelop monodevelop
have mdtool &&
_mdtool()
{
- local cur prev command i
+ local cur prev command i
+
+ COMPREPLY=()
- COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then
- command=${COMP_WORDS[i]}
- fi
- done
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then
+ command=${COMP_WORDS[i]}
+ fi
+ done
- if [[ -n "$command" ]]; then
- case $command in
- "build")
- COMPREPLY=( $( compgen -W '--f --buildfile --p --project' -S":" -- "$cur" ) )
- # TODO: This does not work :(
- #if [[ "$prev" == *: ]]; then
- # case "$prev" in
- # @(--p:|--project:))
- # COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) )
- # ;;
- # @(--f:|--buildfile:))
- # COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) )
- # ;;
- # esac
- #fi
- return 0
- ;;
- "generate-makefiles")
- COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) )
- if [[ "$prev" == *mds ]]; then
- COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' -- "$cur" ) )
- fi
- return 0
- ;;
- "setup")
- # TODO: at least return filenames after these options.
- COMPREPLY=( $( compgen -W 'install i \
- uninstall u \
- check-install ci \
- update up \
- list l \
- list-av la \
- list-update lu \
- rep-add ra \
- rep-remove rr \
- rep-update ru \
- rep-list rl \
- reg-update reg-build rgu \
- info \
- rep-build rb \
- pack p \
- help h \
- dump-file' -- "$cur" ) )
- return 0
- ;;
- esac
- fi
-
- COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \
- generate-makefiles gettext-update \
- setup -q' -- "$cur" ) )
-
- return 0
+ if [[ -n "$command" ]]; then
+ case $command in
+ "build")
+ COMPREPLY=( $( compgen -W '--f --buildfile --p --project' \
+ -S":" -- "$cur" ) )
+ # TODO: This does not work :(
+ #if [[ "$prev" == *: ]]; then
+ # case "$prev" in
+ # @(--p:|--project:))
+ # COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) )
+ # ;;
+ # @(--f:|--buildfile:))
+ # COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) )
+ # ;;
+ # esac
+ #fi
+ return 0
+ ;;
+ "generate-makefiles")
+ COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) )
+ if [[ "$prev" == *mds ]]; then
+ COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
+ -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ "setup")
+ # TODO: at least return filenames after these options.
+ COMPREPLY=( $( compgen -W 'install i uninstall u check-install \
+ ci update up list l list-av la list-update lu rep-add ra \
+ rep-remove rr rep-update ru rep-list rl reg-update \
+ reg-build rgu info rep-build rb pack p help h dump-file' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \
+ generate-makefiles gettext-update setup -q' -- "$cur" ) )
+
+ return 0
} &&
complete -F _mdtool $filenames mdtool
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mplayer b/contrib/mplayer
new file mode 100644
index 00000000..5c8d8f74
--- /dev/null
+++ b/contrib/mplayer
@@ -0,0 +1,242 @@
+# mplayer(1) completion
+
+have mplayer && {
+_mplayer_options_list()
+{
+ cur=${cur%\\}
+ COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \
+ sed -e '1,/^Available/d' | awk '{print $1}' | \
+ sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) )
+}
+
+_mplayer()
+{
+ local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
+
+ COMPREPLY=()
+ cmd=${COMP_WORDS[0]}
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@([av][cfo]|[av]fm|vop|fstype|demuxer|o[av]c|of|profile))
+ _mplayer_options_list $cmd $prev
+ return 0
+ ;;
+ -audiofile)
+ _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)'
+ return 0
+ ;;
+ -font)
+ _filedir '@(desc|ttf)'
+ return 0
+ ;;
+ -sub)
+ _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|ass|ASS)'
+ return 0
+ ;;
+ -vobsub)
+ _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
+ IFS=$'\t\n'
+ COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
+ if [ -f $i -a -r $i ]; then
+ echo ${i%.*}
+ else
+ echo $i
+ fi
+ done ) )
+ IFS=$' \t\n'
+ return 0
+ ;;
+ -ifo)
+ _filedir '@(ifo|IFO)'
+ return 0
+ ;;
+ -cuefile)
+ _filedir '@(bin|BIN|cue|CUE)'
+ return 0
+ ;;
+ -skin)
+ # if you don't have installed mplayer in /usr you
+ # may want to set the MPLAYER_SKINS_DIR global variable
+ if [ -n "$MPLAYER_SKINS_DIR" ]; then
+ skinsdir=$MPLAYER_SKINS_DIR
+ else
+ skinsdir=/usr/share/mplayer/Skin
+ fi
+
+ IFS=$'\t\n'
+ for i in ~/.mplayer/Skin $skinsdir; do
+ if [ -d $i -a -r $i ]; then
+ for j in $( compgen -d $i/$cur ); do
+ COMPREPLY[$k]=${j#$i/}
+ k=$((++k))
+ done
+ fi
+ done
+ IFS=$' \t\n'
+ return 0
+ ;;
+ -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
+ cur=${cur:=/dev/}
+ _filedir
+ return 0
+ ;;
+ -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
+ -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
+ -passlogfile)
+ _filedir
+ return 0
+ ;;
+ -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
+ -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
+ -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
+ -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
+ -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
+ -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
+ -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
+ -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
+ -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
+ -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
+ -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
+ -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
+ -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
+ return 0
+ ;;
+ -lavdopts)
+ COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' -- "$cur" ) )
+ return 0
+ ;;
+ -lavcopts)
+ COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= \
+ mbqmax= vqdiff= vmax_b_frames= vme= vhq v4mv keyint= \
+ vb_strategy= vpass= aspect= vbitrate= vratetol= vrc_maxrate= \
+ vrc_minrate= vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= \
+ vi_qoffset= vqblur= vqcomp= vrc_eq= vrc_override= \
+ vrc_init_cplx= vqsquish= vlelim= vcelim= vstrict= vdpart \
+ vpsize= gray vfdct= idct= lumi_mask= dark_mask= tcplx_mask= \
+ scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= \
+ predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic \
+ umv' -- "$cur" ) )
+ return 0
+ ;;
+ -ssf)
+ COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur" ) )
+ return 0
+ ;;
+ -jpeg)
+ COMPREPLY=( $( compgen -W 'noprogressive progressive nobaseline \
+ baseline optimize= smooth= quality= outdir=' -- "$cur" ) )
+ return 0
+ ;;
+ -xvidopts)
+ COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) )
+ return 0
+ ;;
+ -xvidencopts)
+ COMPREPLY=( $( compgen -W 'pass= bitrate= fixed_quant= me_quality= \
+ 4mv rc_reaction_delay_factor= rc_averaging_period= rc_buffer= \
+ quant_range= min_key_interval= max_key_interval= mpeg_quant \
+ mod_quant lumi_mask hintedme hintfile debug keyframe_boost= \
+ kfthreshold= kfreduction=' -- "$cur" ) )
+ return 0
+ ;;
+ -divx4opts)
+ COMPREPLY=( $( compgen -W 'br= key= deinterlace q= min_quant= \
+ max_quant= rc_period= rc_reaction_period= crispness= \
+ rc_reaction_ratio= pass= vbrpass= help' -- "$cur" ) )
+ return 0
+ ;;
+ -info)
+ COMPREPLY=( $( compgen -W 'name= artist= genre= subject= \
+ copyright= srcform= comment= help' -- "$cur" ) )
+ return 0
+ ;;
+ -lameopts)
+ COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= \
+ mode= padding= fast preset= help' -- "$cur" ) )
+ return 0
+ ;;
+ -rawaudio)
+ COMPREPLY=( $( compgen -W 'on channels= rate= samplesize= format=' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -rawvideo)
+ COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= \
+ h= y420 yv12 yuy2 y8 format= size=' -- "$cur" ) )
+ return 0
+ ;;
+ -aop)
+ COMPREPLY=( $( compgen -W 'list= delay= format= fout= volume= mul= \
+ softclip' -- "$cur" ) )
+ return 0
+ ;;
+ -dxr2)
+ COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded iec958-decoded \
+ mute ucode= 75ire bw color interlaced macrovision= norm= \
+ square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot= \
+ ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r= \
+ ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor= \
+ oly-cor= overlay overlay-ratio= update-cache' -- "$cur" ))
+ return 0
+ ;;
+ -tv)
+ COMPREPLY=( $( compgen -W 'on noaudio driver= device= input= freq= \
+ outfmt= width= height= buffersize= norm= channel= chanlist= \
+ audiorate= forceaudio alsa amode= forcechan= adevice= audioid= \
+ volume= bass= treble= balance= fps= channels= immediatemode=' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -mf)
+ COMPREPLY=( $( compgen -W 'on w= h= fps= type=' -- "$cur" ) )
+ return 0
+ ;;
+ -cdda)
+ COMPREPLY=( $( compgen -W 'speed= paranoia= generic-dev= \
+ sector-size= overlap= toc-bias toc-offset= skip noskip' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -input)
+ COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate keylist cmdlist \
+ js-dev file' -- "$cur" ) )
+ return 0
+ ;;
+ -af)
+ COMPREPLY=( $( compgen -W 'resample resample= channels channels= \
+ format format= volume volume= delay delay= pan pan= sub sub= \
+ surround surround=' -- "$cur" ) )
+ return 0
+ ;;
+ -af-adv)
+ COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \
+ sed -ne '1,/^[[:space:]]*Name/d' \
+ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
+ -e "/^-\(Total\|.*\*\)\?$/!p" )' -- "$cur" ) )
+ ;;
+ *)
+ _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
+ ;;
+ esac
+
+ return 0
+}
+complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/msynctool b/contrib/msynctool
new file mode 100644
index 00000000..31923050
--- /dev/null
+++ b/contrib/msynctool
@@ -0,0 +1,55 @@
+# bash completion for msynctool
+
+have msynctool &&
+_msynctool()
+{
+ local cur prev anteprev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ if [ $COMP_CWORD -ge 2 ]; then
+ anteprev=${COMP_WORDS[COMP_CWORD-2]}
+ fi
+
+ case $anteprev in
+ --configure)
+ COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
+ $prev | awk '/^Member/ {print $2}' | sed \
+ -e 's/:$//' )" -- "$cur" ) )
+ return 0
+ ;;
+ --addmember)
+ COMPREPLY=( $( compgen -W '$(msynctool --listplugins \
+ | sed -e '1d' )' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ case $prev in
+ --@(configure|@(add|del|show)group|sync|addmember))
+ COMPREPLY=( $( compgen -W '$(msynctool --listgroups \
+ | sed -e '1d' )' -- "$cur" ) )
+ return 0
+ ;;
+ --@(showformats|filter-objtype|slow-sync))
+ COMPREPLY=( $( compgen -W '$(msynctool --listobjects \
+ | sed -e '1d' )' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects \
+ --showformats --showgroup --sync --filter-objtype --slow-sync \
+ --wait --multi --addgroup --delgroup --addmember --configure \
+ --manual --configdir --conflict' -- "$cur" ) )
+} &&
+complete -F _msynctool msynctool
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mtx b/contrib/mtx
index 82652054..4b20ba70 100644
--- a/contrib/mtx
+++ b/contrib/mtx
@@ -1,46 +1,52 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# mtx completion by Jon Middleton <jjm@ixtab.org.uk>
+have mtx &&
_mtx()
{
local cur prev options tapes drives
-
+
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
options="-f nobarcode invert noattach --version inquiry noattach \
- inventory status load unload eepos first last next"
+ inventory status load unload eepos first last next"
tapes=$(mtx status | \
- awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
+ awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
tapes=${tapes//:Full}
drives=$(mtx status | \
- awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
+ awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
drives=${drives//:Full}
drives=${drives//:Empty}
if [ $COMP_CWORD -gt 1 ]; then
- case $prev in
- load)
- COMPREPLY=( $( compgen -W "$tapes" -- $cur ) )
- ;;
- unload|first|last|next)
- COMPREPLY=( $( compgen -W "$drives" -- $cur ) )
- ;;
- -f)
- true
- ;;
- *)
- true
- ;;
- esac
+ case $prev in
+ load)
+ COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
+ ;;
+ unload|first|last|next)
+ COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) )
+ ;;
+ -f)
+ true
+ ;;
+ *)
+ true
+ ;;
+ esac
else
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
fi
return 0
-}
+} &&
complete -F _mtx mtx
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/munin-node b/contrib/munin-node
new file mode 100644
index 00000000..2753fc2a
--- /dev/null
+++ b/contrib/munin-node
@@ -0,0 +1,103 @@
+# bash completion for munin node
+
+have munin-run &&
+_munin-run()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --@(config|sconffile))
+ _filedir
+ return 0
+ ;;
+ --@(service|sconf)dir)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
+ --sconffile --help --debug --version' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
+ -- "$cur" ) )
+ fi
+} &&
+complete -F _munin-run munin-run
+
+have munin-update &&
+_munin-update()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --config)
+ _filedir
+ return 0
+ ;;
+ --host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--force-root --[no]force-root \
+ --service --host --config --help --debug --nodebug \
+ --fork --nofork --stdout --nostdout --timeout' -- "$cur" ) )
+ fi
+} &&
+complete -F _munin-update munin-update
+
+have munin-node-configure &&
+_munin-node-configure()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --config)
+ _filedir
+ return 0
+ ;;
+ --@(service|lib)dir)
+ _filedir -d
+ return 0
+ ;;
+ --snmp)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ --snmpversion)
+ COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version --debug --config \
+ --servicedir --libdir --families --suggest --shell \
+ --remove-also --snmp --snmpversion --snmpcommunity' -- "$cur" ) )
+ fi
+} &&
+complete -F _munin-node-configure munin-node-configure
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mutt b/contrib/mutt
new file mode 100644
index 00000000..62540bde
--- /dev/null
+++ b/contrib/mutt
@@ -0,0 +1,146 @@
+# mutt completion
+#
+# Mutt doesn't have an "addressbook" like Pine, but it has aliases and
+# a "query" function to retrieve addresses, so that's what we use here.
+
+have mutt || have muttng && {
+_muttaddr()
+{
+ _muttaliases
+ _muttquery
+
+ cur=`_get_cword`
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$cur" ) )
+
+ return 0
+}
+
+_muttconffiles()
+{
+ local file sofar
+ local -a newconffiles
+
+ sofar=" $1 "
+ shift
+ while [[ "$1" ]]; do
+ newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
+ for file in "${newconffiles[@]}"; do
+ [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
+ continue
+ sofar="$sofar $file"
+ sofar=" $(eval _muttconffiles \"$sofar\" $file) "
+ done
+ shift
+ done
+ echo $sofar
+}
+
+_muttaliases()
+{
+ local cur muttrc muttcmd=${COMP_WORDS[0]}
+ local -a conffiles aliases
+ cur=`_get_cword =`
+
+ [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
+ [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
+ [ -z "$muttrc" ] && return 0
+
+ conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
+ aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
+ $(eval echo "${conffiles[@]}") ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
+
+ return 0
+}
+
+_muttquery()
+{
+ local cur querycmd muttcmd=${COMP_WORDS[0]}
+ local -a queryresults
+ cur=`_get_cword`
+
+ querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
+ if [ -z "$cur" -o -z "$querycmd" ]; then
+ queryresults=()
+ else
+ queryresults=( $( $querycmd | sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
+ fi
+
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
+ -- "$cur" ) )
+
+ return 0
+}
+
+_muttfiledir()
+{
+ local cur folder spoolfile muttcmd=${COMP_WORDS[0]}
+ cur=`_get_cword`
+
+ # This is currently not working so well. Perhaps this function should
+ # just call _filedir() for the moment.
+ if [[ $cur == [=+]* ]]; then
+ folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
+ : folder:=~/Mail
+
+ # Match any file in $folder beginning with $cur
+ # (minus the leading '=' sign).
+ COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
+ COMPREPLY=( ${COMPREPLY[@]#$folder/} )
+ return 0
+ elif [ "$cur" == !* ]; then
+ spoolfile="$( $muttcmd -Q spoolfile | \
+ sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
+ [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
+ fi
+ _filedir
+
+ return 0
+}
+
+_mutt()
+{
+ local cur prev
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ COMPREPLY=()
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
+ -p -Q -R -s -v -x -y -z -Z -h' -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ case "$prev" in
+ -@(a|f|F|H|i))
+ _muttfiledir
+ return 0
+ ;;
+ -A)
+ _muttaliases
+ return 0
+ ;;
+ -@(e|m|Q|s|h|p|R|v|y|z|Z))
+ return 0
+ ;;
+ *)
+ _muttaddr
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+
+}
+complete -F _mutt $default $filenames mutt muttng
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/mysqladmin b/contrib/mysqladmin
new file mode 100644
index 00000000..0a84de1e
--- /dev/null
+++ b/contrib/mysqladmin
@@ -0,0 +1,38 @@
+# bash completion for mysqladmin
+
+have mysqladmin &&
+_mysqladmin()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -u)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
+ -v -V -w' -- "$cur" ) )
+
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W 'create drop extended-status flush-hosts flush-logs \
+ flush-status flush-tables flush-threads flush-privileges kill \
+ password ping processlist reload refresh shutdown status variables \
+ version' -- "$cur" ) )
+} &&
+complete -F _mysqladmin mysqladmin
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ncftp b/contrib/ncftp
new file mode 100644
index 00000000..6d5a611a
--- /dev/null
+++ b/contrib/ncftp
@@ -0,0 +1,26 @@
+# bash completion for ncftp
+
+have ncftp &&
+_ncftp()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
+ COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
+ ~/.ncftp/bookmarks )' -- "$cur" ) )
+ fi
+
+ return 0
+} &&
+complete -F _ncftp $default ncftp
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/net-tools b/contrib/net-tools
index d926e084..b3bf8615 100644
--- a/contrib/net-tools
+++ b/contrib/net-tools
@@ -1,89 +1,115 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for net tools
have mii-tool &&
_mii_tool()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case $prev in
- -F)
- COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
- 10baseT-FD 10baseT-HD' -- $cur ) )
- return 0
- ;;
- -A)
- COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
- 10baseT-FD 10baseT-HD' -- $cur ) )
- return 0
- ;;
- esac
-
-
- # --name=value style option
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case "$prev" in
- --force)
- COMPREPLY=( $( compgen -W '100baseTx-FD \
- 100baseTx-HD 10baseT-FD \
- 10baseT-HD' -- $cur ) )
- return 0
- ;;
- --advertise)
- COMPREPLY=( $( compgen -W '100baseT4 \
- 100baseTx-FD 100baseTx-HD 10baseT-FD \
- 10baseT-HD' -- $cur ) )
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
- --reset -r --restart -w --watch -l --log -A \
- --advertise= -F --force=' -- $cur ) )
- else
- _available_interfaces -a
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--force)
+ COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
+ 10baseT-FD 10baseT-HD' -- "$cur" ) )
+ return 0
+ ;;
+ -A|--advertise)
+ COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
+ 10baseT-FD 10baseT-HD' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
+ --reset -r --restart -w --watch -l --log -A \
+ --advertise -F --force' -- "$cur" ) )
+ else
+ _available_interfaces -a
+ fi
} &&
complete -F _mii_tool $default mii-tool
have mii-diag &&
_mii_diag()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- # --name value style option
- case $prev in
- -@(F|A|-advertise|-fixed-speed))
- COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
- 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
- 10baseT-HD' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \
- --all-interfaces -s --status -D --debug -g \
- --read-parameters -G --set-parameters -M --msg-level \
- -p --phy -r --restart -R --reset -v -V -w --watch \
- -? --help' -- $cur ) )
- else
- _available_interfaces -a
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -@(F|A|-advertise|-fixed-speed))
+ COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
+ 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
+ 10baseT-HD' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \
+ --all-interfaces -s --status -D --debug -g \
+ --read-parameters -G --set-parameters -M --msg-level \
+ -p --phy -r --restart -R --reset -v -V -w --watch \
+ -? --help' -- "$cur" ) )
+ else
+ _available_interfaces -a
+ fi
} &&
complete -F _mii_diag $default mii-diag
+
+# Linux route(8) completion
+#
+[ $UNAME = Linux ] &&
+_route()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [ "$prev" = dev ]; then
+ COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
+ window irtt reject mod dyn reinstate dev \
+ default gw' -- "$cur" ) )
+
+ COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
+ (while read -d ' ' i; do
+ [ "$i" == "" ] && continue
+ # flatten array with spaces on either side,
+ # otherwise we cannot grep on word
+ # boundaries of first and last word
+ COMPREPLY=" ${COMPREPLY[@]} "
+ # remove word from list of completions
+ COMPREPLY=( ${COMPREPLY/ $i / } )
+ done
+ echo "${COMPREPLY[@]}")
+ ) )
+ return 0
+}
+[ $UNAME = Linux ] && complete -F _route route
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ntpdate b/contrib/ntpdate
new file mode 100644
index 00000000..233f69f1
--- /dev/null
+++ b/contrib/ntpdate
@@ -0,0 +1,38 @@
+# bash completion for ntpdate
+
+have ntpdate &&
+_ntpdate()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -k)
+ _filedir
+ return 0
+ ;;
+ -U)
+ COMPREPLY=( $( compgen -u "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
+ -e -k -p -o -r -t' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
+} &&
+complete -F _ntpdate ntpdate
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/openldap b/contrib/openldap
new file mode 100644
index 00000000..5869811d
--- /dev/null
+++ b/contrib/openldap
@@ -0,0 +1,273 @@
+# bash completion for openldap
+
+have ldapsearch && {
+_ldap_uris()
+{
+ COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) )
+}
+
+_ldap_protocols()
+{
+ COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) )
+}
+
+_ldapsearch()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -T)
+ _filedir -d
+ return 0
+ ;;
+ -@(f|y))
+ _filedir
+ return 0
+ ;;
+ -s)
+ COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) )
+ return 0
+ ;;
+ -a)
+ COMPREPLY=( $( compgen -W 'never always search find' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \
+ -LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \
+ -P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" ) )
+ fi
+}
+complete -F _ldapsearch ldapsearch
+
+_ldapaddmodify()
+{
+ local cur prev options
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -@(S|f|y))
+ _filedir
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
+ -Q -U -R -x -X -Y -Z -ZZ -f'
+ if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
+ options="$options -a"
+ fi
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ fi
+}
+complete -F _ldapaddmodify ldapadd ldapmodify
+
+_ldapdelete()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -@(f|y))
+ _filedir
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \
+ -H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' -- "$cur" ) )
+ fi
+}
+complete -F _ldapdelete ldapdelete
+
+_ldapcompare()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -y)
+ _filedir
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -v -z -M -MM -d -D -W -w -y \
+ -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ fi
+}
+complete -F _ldapcompare ldapcompare
+
+_ldapmodrdn()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -@(f|y))
+ _filedir
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \
+ -y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' -- "$cur" ) )
+ fi
+}
+complete -F _ldapmodrdn ldapmodrdn
+
+_ldapwhoami()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -@(f|y))
+ _filedir
+ return 0
+ ;;
+ -P)
+ _ldap_protocols
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \
+ -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ fi
+}
+complete -F _ldapwhoami ldapwhoami
+
+_ldappasswd()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -H)
+ _ldap_uris
+ return 0
+ ;;
+ -@(t|T|y))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \
+ -v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
+ fi
+}
+complete -F _ldappasswd ldappasswd
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/openssl b/contrib/openssl
new file mode 100644
index 00000000..8fdbb87d
--- /dev/null
+++ b/contrib/openssl
@@ -0,0 +1,251 @@
+# bash completion for openssl
+
+have openssl && {
+_openssl_sections()
+{
+ local config f
+
+ # check if a specific configuration file is used
+ for (( i=2; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -config ]]; then
+ config=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+
+ # if no config given, check some usual default locations
+ if [ -z "$config" ]; then
+ for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
+ /usr/share/ssl/openssl.cnf; do
+ [ -f $f ] && config=$f && break
+ done
+ fi
+
+ [ ! -f "$config" ] && return 0
+
+ COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \
+ -- "$cur" ) )
+}
+
+_openssl()
+{
+ local cur prev commands command options formats
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \
+ dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \
+ nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa \
+ rsautl s_client s_server s_time sess_id smime speed spkac \
+ verify version x509 md2 md4 md5 rmd160 sha sha1 aes-128-cbc \
+ aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb \
+ base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc \
+ camellia-128-ecb camellia-192-cbc camellia-192-ecb \
+ camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc \
+ cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb \
+ des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 \
+ des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
+ rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \
+ rc4-40'
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
+ else
+ command=${COMP_WORDS[1]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case $prev in
+ -@(CA|CAfile|CAkey|CAserial|cert|certfile|config|content|dcert|dkey|dhparam|extfile|in|inkey|kfile|key|keyout|out|oid|prvrify|rand|recip|revoke|sess_in|sess_out|spkac|sign|signkey|signer|signature|ss_cert|untrusted|verify))
+ _filedir
+ return 0
+ ;;
+ -@(outdir|CApath))
+ _filedir -d
+ return 0
+ ;;
+ -@(name|crlexts|extensions))
+ _openssl_sections
+ return 0
+ ;;
+ -@(in|out|key|cert|CA|CAkey|dkey|dcert)form)
+ formats='DER PEM'
+ case $command in
+ x509)
+ formats="$formats NET"
+ ;;
+ smime)
+ formats="$formats SMIME"
+ ;;
+ esac
+ COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
+ return 0
+ ;;
+ -connect)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -starttls)
+ COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -cipher)
+ COMPREPLY=( $( compgen -W "$(openssl ciphers | \
+ tr ':' '\n')" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ asn1parse)
+ options='-inform -in -out -noout -offset -length -i -oid \
+ -strparse'
+ ;;
+ ca)
+ options='-verbose -config -name -gencrl -revoke \
+ -crl_reason -crl_hold -crl_compromise \
+ -crl_CA_compromise -crldays -crlhours -crlexts \
+ -startdate -enddate -days -md -policy -keyfile -key \
+ -passin -cert -selfsig -in -out -notext -outdir \
+ -infiles -spkac -ss_cert -preserveDN -noemailDN \
+ -batch -msie_hack -extensions -extfile -engine \
+ -subj -utf8 -multivalue-rdn'
+ ;;
+ ciphers)
+ options='-v -ssl2 -ssl3 -tls1'
+ ;;
+ crl)
+ options='-inform -outform -text -in -out -noout -hash \
+ -issuer -lastupdate -nextupdate -CAfile -CApath'
+ ;;
+ crl2pkcs7)
+ options='-inform -outform -in -out -print_certs'
+ ;;
+ dgst)
+ options='-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
+ -c -d -hex -binary -out -sign -verify -prverify \
+ -signature'
+ ;;
+ dsa)
+ options='-inform -outform -in -passin -out -passout -des \
+ -des3 -idea -text -noout -modulus -pubin -pubout'
+ ;;
+ dsaparam)
+ options='-inform -outform -in -out -noout -text -C -rand \
+ -genkey'
+ ;;
+ enc)
+ options='-ciphername -in -out -pass -e -d -a -A -k -kfile \
+ -S -K -iv -p -P -bufsize -debug'
+ ;;
+ dhparam)
+ options='-inform -outform -in -out -dsaparam -noout -text \
+ -C -2 -5 -rand'
+ ;;
+ gendsa)
+ options='-out -des -des3 -idea -rand'
+ ;;
+ genrsa)
+ options='-out -passout -des -des3 -idea -f4 -3 -rand'
+ ;;
+ pkcs7)
+ options='-inform -outform -in -out -print_certs -text \
+ -noout'
+ ;;
+ rand)
+ options='-out -rand -base64'
+ ;;
+ req)
+ options='-inform -outform -in -passin -out -passout -text \
+ -noout -verify -modulus -new -rand -newkey -newkey \
+ -nodes -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
+ -config -x509 -days -asn1-kludge -newhdr -extensions \
+ -reqexts section'
+ ;;
+ rsa)
+ options='-inform -outform -in -passin -out -passout \
+ -sgckey -des -des3 -idea -text -noout -modulus -check \
+ -pubin -pubout -engine'
+ ;;
+ rsautl)
+ options='-in -out -inkey -pubin -certin -sign -verify \
+ -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse'
+ ;;
+ s_client)
+ options='-connect -verify -cert -certform -key -keyform \
+ -pass -CApath -CAfile -reconnect -pause -showcerts \
+ -debug -msg -nbio_test -state -nbio -crlf -ign_eof \
+ -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
+ -bugs -cipher -starttls -engine -tlsextdebug \
+ -no_ticket -sess_out -sess_in -rand'
+ ;;
+ s_server)
+ options='-accept -context -verify -Verify -crl_check \
+ -crl_check_all -cert -certform -key -keyform -pass \
+ -dcert -dcertform -dkey -dkeyform -dpass -dhparam \
+ -nbio -nbio_test -crlf -debug -msg -state -CApath \
+ -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 \
+ -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 -no_dhe \
+ -bugs -hack -www -WWW -HTTP -engine -tlsextdebug \
+ -no_ticket -id_prefix -rand'
+ ;;
+ s_time)
+ options='-connect -www -cert -key -CApath -CAfile -reuse \
+ -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher'
+ ;;
+ sess_id)
+ options='-inform -outform -in -out -text -noout -context \
+ ID'
+ ;;
+ smime)
+ options='-encrypt -decrypt -sign -verify -pk7out -des \
+ -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 \
+ -in -certfile -signer -recip -inform -passin -inkey \
+ -out -outform -content -to -from -subject -text -rand'
+ ;;
+ speed)
+ options='-engine'
+ ;;
+ verify)
+ options='-CApath -CAfile -purpose -untrusted -help \
+ -issuer_checks -verbose -certificates'
+ ;;
+ x509)
+ options='-inform -outform -keyform -CAform -CAkeyform -in \
+ -out -serial -hash -subject-hash -issuer_hash -subject \
+ -issuer -nameopt -email -startdate -enddate -purpose \
+ -dates -modulus -fingerprint -alias -noout -trustout \
+ -clrtrust -clrreject -addtrust -addreject -setalias \
+ -days -set_serial -signkey -x509toreq -req -CA -CAkey \
+ -CAcreateserial -CAserial -text -C -md2 -md5 -sha1 \
+ -mdc2 -clrext -extfile -extensions -engine'
+ ;;
+ @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
+ options='-c -d'
+ ;;
+ esac
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ if [[ "$command" == speed ]]; then
+ COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 \
+ idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 \
+ rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea \
+ rc2 des rsa blowfish' -- "$cur" ) )
+ else
+ _filedir
+ fi
+ fi
+ fi
+}
+complete -F _openssl $default openssl
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/p4 b/contrib/p4
index ada8a57f..4e7fc3d3 100644
--- a/contrib/p4
+++ b/contrib/p4
@@ -1,55 +1,60 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# Perforce completion by Frank Cusack <frank@google.com>
+have p4 &&
_p4()
{
- local cur prev prev2 p4commands p4filetypes
+ local cur prev prev2 p4commands p4filetypes
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- # rename isn't really a command
- p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
- p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
- uresource uxbinary xbinary xltext xtempobj xtext \
- text binary resource"
+ # rename isn't really a command
+ p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
+ p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
+ uresource uxbinary xbinary xltext xtempobj xtext \
+ text binary resource"
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) )
- elif [ $COMP_CWORD -eq 2 ]; then
- case "$prev" in
- help)
- COMPREPLY=( $( compgen -W "simple commands \
- environment filetypes jobview revisions \
- usage views $p4commands" -- $cur ) )
- ;;
- admin)
- COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) )
- ;;
- *)
- ;;
- esac
- elif [ $COMP_CWORD -gt 2 ]; then
- prev2=${COMP_WORDS[COMP_CWORD-2]}
- case "$prev" in
- -t)
- case "$prev2" in
- add|edit|reopen)
- COMPREPLY=( $( compgen -W "$p4filetypes" \
- -- $cur) )
- ;;
- *)
- ;;
- esac
- ;;
- *)
- ;;
- esac
- fi
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
+ elif [ $COMP_CWORD -eq 2 ]; then
+ case "$prev" in
+ help)
+ COMPREPLY=( $( compgen -W "simple commands \
+ environment filetypes jobview revisions \
+ usage views $p4commands" -- "$cur" ) )
+ ;;
+ admin)
+ COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) )
+ ;;
+ *)
+ ;;
+ esac
+ elif [ $COMP_CWORD -gt 2 ]; then
+ prev2=${COMP_WORDS[COMP_CWORD-2]}
+ case "$prev" in
+ -t)
+ case "$prev2" in
+ add|edit|reopen)
+ COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") )
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ fi
- return 0
-}
+ return 0
+} &&
complete -F _p4 $default p4 g4
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/perl b/contrib/perl
new file mode 100644
index 00000000..77fac477
--- /dev/null
+++ b/contrib/perl
@@ -0,0 +1,127 @@
+# bash completion for perl
+
+have perl &&
+{
+_perlmodules()
+{
+ 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" ) )
+}
+
+_perl()
+{
+ local cur prev prefix temp
+ local optPrefix optSuffix
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ prefix=""
+
+ # If option not followed by whitespace, reassign prev and cur
+ if [[ "$cur" == -?* ]]; then
+ temp=$cur
+ prev=${temp:0:2}
+ cur=${temp:2}
+ optPrefix=-P$prev
+ optSuffix=-S/
+ prefix=$prev
+ fi
+
+ # only handle module completion for now
+ case "$prev" in
+ -I|-x)
+ local IFS=$'\t\n'
+ COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
+ return 0
+ ;;
+ -m|-M)
+ _perlmodules
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
+ -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
+ else
+ _filedir
+ fi
+}
+complete -F _perl $nospace $filenames perl
+
+_perldoc()
+{
+ local cur prev prefix temp
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ prefix=""
+
+ # completing an option (may or may not be separated by a space)
+ if [[ "$cur" == -?* ]]; then
+ temp=$cur
+ prev=${temp:0:2}
+ cur=${temp:2}
+ prefix=$prev
+ fi
+
+ # complete builtin perl functions
+ case $prev in
+ -f)
+ COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
+ lcfirst length oct ord pack q qq reverse rindex sprintf \
+ substr tr uc ucfirst y m pos quotemeta s split study qr abs \
+ atan2 cos exp hex int log oct rand sin sqrt srand pop push \
+ shift splice unshift grep join map qw reverse sort unpack \
+ delete each exists keys values binmode close closedir \
+ dbmclose dbmopen die eof fileno flock format getc print \
+ printf read readdir rewinddir seek seekdir select syscall \
+ sysread sysseek syswrite tell telldir truncate warn write \
+ pack read syscall sysread syswrite unpack vec -X chdir chmod \
+ chown chroot fcntl glob ioctl link lstat mkdir open opendir \
+ readlink rename rmdir stat symlink umask unlink utime caller \
+ continue do dump eval exit goto last next redo return \
+ sub wantarray caller import local my our package use defined \
+ formline reset scalar undef \
+ alarm exec fork getpgrp getppid getpriority kill pipe qx \
+ setpgrp setpriority sleep system times wait waitpid \
+ import no package require use bless dbmclose dbmopen package \
+ ref tie tied untie use accept bind connect getpeername \
+ getsockname getsockopt listen recv send setsockopt shutdown \
+ socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
+ semop shmctl shmget shmread shmwrite endgrent endhostent \
+ endnetent endpwent getgrent getgrgid getgrnam getlogin \
+ getpwent getpwnam getpwuid setgrent setpwent endprotoent \
+ endservent gethostbyaddr gethostbyname gethostent \
+ getnetbyaddr getnetbyname getnetent getprotobyname \
+ getprotobynumber getprotoent getservbyname getservbyport \
+ getservent sethostent setnetent setprotoent setservent \
+ gmtime localtime time times' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
+ else
+ # return available modules (unless it is clearly a file)
+ if [[ "$cur" != */* ]]; then
+ _perlmodules
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ '$( PAGER=/bin/cat man perl | \
+ sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
+ awk "\$NF=2 { print \$1}" | grep perl )' -- "$cur" ) )
+ fi
+ fi
+}
+complete -F _perldoc $default perldoc
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/pine b/contrib/pine
new file mode 100644
index 00000000..0c96bedd
--- /dev/null
+++ b/contrib/pine
@@ -0,0 +1,22 @@
+# PINE address-book completion
+
+have pine &&
+_pineaddr()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \
+ 2>/dev/null)' -- "$cur" ) )
+} &&
+complete -F _pineaddr $default pine
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/pkg-config b/contrib/pkg-config
new file mode 100644
index 00000000..1f8cc83f
--- /dev/null
+++ b/contrib/pkg-config
@@ -0,0 +1,52 @@
+# bash completion for pkgconfig
+
+have pkg-config &&
+_pkg_config()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ --@(?(define-)variable|@(atleast?(-pkgconfig)|exact|max)-version))
+ # argument required but no completions available
+ return 0
+ ;;
+ -\?|--help|--version|--usage)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ # return list of available options
+ COMPREPLY=( $( compgen -W '--version --modversion \
+ --atleast-pkgconfig-version --libs --static \
+ --short-errors --libs-only-l --libs-only-other \
+ --libs-only-L --cflags --cflags-only-I \
+ --cflags-only-other --variable --define-variable \
+ --exists --uninstalled --atleast-version \
+ --exact-version --max-version --list-all --debug \
+ --print-errors --silence-errors --errors-to-stdout \
+ --print-provides --print-requires -? --help --usage' \
+ -- "$cur") )
+ else
+ COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
+ 2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
+ fi
+} &&
+complete -F _pkg_config pkg-config
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/pkg_install b/contrib/pkg_install
new file mode 100644
index 00000000..3bdf2b77
--- /dev/null
+++ b/contrib/pkg_install
@@ -0,0 +1,31 @@
+# bash completion for FreeBSD base package management tools
+
+[ $UNAME = FreeBSD ] &&
+{
+
+_pkg_delete()
+{
+ local cur pkgdir prev
+
+ pkgdir=${PKG_DBDIR:-/var/db/pkg}/
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
+
+ COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
+
+ return 0
+}
+complete -F _pkg_delete $dirnames pkg_delete pkg_info
+
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/pkgtools b/contrib/pkgtools
new file mode 100644
index 00000000..c8092b7c
--- /dev/null
+++ b/contrib/pkgtools
@@ -0,0 +1,22 @@
+# bash completion for Slackware Linux pkgtools
+
+have removepkg && [ -f /etc/slackware-version ] &&
+_removepkg()
+{
+ local packages cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
+} &&
+complete -F _removepkg $filenames removepkg &&
+ complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/portupgrade b/contrib/portupgrade
new file mode 100644
index 00000000..b9914730
--- /dev/null
+++ b/contrib/portupgrade
@@ -0,0 +1,59 @@
+# bash completion for FreeBSD portupgrade package
+
+have portupgrade &&
+_portupgrade()
+{
+ local cur pkgdir prev
+
+ pkgdir=${PKG_DBDIR:-/var/db/pkg}/
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
+
+ COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
+ COMPREPLY=( ${COMPREPLY[@]%-*} )
+
+ return 0
+} &&
+complete -F _portupgrade $dirnames portupgrade
+
+have portinstall &&
+_portinstall()
+{
+ local cur portsdir prev indexfile
+ local -a COMPREPLY2
+
+ portsdir=${PORTSDIR:-/usr/ports}/
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ # First try INDEX-5
+ indexfile=$portsdir/INDEX-5
+ # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
+ [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
+ indexfile=$portsdir/INDEX
+
+ [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
+
+ COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
+ COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
+ cut -d'|' -f2 ) )
+ COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
+ COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
+
+ return 0
+} &&
+complete -F _portinstall $dirnames portinstall
+
+# _pkg_delete is in pkg_install
+type _pkg_delete &>/dev/null && have pkg_deinstall && \
+complete -F _pkg_delete $dirnames pkg_deinstall
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/postfix b/contrib/postfix
new file mode 100644
index 00000000..dccdc1e5
--- /dev/null
+++ b/contrib/postfix
@@ -0,0 +1,236 @@
+# bash completion for postfix
+
+have postfix && {
+# postfix(1)
+#
+_postfix()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -c)
+ _filedir -d
+ return 0
+ ;;
+ -D)
+ COMPREPLY=( $( compgen -W 'start' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
+ set-permissions upgrade-configuration' -- "$cur" ) )
+}
+complete -F _postfix $filenames postfix
+
+# postalias(1) and postmap(1)
+#
+_postmap()
+{
+ local cur prev len idx
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -c)
+ _filedir -d
+ return 0
+ ;;
+ -[dq])
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
+ -- "$cur" ) )
+ return 0
+ fi
+
+ if [[ "$cur" == *:* ]]; then
+ COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
+ else
+ len=${#cur}
+ idx=0
+ for pval in $( /usr/sbin/postconf -m ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]="$pval:"
+ idx=$(($idx+1))
+ fi
+ done
+ if [[ $idx -eq 0 ]]; then
+ COMPREPLY=( $( compgen -f -- "$cur" ) )
+ fi
+ fi
+ return 0
+}
+complete -F _postmap $filenames postmap postalias
+
+# postcat(1)
+#
+_postcat()
+{
+ local cur prev pval len idx qfile
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -c)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) )
+ return 0
+ fi
+
+ qfile=0
+ for idx in "${COMP_WORDS[@]}"; do
+ [[ "$idx" = -q ]] && qfile=1 && break
+ done
+ if [[ $qfile == 1 ]]; then
+ len=${#cur}
+ idx=0
+ for pval in $( mailq 2>/dev/null | \
+ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]=$pval
+ idx=$(($idx+1))
+ fi
+ done
+ return 0
+ else
+ _filedir
+ return 0
+ fi
+}
+complete -F _postcat $filenames postcat
+
+# postconf(1)
+#
+_postconf()
+{
+ local cur prev pval len idx eqext
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -b|-t)
+ _filedir
+ return 0
+ ;;
+ -c)
+ _filedir -d
+ return 0
+ ;;
+ -e)
+ cur=${cur#[\"\']}
+ eqext='='
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
+ -- "$cur" ) )
+ return 0
+ fi
+
+ len=${#cur}
+ idx=0
+ for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]="$pval$eqext"
+ idx=$(($idx+1))
+ fi
+ done
+ return 0
+}
+complete -F _postconf $filenames postconf
+
+# postsuper(1)
+#
+_postsuper()
+{
+ local cur prev pval len idx
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -c)
+ _filedir -d
+ return 0
+ ;;
+ -[dr])
+ len=${#cur}
+ idx=0
+ for pval in $( echo ALL; mailq 2>/dev/null | \
+ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]=$pval
+ idx=$(($idx+1))
+ fi
+ done
+ return 0
+ ;;
+ -h)
+ len=${#cur}
+ idx=0
+ for pval in $( echo ALL; mailq 2>/dev/null | \
+ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]=$pval
+ idx=$(($idx+1))
+ fi
+ done
+ return 0
+ ;;
+ -H)
+ len=${#cur}
+ idx=0
+ for pval in $( echo ALL; mailq 2>/dev/null | \
+ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
+ if [[ "$cur" == "${pval:0:$len}" ]]; then
+ COMPREPLY[$idx]=$pval
+ idx=$(($idx+1))
+ fi
+ done
+ return 0
+ ;;
+ esac
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
+}
+complete -F _postsuper $filenames postsuper
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/postgresql b/contrib/postgresql
new file mode 100644
index 00000000..125b6f64
--- /dev/null
+++ b/contrib/postgresql
@@ -0,0 +1,171 @@
+# bash completion for Postgresql
+
+have psql && {
+_pg_databases()
+{
+ return # See https://launchpad.net/bugs/164772
+ COMPREPLY=( $( compgen -W "$( psql -l 2>/dev/null | \
+ sed -e '1,/^-/d' -e '/^(/,$d' | \
+ awk '{print $1}' )" -- "$cur" ) )
+}
+
+_pg_users()
+{
+ # See https://launchpad.net/bugs/164772
+ #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
+ # grep "^ $cur" ) )
+ #[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+}
+
+# createdb(1) completion
+#
+_createdb()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -h|--host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -U|--username|-O|--owner)
+ _pg_users
+ return 0
+ ;;
+ -p|--port|-D|--tablespace|-E|--encoding|-T|--template)
+ # argument required but no completions available
+ return 0
+ ;;
+ --help|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
+ --tablespace --template --encoding --host --port \
+ --username --password --echo --quiet --help --version' -- "$cur" ))
+ else
+ _pg_databases
+ fi
+}
+complete -F _createdb $default createdb
+
+# dropdb(1) completion
+#
+_dropdb()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -h|--host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -U|--username)
+ _pg_users
+ return 0
+ ;;
+ --help|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h -p -U -W -i -e -q \
+ --host --port --username --password --interactive \
+ --echo --quiet --help --version' -- "$cur" ) )
+ else
+ _pg_databases
+ fi
+}
+complete -F _dropdb $default dropdb
+
+# psql(1) completion
+#
+_psql()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -h|--host)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ -U|--username)
+ _pg_users
+ return 0
+ ;;
+ -d|--dbname)
+ _pg_databases
+ return 0
+ ;;
+ -o|--output|-f|--file|-L|--log-file)
+ _filedir
+ return 0
+ ;;
+ -c|--command|-F|--field-separator|-p|--port|-P|--pset|\
+ -R|--record-separator|-T|--table-attr|-v|--set|--variable)
+ # argument required but no completions available
+ return 0
+ ;;
+ -\?|--help|-V|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ # return list of available options
+ COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
+ -c --command -d --dbname -e --echo-queries \
+ -E --echo-hidden -f --file -F --field-separator \
+ -h --host -H --html -l --list -L --log-file -n \
+ -o --output -p --port -P --pset -q --quiet \
+ -R --record-separator -s --single-step \
+ -S --single-line -t --tuples-only -T --table-attr \
+ -U --username -v --set --variable -V --version \
+ -W --password -x --expanded -X --no-psqlrc \
+ -1 --single-transaction -? --help' -- "$cur" ) )
+ else
+ # return list of available databases
+ _pg_databases
+ fi
+}
+complete -F _psql $filenames psql
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/povray b/contrib/povray
index c69b0db4..4a4df011 100644
--- a/contrib/povray
+++ b/contrib/povray
@@ -1,59 +1,66 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz>
+have povray || have xpovray || have spovray &&
_povray()
{
- local cur prev povcur pfx oext defoext
- defoext=png # default output extension, if cannot be determined FIXME
+ local cur prev povcur pfx oext defoext
+ defoext=png # default output extension, if cannot be determined FIXME
- COMPREPLY=()
- povcur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ povcur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- _expand || return 0
+ _expand || return 0
- case $povcur in
- [-+]I*)
- cur="${povcur#[-+]I}" # to confuse _filedir
- pfx="${povcur%"$cur"}"
- _filedir pov
- COMPREPLY=( ${COMPREPLY[@]/#/$pfx} )
- return 0
- ;;
- [-+]O*)
- # guess what output file type user may want
- case $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
- [-+]FN) oext=png ;;
- [-+]FP) oext=ppm ;;
- [-+]F[CT]) oext=tga ;;
- *) oext=$defoext ;;
+ case $povcur in
+ [-+]I*)
+ cur="${povcur#[-+]I}" # to confuse _filedir
+ pfx="${povcur%"$cur"}"
+ _filedir pov
+ COMPREPLY=( ${COMPREPLY[@]/#/$pfx} )
+ return 0
+ ;;
+ [-+]O*)
+ # guess what output file type user may want
+ case $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
+ [-+]FN) oext=png ;;
+ [-+]FP) oext=ppm ;;
+ [-+]F[CT]) oext=tga ;;
+ *) oext=$defoext ;;
+ esac
+ # complete filename corresponding to previously specified +I
+ COMPREPLY=( $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ) )
+ COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
+ COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
+ cur="${povcur#[-+]O}" # to confuse _filedir
+ pfx="${povcur%"$cur"}"
+ _filedir $oext
+ COMPREPLY=( ${COMPREPLY[@]/#/$pfx} )
+ return 0
+ ;;
+ *.ini\[|*.ini\[*[^]]) # sections in .ini files
+ cur="${povcur#*\[}"
+ pfx="${povcur%\["$cur"}" # prefix == filename
+ [ -r "$pfx" ] || return 0
+ COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \
+ -e 't' -e 'd' -- "$pfx") )
+ # to prevent [bar] expand to nothing. can be done more easily?
+ COMPREPLY=( "${COMPREPLY[@]/#/$pfx[}" )
+ return 0
+ ;;
+ *)
+ cur="$povcur"
+ _filedir '?(ini|pov)'
+ return 0
+ ;;
esac
- # complete filename corresponding to previously specified +I
- COMPREPLY=( $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ) )
- COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
- COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
- cur="${povcur#[-+]O}" # to confuse _filedir
- pfx="${povcur%"$cur"}"
- _filedir $oext
- COMPREPLY=( ${COMPREPLY[@]/#/$pfx} )
- return 0
- ;;
- *.ini\[|*.ini\[*[^]]) # sections in .ini files
- cur="${povcur#*\[}"
- pfx="${povcur%\["$cur"}" # prefix == filename
- [ -r "$pfx" ] || return 0
- COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' -e 't' -e 'd' -- "$pfx") )
- # to prevent [bar] expand to nothing. can be done more easily?
- COMPREPLY=( "${COMPREPLY[@]/#/$pfx[}" )
- return 0
- ;;
- *)
- cur="$povcur"
- _filedir '?(ini|pov)'
- return 0
- ;;
- esac
-}
+} &&
complete -F _povray $filenames povray xpovray spovray
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/python b/contrib/python
new file mode 100644
index 00000000..6bd4e0ce
--- /dev/null
+++ b/contrib/python
@@ -0,0 +1,59 @@
+# bash completion for python
+
+have python &&
+_python()
+{
+ local prev cur i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]##*/}
+
+ case "$prev" in
+ -Q)
+ COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
+ return 0
+ ;;
+ -W)
+ COMPREPLY=( $( compgen -W "ignore default all module once error" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -c)
+ _filedir '@(py|pyc|pyo)'
+ return 0
+ ;;
+ !(python|-?))
+ [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
+ ;;
+ esac
+
+
+ # if '-c' is already given, complete all kind of files.
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -c ]]; then
+ _filedir
+ fi
+ done
+
+
+ if [[ "$cur" != -* ]]; then
+ _filedir '@(py|pyc|pyo)'
+ else
+ COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
+ -U -v -V -W -x -c" -- "$cur" ) )
+ fi
+
+
+
+ return 0
+} &&
+complete -F _python $filenames python
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/qdbus b/contrib/qdbus
index ba749c6a..1e70c708 100644
--- a/contrib/qdbus
+++ b/contrib/qdbus
@@ -1,20 +1,26 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# Qt qdbus completion
-#
+
have qdbus &&
_qdbus()
{
- local cur compstr
-
- COMPREPLY=()
- cur=`_get_cword`
- if [ -z "$cur" ]; then
- compstr=${COMP_WORDS[*]}
- else
- compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" )
- fi
- COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- "$cur" ) )
+ local cur compstr
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ if [ -z "$cur" ]; then
+ compstr=${COMP_WORDS[*]}
+ else
+ compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" )
+ fi
+ COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' \
+ -- "$cur" ) )
} &&
complete -F _qdbus qdbus
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/qemu b/contrib/qemu
index 7baeddf3..c129f0c3 100644
--- a/contrib/qemu
+++ b/contrib/qemu
@@ -1,100 +1,132 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for qemu
have qemu &&
_qemu()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm))
- _filedir
- return 0
- ;;
- -@(tftp|smb|L))
- _filedir -d
- return 0
- ;;
- -boot)
- COMPREPLY=( $( compgen -W 'a c d n' -- $cur ) )
- return 0
- ;;
- -k)
- COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja \
- mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\
- ru th de en-us fi fr-be hr it lv nl-be pt sl \
- tr' -- $cur ) )
- return 0
- ;;
- -soundhw)
- COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \
- '/^[[:lower:]]/ {print $1}' ) all" -- $cur ) )
- return 0
- ;;
- -M)
- COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \
- '/^[[:lower:]]/ {print $1}' )" -- $cur ) )
- return 0
- ;;
- -cpu)
- COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \
- '{print $2}' )" -- $cur ) )
- return 0
- ;;
- -usbdevice)
- COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \
- serial: braille net' -- $cur ) )
- return 0
- ;;
- -net)
- COMPREPLY=( $( compgen -W 'nic user tap socket vde none' \
- -- $cur ) )
- return 0
- ;;
- -@(serial|parallel|monitor))
- COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
- file: stdio pipe: COM udp: tcp: telnet: unix: \
- mon: braille' -- $cur ) )
- return 0
- ;;
- -redir)
- COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- $cur ) )
- return 0
- ;;
- -bt)
- COMPREPLY=( $( compgen -W 'hci vhci device' -- $cur ) )
- return 0
- ;;
- -vga)
- COMPREPLY=( $( compgen -W 'cirrus std vmware' -- $cur ) )
- return 0
- ;;
- -drive)
- COMPREPLY=( $( compgen -S"=" -W 'file if bus index media \
- cyls snapshot cache format' -- $cur ) )
- return 0
- ;;
- esac
+ case $prev in
+ -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm|mtdblock|sd|pflash|bios))
+ _filedir
+ return 0
+ ;;
+ -@(tftp|smb|L|chroot))
+ _filedir -d
+ return 0
+ ;;
+ -boot)
+ COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) )
+ return 0
+ ;;
+ -k)
+ COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja \
+ mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\
+ ru th de en-us fi fr-be hr it lv nl-be pt sl tr' -- "$cur" ) )
+ return 0
+ ;;
+ -soundhw)
+ COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \
+ '/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) )
+ return 0
+ ;;
+ -M)
+ COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \
+ '/^[[:lower:]]/ {print $1}' )" -- "$cur" ) )
+ return 0
+ ;;
+ -cpu)
+ COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \
+ '{print $2}' )" -- "$cur" ) )
+ return 0
+ ;;
+ -usbdevice)
+ COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \
+ serial: braille net' -- "$cur" ) )
+ return 0
+ ;;
+ -net)
+ COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -@(serial|parallel|monitor))
+ COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
+ file: stdio pipe: COM udp: tcp: telnet: unix: \
+ mon: braille' -- "$cur" ) )
+ return 0
+ ;;
+ -redir)
+ COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) )
+ return 0
+ ;;
+ -bt)
+ COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) )
+ return 0
+ ;;
+ -vga)
+ COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -drive)
+ COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media \
+ cyls snapshot cache format serial addr' -- "$cur" ) )
+ return 0
+ ;;
+ -ballon)
+ COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) )
+ return 0
+ ;;
+ -smbios)
+ COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) )
+ return 0
+ ;;
+ -watchdog)
+ COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | \
+ awk '{print $1}' )" -- "$cur" ) )
+ return 0
+ ;;
+ -watchdog-action)
+ COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause debug \
+ none' -- "$cur" ) )
+ return 0
+ ;;
+ -runas)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \
- -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \
- -k -audio-help -soundhw -localtime -full-screen -pidfile \
- -daemonize -win2k-hacks -option-rom -usb -usbdevice -net -tftp \
- -smb -redir -kernel -append -initrd -serial -parallel -monitor \
- -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \
- -semihosting -cpu -bt -vga -drive -startdate -name -curses \
- -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \
- -prom-env' -- $cur ) )
- else
- _filedir
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \
+ -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \
+ -k -audio-help -soundhw -localtime -full-screen -pidfile \
+ -daemonize -win2k-hack -option-rom -usb -usbdevice -net -tftp \
+ -smb -redir -kernel -append -initrd -serial -parallel -monitor \
+ -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \
+ -semihosting -cpu -bt -vga -drive -startdate -name -curses \
+ -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \
+ -prom-env -h -help -version -numa -mtdblock -sd -pflash \
+ -device -uuid -alt-grab -sdl -portrait -rtc-td-hack -no-hpet \
+ -balloon -acpitable -smbios -singlestep -gdb -hdachs -bios \
+ -kernel-kqemu -enable-kqemu -enable-kvm -clock -watchdog \
+ -watchdog-action -virtioconsole -show-cursor -tb-size -incoming \
+ -chroot -runas' -- "$cur" ) )
+ else
+ _filedir
+ fi
} &&
complete -F _qemu $filenames qemu
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/quota-tools b/contrib/quota-tools
index f77d1c35..bc5346c3 100644
--- a/contrib/quota-tools
+++ b/contrib/quota-tools
@@ -1,309 +1,264 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for quota-tools
have quota && {
_user_or_group()
{
- local i
-
- # complete on groups if -g was given
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -g ]]; then
- COMPREPLY=( $( compgen -g -- $cur ) )
- return 0
- fi
- done
-
- # otherwise complete on users
- COMPREPLY=( $( compgen -u -- $cur ) )
+ local i
+
+ # complete on groups if -g was given
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -g ]]; then
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ fi
+ done
+
+ # otherwise complete on users
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
}
_quota_formats()
{
- COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- $cur ) )
+ COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) )
}
_filesystems()
{
- # Only list filesystems starting with "/", otherwise we also get
- #+ "binfmt_misc", "proc", "tmpfs", ...
- COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
- -- $cur ) )
+ # Only list filesystems starting with "/", otherwise we also get
+ #+ "binfmt_misc", "proc", "tmpfs", ...
+ COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
+ -- "$cur" ) )
}
_quota()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-F --format= -g --group -u --user -v --verbose \
- -s --human-readable -p --raw-grace -i --no-autofs -l --local-only \
- -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \
- -w --no-wrap' -- $cur ) )
- else
- _user_or_group
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v \
+ --verbose -s --human-readable -p --raw-grace -i --no-autofs -l \
+ --local-only -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q \
+ --quiet-refuse -w --no-wrap' -- "$cur" ) )
+ else
+ _user_or_group
+ fi
}
complete -F _quota $default quota
_setquota()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -F --format= -g --group -u --user -p --prototype= -b --batch \
- -c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) )
- else
- _count_args
-
- case $args in
- 1)
- _user_or_group
- ;;
- 2)
- _filesystems
- ;;
- esac
-
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
+ -F --format -g --group -u --user -p --prototype -b --batch \
+ -c --continue-batch -t --edit-period -T --edit-times -a --all' \
+ -- "$cur" ) )
+ else
+ _count_args
+
+ case $args in
+ 1)
+ _user_or_group
+ ;;
+ 2)
+ _filesystems
+ ;;
+ esac
+
+ fi
}
complete -F _setquota $default setquota
_edquota()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- -@(f|-filesystem))
- _filesystems
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -g --group -u --user -p --prototype= -F --format= -f --filesystem \
- -t --edit-period -T --edit-times' -- $cur ) )
- else
- _user_or_group
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -@(f|-filesystem))
+ _filesystems
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
+ -g --group -u --user -p --prototype -F --format -f --filesystem \
+ -t --edit-period -T --edit-times' -- "$cur" ) )
+ else
+ _user_or_group
+ fi
}
complete -F _edquota $default edquota
_quotacheck()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \
- -g --group -u --user -c --create-files -f --force -i \
- --interactive -n --use-first-dquot -M --try-remount -m \
- --no-remount -R --exclude-root -F --format= -a --all' \
- -- $cur ) )
- else
- _filesystems
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \
+ -g --group -u --user -c --create-files -f --force -i \
+ --interactive -n --use-first-dquot -M --try-remount -m \
+ --no-remount -R --exclude-root -F --format -a --all' -- "$cur" ) )
+ else
+ _filesystems
+ fi
}
complete -F _quotacheck $default quotacheck
_repquota()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
- -c --batch-translation -C --no-batch-translation -t \
- --truncate-names -n --no-names -p --raw-grace -i --no-autofs \
- -u --user -g --group -F --format=' -- $cur ) )
- else
- _filesystems
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
+ -c --batch-translation -C --no-batch-translation -t \
+ --truncate-names -n --no-names -p --raw-grace -i --no-autofs \
+ -u --user -g --group -F --format' -- "$cur" ) )
+ else
+ _filesystems
+ fi
}
complete -F _repquota $default repquota
_quotaon()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- echo --$cmd--
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -f --off -p --print-state -F --format=' -- $cur ) )
- else
- _filesystems
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
+ -g --group -f --off -p --print-state -F --format' -- "$cur" ) )
+ else
+ _filesystems
+ fi
}
complete -F _quotaon $default quotaon
_quotaoff()
{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -F)
- _quota_formats
- return 0
- ;;
- -@(x|-xfs-command))
- COMPREPLY=( $( compgen -W 'delete enforce' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -p --print-state -x --xfs-command -F --format=' \
- -- $cur ) )
- else
- _filesystems
- fi
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -F|--format)
+ _quota_formats
+ return 0
+ ;;
+ -@(x|-xfs-command))
+ COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
+ -g --group -p --print-state -x --xfs-command -F --format' \
+ -- "$cur" ) )
+ else
+ _filesystems
+ fi
}
complete -F _quotaoff $default quotaoff
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rcs b/contrib/rcs
new file mode 100644
index 00000000..a6505deb
--- /dev/null
+++ b/contrib/rcs
@@ -0,0 +1,44 @@
+# bash completion for rcs
+
+have rcs &&
+_rcs()
+{
+ local cur prev file dir i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ file=${cur##*/}
+ dir=${cur%/*}
+
+ # deal with relative directory
+ [ "$file" = "$dir" ] && dir=.
+
+ COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
+
+ for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
+ file=${COMPREPLY[$i]##*/}
+ dir=${COMPREPLY[$i]%RCS/*}
+ COMPREPLY[$i]=$dir$file
+ done
+
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
+
+ for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
+ COMPREPLY[$i]=${COMPREPLY[$i]%,v}
+ done
+
+ # default to files if nothing returned and we're checking in.
+ # otherwise, default to directories
+ [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
+} &&
+complete -F _rcs $filenames ci co rlog rcs rcsdiff
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rdesktop b/contrib/rdesktop
index ba941eec..79514e7a 100644
--- a/contrib/rdesktop
+++ b/contrib/rdesktop
@@ -1,53 +1,58 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for rdesktop
have rdesktop &&
_rdesktop()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -k)
- COMPREPLY=( $( command ls \
- /usr/share/rdesktop/keymaps 2>/dev/null | \
- egrep -v '(common|modifiers)' ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- $HOME/.rdesktop/keymaps 2>/dev/null ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- ./keymaps 2>/dev/null ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- return 0
- ;;
- -a)
- COMPREPLY=( $( compgen -W '8 15 16 24' -- $cur ) )
- return 0
- ;;
- -x)
- COMPREPLY=( $( compgen -W 'b broadband m modem l lan' \
- -- $cur ) )
- return 0
- ;;
- -r)
- # FIXME: should do $nospace for the colon options
- COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
- printer: sound: lspci scard' -- $cur ) )
- return 0
- ;;
- esac
+ case $prev in
+ -k)
+ COMPREPLY=( $( command ls \
+ /usr/share/rdesktop/keymaps 2>/dev/null | \
+ egrep -v '(common|modifiers)' ) )
+ COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
+ $HOME/.rdesktop/keymaps 2>/dev/null ) )
+ COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
+ ./keymaps 2>/dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -a)
+ COMPREPLY=( $( compgen -W '8 15 16 24' -- "$cur" ) )
+ return 0
+ ;;
+ -x)
+ COMPREPLY=( $( compgen -W 'b broadband m modem l lan' \
+ -- $cur ) )
+ return 0
+ ;;
+ -r)
+ # FIXME: should do $nospace for the colon options
+ COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
+ printer: sound: lspci scard' -- "$cur" ) )
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
- -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
- -0 -4 -5' -- $cur ) )
- else
- _known_hosts
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
+ -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
+ -0 -4 -5' -- "$cur" ) )
+ else
+ _known_hosts_real "$cur"
+ fi
} &&
complete -F _rdesktop rdesktop
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/repomanage b/contrib/repomanage
new file mode 100644
index 00000000..8cb50206
--- /dev/null
+++ b/contrib/repomanage
@@ -0,0 +1,29 @@
+# bash completion for repomanage
+
+have repomanage &&
+_repomanage()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [[ "$prev" == -@(h|-help|k|-keep) ]] && return 0
+
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '-o --old -n --new -s --space -k \
+ --keep -c --nocheck -h --help' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
+} &&
+complete -F _repomanage $filenames repomanage
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/reportbug b/contrib/reportbug
new file mode 100644
index 00000000..b6cb5e26
--- /dev/null
+++ b/contrib/reportbug
@@ -0,0 +1,127 @@
+# bash completion for (Debian) reportbug package
+
+have reportbug &&
+_reportbug()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -f|--filename|-i|--include|--mta|-o|--output)
+ _filedir
+ return 0
+ ;;
+ -B|--bts)
+ COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
+ "$cur" ))
+ return 0
+ ;;
+ -e|--editor|--mua)
+ COMP_WORDS=(COMP_WORDS[0] "$cur")
+ COMP_CWORD=1
+ _command
+ return 0
+ ;;
+ --mode)
+ COMPREPLY=( $( compgen -W "novice standard expert" -- "$cur" ) )
+ return 0
+ ;;
+ -S|--severity)
+ COMPREPLY=( $( compgen -W "grave serious important normal \
+ minor wishlist" -- "$cur" ) )
+ return 0
+ ;;
+ -u|--ui|--interface)
+ COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) )
+ return 0
+ ;;
+ -t|--type)
+ COMPREPLY=( $( compgen -W "gnats debbugs" -- "$cur" ) )
+ return 0
+ ;;
+ -T|--tags)
+ COMPREPLY=( $( compgen -W "none \
+ woody potato sarge sarge-ignore etch etch-ignore \
+ lenny lenny-ignore sid experimental confirmed \
+ d-i fixed fixed-in-experimental fixed-upstream \
+ help l10n moreinfo patch pending security \
+ unreproducible upstream wontfix ipv6 lfs" -- "$cur" ))
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
+ --no-query-bts --query-bts -B --bts -c --configure \
+ --no-config-files --check-available -d --debug \
+ --no-check-available -e --editor --email -f \
+ --filename -g --gnupg -H --header -i --include -j \
+ --justification -l --ldap --no-ldap -L --list-cc -m \
+ --maintonly --mode --mua --mta --mutt -n --mh --nmh \
+ -o --output -p --print -P --pgp --proxy --http_proxy\
+ -q --quiet -Q --query-only --realname --report-quiet \
+ --reply-to --replyto -s --subject -S --severity \
+ --smtphost -t --type -T --tags --template -V -x \
+ --no-cc --package-version -z --no-compress \
+ --ui --interface -u \
+ wnpp boot-floppies kernel bugs.debian.org \
+ cdimage.debian.org general installation-reports \
+ listarchives lists.debian.org mirrors nm.debian.org \
+ press project qa.debian.org release-notes \
+ security.debian.org tech-ctte upgrade-reports \
+ www.debian.org' -- "$cur" ) \
+ $( apt-cache pkgnames -- "$cur" 2> /dev/null) )
+ _filedir
+ return 0
+} &&
+complete -F _reportbug $filenames reportbug
+
+have querybts &&
+_querybts()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -B|--bts)
+ COMPREPLY=( $( compgen -W "debian guug kde mandrake help" \
+ -- "$cur" ))
+ return 0
+ ;;
+ -u|--ui|--interface)
+ COMPREPLY=($( compgen -W "newt text gnome" -- "$cur" ))
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
+ -B --bts -l --ldap --no-ldap --proxy --http_proxy \
+ -s --source -w --web -u --ui --interface \
+ wnpp boot-floppies kernel bugs.debian.org \
+ cdimage.debian.org general installation-reports \
+ listarchives lists.debian.org mirrors nm.debian.org \
+ press project qa.debian.org release-notes \
+ security.debian.org tech-ctte upgrade-reports \
+ www.debian.org' -- "$cur" ) \
+ $( apt-cache pkgnames -- "$cur" 2> /dev/null) )
+} &&
+complete -F _querybts $filenames querybts
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/resolvconf b/contrib/resolvconf
new file mode 100644
index 00000000..70fedb0e
--- /dev/null
+++ b/contrib/resolvconf
@@ -0,0 +1,31 @@
+# bash completion for resolvconf
+
+have resolvconf &&
+_resolvconf()
+{
+ local cur command
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(a|d))
+ _available_interfaces
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -d -u' -- "$cur" ) )
+ fi
+} &&
+complete -F _resolvconf resolvconf
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rfkill b/contrib/rfkill
new file mode 100644
index 00000000..df3dde69
--- /dev/null
+++ b/contrib/rfkill
@@ -0,0 +1,38 @@
+# bash completion for rfkill
+
+have rfkill &&
+_rfkill()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
+ else
+ case $COMP_CWORD in
+ 1)
+ COMPREPLY=( $( compgen -W "help event list block unblock" \
+ -- "$cur" ) )
+ ;;
+ 2)
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ if [ $prev == block -o $prev == unblock ]; then
+ COMPREPLY=( $( compgen -W "$(rfkill list | awk -F: \
+ '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \
+ wwan gps" -- "$cur" ) )
+ fi
+ ;;
+ esac
+ fi
+} &&
+complete -F _rfkill rfkill
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ri b/contrib/ri
index 9ec520c0..1d550898 100644
--- a/contrib/ri
+++ b/contrib/ri
@@ -1,89 +1,96 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# ri completion for Ruby documentation by Ian Macdonald <ian@caliban.org>
+have ri && {
ri_get_methods()
{
- local regex
+ local regex
- if [ "$ri_version" = integrated ]; then
- if [ -z "$separator" ]; then
- regex="(Instance|Class)"
- elif [ "$separator" = "#" ]; then
- regex=Instance
- else
- regex=Class
- fi
+ if [ "$ri_version" = integrated ]; then
+ if [ -z "$separator" ]; then
+ regex="(Instance|Class)"
+ elif [ "$separator" = "#" ]; then
+ regex=Instance
+ else
+ regex=Class
+ fi
- COMPREPLY=( ${COMPREPLY[@]} \
- "$( ri ${classes[@]} 2>/dev/null | \
- ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
- /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
- end' | sort -u )" )
- else
- # older versions of ri didn't distinguish between class/module and
- # instance methods
- COMPREPLY=( ${COMPREPLY[@]} \
- "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
- ! /^-/ and ! /^ +(class|module): / then \
- print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
- end' | sort -u )" )
- fi
- COMPREPLY=( $( compgen $prefix -W '${COMPREPLY[@]}' -- $method ) )
+ COMPREPLY=( ${COMPREPLY[@]} \
+ "$( ri ${classes[@]} 2>/dev/null | ruby -ane \
+ 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
+ /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
+ end' | sort -u )" )
+ else
+ # older versions of ri didn't distinguish between class/module and
+ # instance methods
+ COMPREPLY=( ${COMPREPLY[@]} \
+ "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \
+ 'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \
+ print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
+ end' | sort -u )" )
+ fi
+ COMPREPLY=( $( compgen $prefix -W '${COMPREPLY[@]}' -- $method ) )
}
# needs at least Ruby 1.8.0 in order to use -W0
_ri()
{
- local cur class method prefix ri_path ri_version separator IFS
- local -a classes
+ local cur class method prefix ri_path ri_version separator IFS
+ local -a classes
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- ri_path=$(type -p ri)
- # which version of ri are we using?
- # -W0 is required here to stop warnings from older versions of ri
- # from being captured when used with Ruby 1.8.1 and later
- ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated
- [ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated
+ ri_path=$(type -p ri)
+ # which version of ri are we using?
+ # -W0 is required here to stop warnings from older versions of ri
+ # from being captured when used with Ruby 1.8.1 and later
+ ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated
+ [ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated
- # need to also split on commas
- IFS=$', \n\t'
- if [[ "$cur" == [A-Z]*[#.]* ]]; then
- [[ "$cur" == *#* ]] && separator=# || separator=.
- # we're completing on class and method
- class=${cur%$separator*}
- method=${cur#*$separator}
- classes=( $class )
- prefix="-P $class$separator"
- ri_get_methods
- return 0
- fi
+ # need to also split on commas
+ IFS=$', \n\t'
+ if [[ "$cur" == [A-Z]*[#.]* ]]; then
+ [[ "$cur" == *#* ]] && separator=# || separator=.
+ # we're completing on class and method
+ class=${cur%$separator*}
+ method=${cur#*$separator}
+ classes=( $class )
+ prefix="-P $class$separator"
+ ri_get_methods
+ return 0
+ fi
- if [ "$ri_version" = integrated ]; then
- # integrated ri from Ruby 1.9
- classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
- if /, [A-Z]+/ then print; end; end' ) )
- elif [ "$ri_version" = "ri 1.8a" ]; then
- classes=( $( ruby -W0 $ri_path | \
- ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
- if /^ .*[A-Z]/ then print; end; end' ))
- else
- classes=( $( ruby -W0 $ri_path | \
- ruby -ne 'if /^I have/..$stdin.eof then \
- if /^ .*[A-Z]/ then print; end; end' ))
- fi
+ if [ "$ri_version" = integrated ]; then
+ # integrated ri from Ruby 1.9
+ classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
+ if /, [A-Z]+/ then print; end; end' ) )
+ elif [ "$ri_version" = "ri 1.8a" ]; then
+ classes=( $( ruby -W0 $ri_path | \
+ ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
+ if /^ .*[A-Z]/ then print; end; end' ))
+ else
+ classes=( $( ruby -W0 $ri_path | \
+ ruby -ne 'if /^I have/..$stdin.eof then \
+ if /^ .*[A-Z]/ then print; end; end' ))
+ fi
- COMPREPLY=( $( compgen -W '${classes[@]}' -- $cur ) )
- if [[ "$cur" == [A-Z]* ]]; then
- # we're completing on class or module alone
- return 0
- fi
+ COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) )
+ if [[ "$cur" == [A-Z]* ]]; then
+ # we're completing on class or module alone
+ return 0
+ fi
- # we're completing on methods
- method=$cur
- ri_get_methods
-}
-complete -F _ri ri
+ # we're completing on methods
+ method=$cur
+ ri_get_methods
+ }
+ complete -F _ri ri
+ }
+
+ # Local variables:
+ # mode: shell-script
+ # sh-basic-offset: 4
+ # sh-indent-comment: t
+ # indent-tabs-mode: nil
+ # End:
+ # ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rpcdebug b/contrib/rpcdebug
new file mode 100644
index 00000000..196d1872
--- /dev/null
+++ b/contrib/rpcdebug
@@ -0,0 +1,58 @@
+# bash completion for rpcdebug
+
+have rpcdebug && {
+_rpcdebug_flags()
+{
+
+ local i module
+
+ for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -m ]]; then
+ module=${COMP_WORDS[i+1]}
+ fi
+ done
+
+ if [ -n "$module" ]; then
+ COMPREPLY=( $( compgen -W "$(rpcdebug -vh 2>&1 \
+ | grep '^'$module' '\
+ | awk '{$1 = ""; print $0}')" -- "$cur" ) )
+ fi
+}
+
+_rpcdebug()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -s)
+ _rpcdebug_flags
+ return 0
+ ;;
+ -c)
+ _rpcdebug_flags
+ return 0
+ ;;
+ -m)
+ COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-v -h -m -s -c' -- "$cur" ) )
+ fi
+}
+complete -F _rpcdebug rpcdebug
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rpm b/contrib/rpm
new file mode 100644
index 00000000..dbfcc8f9
--- /dev/null
+++ b/contrib/rpm
@@ -0,0 +1,297 @@
+# bash completion for rpm
+
+have rpm && {
+# helper functions
+
+_rpm_installed_packages()
+{
+ local nodig="$1" nosig="$2"
+
+ if [ -r /var/log/rpmpkgs -a \
+ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
+ # using RHL 7.2 or later - this is quicker than querying the DB
+ COMPREPLY=( $( sed -ne \
+ 's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \
+ /var/log/rpmpkgs ) )
+ else
+ _rpm_nodigsig
+ COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) )
+ fi
+}
+
+_rpm_groups()
+{
+ # TODO: shown completions are wrong but real ones work nevertheless
+ # http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
+ '%{group}\n' )" -- "$cur" ) )
+}
+
+_rpm_nodigsig()
+{
+ if [ -z "$nodig" -a -z "$nosig" ]; then
+ local rpmver
+
+ rpmver=$(rpm --version)
+ rpmver=${rpmver##* }
+
+ if [[ "$rpmver" > "4.0.4" ]]; then
+ nodig="--nodigest"
+ fi
+ if [[ "$rpmver" > "4.0.99" ]]; then
+ nosig="--nosignature"
+ fi
+ fi
+}
+
+# rpm(8) completion
+#
+_rpm()
+{
+ local cur prev opts nodig nosig
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ nodig=""
+ nosig=""
+ _rpm_nodigsig
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ # first parameter on line
+ case "$cur" in
+ -b*)
+ COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs' \
+ -- "$cur" ) )
+ ;;
+ -t*)
+ COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts' \
+ -- "$cur" ) )
+ ;;
+ --*)
+ COMPREPLY=( $( compgen -W '--help --version --initdb \
+ --checksig --recompile --rebuild --resign --addsign \
+ --rebuilddb --showrc --setperms --setugids --tarbuild \
+ --eval --install --upgrade --query --freshen --erase \
+ --verify --querytags --rmsource --rmspec --clean \
+ --import' -- "$cur" ) )
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '-b -e -E -F -i -q -t -U -V' \
+ -- "$cur" ) )
+ ;;
+ esac
+
+ return 0
+ fi
+
+ case "$prev" in
+ --@(@(db|exclude)path|prefix|relocate|root))
+ _filedir -d
+ return 0
+ ;;
+ --eval|-E)
+ # get a list of macros
+ COMPREPLY=( $( rpm --showrc | sed -ne \
+ 's/^-\?[0-9]\+[:=][[:space:]]\+\('${cur#%}'[^[:space:](]*\).*/\1/p' ) )
+ COMPREPLY=( "${COMPREPLY[@]/#/%}" )
+ return 0
+ ;;
+ --pipe)
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ ;;
+ --rcfile)
+ _filedir
+ return 0
+ ;;
+ --specfile)
+ # complete on .spec files
+ _filedir spec
+ return 0
+ ;;
+ --whatprovides)
+ if [[ "$cur" == */* ]]; then
+ _filedir
+ else
+ # complete on capabilities
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
+ --queryformat='%{providename}\n' )" -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ --whatrequires)
+ if [[ "$cur" == */* ]]; then
+ _filedir
+ else
+ # complete on capabilities
+ local IFS=$'\n'
+ COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
+ --queryformat='%{requirename}\n' )" \
+ -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ --target)
+ COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
+ 's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" \
+ -- "$cur" ) )
+ return 0
+ ;;
+ --define|-D)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
+ # options common to all modes
+ opts="--define --eval --macros --nodigest --nosignature --rcfile \
+ --quiet --pipe --verbose"
+
+ case "${COMP_WORDS[1]}" in
+ -@([iFU]*|-install|-freshen|-upgrade))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --percent --force \
+ --test --replacepkgs --replacefiles --root \
+ --excludedocs --includedocs --noscripts --ignorearch \
+ --dbpath --prefix --ignoreos --nodeps --allfiles \
+ --ftpproxy --ftpport --justdb --httpproxy --httpport \
+ --noorder --relocate --badreloc --notriggers \
+ --excludepath --ignoresize --oldpackage \
+ --queryformat --repackage --nosuggests" -- "$cur" ) )
+ else
+ _filedir 'rpm'
+ fi
+ ;;
+ -@(e|-erase))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --allmatches \
+ --noscripts --notriggers --nodeps --test --repackage" \
+ -- "$cur" ) )
+ else
+ _rpm_installed_packages "$nodig" "$nosig"
+ fi
+ ;;
+ -@(q*|-query))
+ # options common to all query types
+ opts="$opts --changelog --configfiles --conflicts --docfiles
+ --dump --enhances --filesbypkg --filecaps --fileclass
+ --filecolor --fileprovide --filerequire --filesbypkg
+ --info --list --obsoletes --pipe --provides
+ --queryformat --rcfile --requires --scripts --suggests
+ --triggeredby --triggers --whatprovides --whatrequires --xml"
+
+ if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
+ # -qf completion
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
+ --last --root --state" -- "$cur" ) )
+ else
+ _filedir
+ fi
+ elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
+ # -qg completion
+ _rpm_groups
+ elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
+ # -qp; uninstalled package completion
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
+ --httpport --httpproxy" -- "$cur" ) )
+ else
+ _filedir 'rpm'
+ fi
+ else
+ # -q; installed package completion
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
+ --last --root --state" -- "$cur" ) )
+ elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
+ _rpm_installed_packages "$nodig" "$nosig"
+ fi
+ fi
+ ;;
+ -@(K*|-checksig))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \
+ -- "$cur" ) )
+ else
+ _filedir 'rpm'
+ fi
+ ;;
+ -@([Vy]*|-verify))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --root --dbpath --nodeps \
+ --nogroup --nolinkto --nomode --nomtime --nordev --nouser \
+ --nofiles --noscripts --nomd5 --querytags --specfile \
+ --whatrequires --whatprovides" -- "$cur" ) )
+ # check whether we're doing file completion
+ elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
+ _filedir
+ elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
+ _rpm_groups
+ elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
+ _filedir 'rpm'
+ else
+ _rpm_installed_packages "$nodig" "$nosig"
+ fi
+ ;;
+ -[bt]*)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --short-circuit --timecheck \
+ --clean --rmsource --rmspec --test --sign --buildroot \
+ --target --nobuild --nodeps --nodirtokens" -- "$cur" ) )
+ elif [[ ${COMP_WORDS[1]} == -b* ]]; then
+ _filedir 'spec'
+ else
+ _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
+ fi
+ ;;
+ --re@(build|compile))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "$opts --nodeps --rmsource \
+ --rmspec --sign --nodirtokens --target" -- "$cur" ) )
+ else
+ _filedir '?(no)src.rpm'
+ fi
+ ;;
+ --tarbuild)
+ _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))'
+ ;;
+ --@(re|add)sign)
+ _filedir 'rpm'
+ ;;
+ --set@(perms|gids))
+ _rpm_installed_packages "$nodig" "$nosig"
+ ;;
+ --@(clean|rms@(ource|pec)))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--clean --rmsource --rmspec' \
+ -- "$cur" ) )
+ else
+ _filedir 'spec'
+ fi
+ ;;
+ --@(import|dbpath|root))
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--import --dbpath --root' \
+ -- "$cur" ) )
+ else
+ _filedir
+ fi
+ ;;
+ esac
+
+ return 0
+}
+complete -F _rpm $filenames rpm rpmbuild
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rpmcheck b/contrib/rpmcheck
new file mode 100644
index 00000000..49240fd1
--- /dev/null
+++ b/contrib/rpmcheck
@@ -0,0 +1,34 @@
+# bash completion for rpmcheck
+
+have rpmcheck &&
+_rpmcheck()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -base)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-explain -failures -successes \
+ -dump -dump-all -base -help -compressed-input' -- "$cur" ) )
+ else
+ _filedir
+ fi
+} &&
+complete -F _rpmcheck rpmcheck $files
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rrdtool b/contrib/rrdtool
new file mode 100644
index 00000000..891df683
--- /dev/null
+++ b/contrib/rrdtool
@@ -0,0 +1,18 @@
+# bash completion for rrdtool
+
+have rrdtool &&
+_rrdtool ()
+{
+ cur=`_get_cword`
+ COMPREPLY=( $( compgen -W 'create update updatev graph dump restore last \
+ lastupdate first info fetch tune resize xport' -- "$cur" ) )
+} &&
+complete -F _rrdtool rrdtool
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/rsync b/contrib/rsync
new file mode 100644
index 00000000..c8dc6cf2
--- /dev/null
+++ b/contrib/rsync
@@ -0,0 +1,101 @@
+# bash completion for rsync
+
+have rsync &&
+_rsync()
+{
+ # TODO: _split_longopt
+
+ local cur prev shell i userhost path
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _expand || return 0
+
+ case "$prev" in
+ --@(config|password-file|include-from|exclude-from))
+ _filedir
+ return 0
+ ;;
+ -@(T|-temp-dir|-compare-dest))
+ _filedir -d
+ return 0
+ ;;
+ -@(e|-rsh))
+ COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
+ -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
+ -z -h -4 -6 --verbose --quiet --checksum \
+ --archive --recursive --relative --backup \
+ --backup-dir --suffix= --update --links \
+ --copy-links --copy-unsafe-links --safe-links \
+ --hard-links --perms --owner --group --devices\
+ --times --sparse --dry-run --whole-file \
+ --no-whole-file --one-file-system \
+ --block-size= --rsh= --rsync-path= \
+ --cvs-exclude --existing --ignore-existing \
+ --delete --delete-excluded --delete-after \
+ --ignore-errors --max-delete= --partial \
+ --force --numeric-ids --timeout= \
+ --ignore-times --size-only --modify-window= \
+ --temp-dir= --compare-dest= --compress \
+ --exclude= --exclude-from= --include= \
+ --include-from= --version --daemon --no-detach\
+ --address= --config= --port= --blocking-io \
+ --no-blocking-io --stats --progress \
+ --log-format= --password-file= --bwlimit= \
+ --write-batch= --read-batch= --help' -- "$cur" ))
+ ;;
+ *:*)
+ # find which remote shell is used
+ shell=ssh
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
+ shell=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ if [[ "$shell" == ssh ]]; then
+ # remove backslash escape from :
+ cur=${cur/\\:/:}
+ userhost=${cur%%?(\\):*}
+ path=${cur#*:}
+ # unescape spaces
+ path=${path//\\\\\\\\ / }
+ if [ -z "$path" ]; then
+ # default to home dir of specified
+ # user on remote host
+ path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
+ fi
+ # escape spaces; remove executables, aliases, pipes
+ # and sockets; add space at end of file names
+ COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
+ command ls -aF1d "$path*" 2>/dev/null | \
+ sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
+ -e 's/[^\/]$/& /g' ) )
+ fi
+ ;;
+ *)
+ _known_hosts_real -c -a "$cur"
+ _filedir
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _rsync $nospace $filenames rsync
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/samba b/contrib/samba
new file mode 100644
index 00000000..7256906e
--- /dev/null
+++ b/contrib/samba
@@ -0,0 +1,305 @@
+# bash completion for samba
+
+have smbclient && {
+_samba_resolve_order()
+{
+ COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) )
+}
+
+_samba_domains()
+{
+ if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) )
+ fi
+}
+
+_samba_hosts()
+{
+ if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
+ COMPREPLY=( $( compgen -W "$( smbtree -N -S | \
+ sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \
+ )" -- $cur ) )
+ fi
+}
+
+_samba_debuglevel()
+{
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+}
+
+_smbclient()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -R)
+ _samba_resolve_order
+ return 0;
+ ;;
+ -t)
+ COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' \
+ -- "$cur" ) )
+ return 0;
+ ;;
+ -s|-A|--authentication-file)
+ _filedir
+ return 0;
+ ;;
+ -l|--log-basename|-D)
+ _filedir -d
+ return 0;
+ ;;
+ -O)
+ COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \
+ SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \
+ IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \
+ SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
+ return 0;
+ ;;
+ -T)
+ COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- "$cur" ) )
+ return 0;
+ ;;
+ -W|--workgroup)
+ _samba_domains
+ return 0;
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ -p|--port|-M|-I|-b|-U|--user|-n|-i|-T|-c)
+ # argument required but no completions available
+ return 0
+ ;;
+ -\?|--help|-V|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
+ -p -R -s -k -P -c -D -W -l -E --debuglevel \
+ --log-basename --workgroup' -- "$cur" ) )
+ fi
+}
+complete -F _smbclient smbclient
+
+_smbget()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -@(o|f|-outputfile|-rcfile))
+ _filedir
+ return 0;
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --guest -r --resume -R --recursive -u \
+ --username -p --password -w --workgroup -n --nonprompt -d \
+ --debuglevel -D --dots -P --keep-permissions -o --outputfile -f \
+ --rcfile -q --quiet -v --verbose -b --blocksize -? --help --usage' \
+ -- "$cur" ) )
+ fi
+}
+complete -F _smbget smbget
+
+_smbcacls()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -s)
+ _filedir
+ return 0;
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0;
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
+ -h --help -V -s -d --debuglevel -l --log-basename' -- "$cur" ) )
+ fi
+}
+complete -F _smbcacls smbcacls
+
+_smbcquotas()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -s|-A|--authentication-file)
+ _filedir
+ return 0;
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0;
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
+ -s -d --debuglevel -l --log-basename -N -k -A \
+ --authentication-file -U --user' -- "$cur" ) )
+ fi
+}
+complete -F _smbcquotas smbcquotas
+
+_smbpasswd()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -r)
+ _samba_hosts
+ return 0;
+ ;;
+ -R)
+ _samba_resolve_order
+ return 0;
+ ;;
+ -c)
+ _filedir
+ return 0;
+ ;;
+ -D)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \
+ -s -w -W -i -L' -- "$cur" ) )
+ fi
+}
+complete -F _smbpasswd smbpasswd
+
+_smbtar()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -@(r|t))
+ _filedir tar
+ return 0;
+ ;;
+ -s)
+ _samba_hosts
+ return 0;
+ ;;
+ -l)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l -u -t' \
+ -- "$cur" ) )
+ fi
+}
+complete -F _smbtar smbtar
+
+_smbtree()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case $prev in
+ -s|-A|--authentication-file)
+ _filedir
+ return 0;
+ ;;
+ -l|--log-basename)
+ _filedir -d
+ return 0;
+ ;;
+ -d|--debuglevel)
+ _samba_debuglevel
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
+ --log-basename -N -k -A --authentication-file -U --user\
+ -h --help' -- "$cur" ) )
+ fi
+}
+complete -F _smbtree smbtree
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/sbcl b/contrib/sbcl
index 1b14eea3..7a12f89d 100644
--- a/contrib/sbcl
+++ b/contrib/sbcl
@@ -1,9 +1,7 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash programmable completion for various Common Lisp implementations by
# Nikodemus Siivola <nikodemus@random-state.net>
+have sbcl || have sbcl-mt &&
_sbcl()
{
local cur
@@ -13,13 +11,21 @@ _sbcl()
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--core --noinform --help --version \
- --sysinit --userinit --eval --noprint --disable-debugger \
- --end-runtime-options --end-toplevel-options ' -- $cur ) )
+ COMPREPLY=( $( compgen -W '--core --noinform --help --version \
+ --sysinit --userinit --eval --noprint --disable-debugger \
+ --end-runtime-options --end-toplevel-options ' -- "$cur" ) )
else
- _filedir
+ _filedir
fi
return 0
-}
-complete -F _sbcl $default sbcl sbcl-mt
+} &&
+complete -F _sbcl $filenames sbcl sbcl-mt
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/screen b/contrib/screen
new file mode 100644
index 00000000..cd6baea2
--- /dev/null
+++ b/contrib/screen
@@ -0,0 +1,69 @@
+# bash completion for screen
+
+have screen &&
+_screen_sessions()
+{
+ local pattern
+
+ if [ -n "$1" ]; then
+ pattern=".*$1.*"
+ else
+ pattern=".*"
+ fi
+
+ COMPREPLY=( $( command screen -ls | sed -ne \
+ 's|^['$'\t'']\+\('"$cur"'[0-9]\+\.[^'$'\t'']\+\)'"$pattern"'$|\1|p' ) )
+} &&
+_screen()
+{
+ local cur prev preprev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
+
+ case "$preprev" in
+ -[dD])
+ _screen_sessions
+ return 0
+ ;;
+ esac
+
+ case "$prev" in
+ -[rR])
+ # list detached
+ _screen_sessions 'Detached'
+ return 0
+ ;;
+ -[dDx])
+ # list attached
+ _screen_sessions 'Attached'
+ return 0
+ ;;
+ -s)
+ # shells
+ COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
+ ;;
+ -c)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i \
+ -l -ln -ls -list -L -m -O -p -q -r -R -s -S -t -U -v \
+ -wipe -x -X' -- "$cur" ) )
+ fi
+} &&
+complete -F _screen $default screen
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/shadow b/contrib/shadow
new file mode 100644
index 00000000..c72718d0
--- /dev/null
+++ b/contrib/shadow
@@ -0,0 +1,501 @@
+# bash completion for shadow utils
+
+have useradd &&
+_useradd()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ # TODO: if -o/--non-unique is given, could complete on existing uids
+ # with -u/--uid
+
+ case "$prev" in
+ -c|--comment|-h|--help|-e|--expiredate|-f|--inactive|-k|--key|-p|--password|-u|--uid|-Z|--selinux-user)
+ return 0
+ ;;
+ -b|--base-dir|-d|--home|-k|--skel)
+ _filedir -d
+ return 0
+ ;;
+ -g|--gid)
+ _gids
+ [ -n "$bash205" ] && \
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -G|--groups)
+ [ -n "$bash205" ] && \
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ ;;
+ -s|--shell)
+ _shells
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b --base-dir -c --comment -d --home\
+ -D --defaults -e --expiredate -f --inactive -g --gid \
+ -G --groups -h --help -k --skel -K --key -l -M \
+ -m --create-home -N --no-user-group -o --non-unique \
+ -p --password -r --system -s --shell -u --uid \
+ -U --user-group -Z --selinux-user' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _useradd useradd
+
+have usermod &&
+_usermod()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ # TODO: if -o/--non-unique is given, could complete on existing uids
+ # with -u/--uid
+
+ case "$prev" in
+ -c|--comment|-d|--home|-e|--expiredate|-f|--inactive|-h|--help|-l|--login|-p|--password|-u|--uid|-Z|--selinux-user)
+ return 0
+ ;;
+ -g|--gid)
+ _gids
+ [ -n "$bash205" ] && \
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
+ return 0
+ ;;
+ -G|--groups)
+ [ -n "$bash205" ] && \
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ ;;
+ -s|--shell)
+ _shells
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ # TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive
+ COMPREPLY=( $( compgen -W '-a --append -c --comment -d --home \
+ -e --expiredate -f --inactive -g --gid -G --groups \
+ -h --help -l --login -L --lock -o --non-unique \
+ -p --password -s --shell -u --uid -U --unlock \
+ -Z --selinux-user' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+} &&
+complete -F _usermod usermod
+
+have userdel &&
+_userdel()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f --force -h --help -r --remove' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+} &&
+complete -F _userdel userdel
+
+have chage &&
+_chage()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|-M|--maxdays|-W|--warndays)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-d --lastday -E --expiredate \
+ -h --help -I --inactive -l --list -m --mindays \
+ -M --maxdays -W --warndays' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+} &&
+complete -F _chage chage
+
+have passwd &&
+_passwd()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -n|-x|-w|-i|-\?|--help|--usage)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \
+ -? --help --usage' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+} &&
+complete -F _passwd passwd
+
+have chpasswd &&
+_chpasswd()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -c|--crypt)
+ COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -s|--sha-rounds)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --crypt-method -e --encrypted \
+ -h --help -m --md5 -s --sha-rounds' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _chpasswd chpasswd
+
+have newusers &&
+_newusers()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -c|--crypt)
+ COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ -s|--sha-rounds)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c --crypt-method --r --system \
+ -s --sha-rounds' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _newusers $filenames newusers
+
+have pwck &&
+_pwck()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _pwck $filenames pwck
+
+have groupadd &&
+_groupadd()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ # TODO: if -o/--non-unique is given, could complete on existing gids
+ # with -g/--gid
+
+ case "$prev" in
+ -g|--gid|-K|--key|-p|--password)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-f --force -g --gid -h --help \
+ -K --key -o --non-unique -p --password -r --system' \
+ -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _groupadd groupadd
+
+have groupmod &&
+_groupmod()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ # TODO: if -o/--non-unique is given, could complete on existing gids
+ # with -g/--gid
+
+ case "$prev" in
+ -g|--gid|-h|--help|-n|--new-name|-p|--password)
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-g --gid -h --help -n --new-name \
+ -o --non-unique -p --password' -- "$cur" ) )
+ return 0
+ fi
+
+ [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+} &&
+complete -F _groupmod groupmod
+
+[ -n "$bash205" ] && complete -g groupdel
+
+have newgrp &&
+_newgrp()
+{
+ COMPREPLY=()
+ if [[ "`_get_cword`" == "-" ]]; then
+ COMPREPLY=( - )
+ fi
+} &&
+complete ${bash205:+-g} -F _newgrp newgrp
+
+have gpasswd &&
+_gpasswd()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -a|-d|-A|-M)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -d -r -R -A -M' -- "$cur" ) )
+ return 0
+ fi
+
+ [ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
+} &&
+complete -F _gpasswd gpasswd
+
+have groupmems &&
+_groupmems()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -a|-d)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -g)
+ [ -n "$bash205" ] && \
+ COMPREPLY=( $( compgen -g -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -d -p -g -l' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _groupmems groupmems
+
+have grpck &&
+_grpck()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir
+} &&
+complete -F _grpck $filenames grpck
+
+have vipw || have vigr &&
+_vipw()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -h|--help)
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-g --group -h --help -p --passwd \
+ -q --quiet -s --shadow' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _vipw vipw vigr
+
+have faillog &&
+_faillog()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -h|--help|-l|--lock-time|-m|--maximum|-t|--time)
+ return 0
+ ;;
+ -u|--user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a --all -h --help -l --lock-time \
+ -m --maximum -r --reset -t --time -u --user' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _faillog faillog
+
+have lastlog &&
+_lastlog()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -b|--before|-h|--help|-t|--time)
+ return 0
+ ;;
+ -u|--user)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b --before -h --help -t --time \
+ -u --user' -- "$cur" ) )
+ return 0
+ fi
+} &&
+complete -F _lastlog lastlog
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/sitecopy b/contrib/sitecopy
index 088951cd..abf3d928 100644
--- a/contrib/sitecopy
+++ b/contrib/sitecopy
@@ -1,31 +1,40 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# sitecopy(1) completion
# Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net>
# License: GNU GPL v2 or later
+have sitecopy &&
_sitecopy()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- case "$cur" in
- --*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ) )
- ;;
- -*)
- COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- $cur ) )
- ;;
- *)
- if [ -r ~/.sitecopyrc ]; then
- COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site' ~/.sitecopyrc | awk '{print $2}')" -- $cur ) )
- fi
- ;;
- esac
+ case "$cur" in
+ --*)
+ COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | \
+ awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) )
+ ;;
+ -*)
+ COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | \
+ awk '{sub (",", "", $1); print $1}')" -- "$cur" ) )
+ ;;
+ *)
+ if [ -r ~/.sitecopyrc ]; then
+ COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site' \
+ ~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
+ fi
+ ;;
+ esac
- return 0
-}
+ return 0
+} &&
complete -F _sitecopy $default sitecopy
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/smartctl b/contrib/smartctl
new file mode 100644
index 00000000..5108269f
--- /dev/null
+++ b/contrib/smartctl
@@ -0,0 +1,149 @@
+# bash completion for smartctl(8)
+
+have smartctl && {
+_smartctl_quietmode()
+{
+ COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
+}
+_smartctl_device()
+{
+ local i opts='ata scsi sat marvell hpt cciss'
+ for (( i=0; i <= 31; i++ )) ; do
+ opts="$opts 3ware,$i"
+ done
+ COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+}
+_smartctl_tolerance()
+{
+ COMPREPLY=( $( compgen -W 'normal conservative permissive \
+ verypermissive' -- "$cur" ) )
+}
+_smartctl_badsum()
+{
+ COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
+}
+_smartctl_report()
+{
+ COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
+}
+_smartctl_powermode()
+{
+ COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
+}
+_smartctl_feature()
+{
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+}
+_smartctl_log()
+{
+ COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
+}
+_smartctl_vendorattribute()
+{
+ COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
+ 9,temp 192,emergencyretractcyclect 193,loadunload \
+ 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
+ 200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
+}
+_smartctl_firmwarebug()
+{
+ COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
+ -- "$cur" ) )
+}
+_smartctl_presets()
+{
+ COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
+}
+_smartctl_test()
+{
+ COMPREPLY=( $( compgen -W 'offline short long conveyance select \
+ afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
+}
+
+
+_smartctl()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _split_longopt && split=true
+
+ case "$prev" in
+ -q|--quietmode)
+ _smartctl_quietmode
+ ;;
+ -d|--device)
+ _smartctl_device
+ return 0
+ ;;
+ -t|--tolerance)
+ _smartctl_tolerance
+ return 0
+ ;;
+ -b|--badsum)
+ _smartctl_badsum
+ return 0
+ ;;
+ -r|--report)
+ _smartctl_report
+ return 0
+ ;;
+ -n|--nocheck)
+ _smartctl_powermode
+ return 0
+ ;;
+ -s|--smart|-o|--offlineauto|-S|--saveauto)
+ _smartctl_feature
+ return 0
+ ;;
+ -l|--log)
+ _smartctl_log
+ return 0
+ ;;
+ -v|--vendorattribute)
+ _smartctl_vendorattribute
+ return 0
+ ;;
+ -F|--firmwarebug)
+ _smartctl_firmwarebug
+ return 0
+ ;;
+ -P|--presets)
+ _smartctl_presets
+ return 0
+ ;;
+ -t|--test)
+ _smartctl_test
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
+ --copyright --license-i --info -a --all -q \
+ --quietmode -d --device -T --tolerance -b --badsum \
+ -r --report -n --nocheck -s --smart -o --offlineauto \
+ -S --saveauto -H --health -c --capabilities -A \
+ --attributes -l --log -v --vendorattribute -F \
+ --firmwarebug -P --presets -t --test -C \
+ --captive -X --abort' -- "$cur" ) )
+ else
+ cur=${cur:=/dev/}
+ _filedir
+ fi
+}
+complete -F _smartctl smartctl
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/snownews b/contrib/snownews
index 89007678..8d89b78c 100644
--- a/contrib/snownews
+++ b/contrib/snownews
@@ -1,19 +1,25 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# snownews completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
+have snownews &&
_snownews()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '--update --help --version \
- --disable-versioncheck -u -h -V' -- $cur))
- fi
-}
+ if [[ "$cur" == -* ]]; then
+ # return list of available options
+ COMPREPLY=( $( compgen -W '--update --help --version \
+ --disable-versioncheck -u -h -V' -- "$cur"))
+ fi
+} &&
complete -F _snownews snownews
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/ssh b/contrib/ssh
index 85325aa2..0215ffd7 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -1,13 +1,32 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# ssh(1) completion
-#
+
have ssh && {
+
+_ssh_options() {
+ COMPREPLY=( $( compgen -W 'AddressFamily BatchMode BindAddress \
+ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \
+ ClearAllForwardings Compression CompressionLevel \
+ ConnectionAttempts ConnectTimeout ControlMaster ControlPath \
+ DynamicForward EscapeChar ExitOnForwardFailure ForwardAgent \
+ ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile \
+ GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts \
+ Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias \
+ HostName IdentityFile IdentitiesOnly KbdInteractiveDevices \
+ LocalCommand LocalForward LogLevel MACs \
+ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \
+ PasswordAuthentication PermitLocalCommand Port \
+ PreferredAuthentications Protocol ProxyCommand \
+ PubkeyAuthentication RekeyLimit RemoteForward \
+ RhostsRSAAuthentication RSAAuthentication SendEnv \
+ ServerAliveInterval ServerAliveCountMax SmartcardDevice \
+ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
+ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
+ VisualHostKey XAuthLocation' -- "$cur" ) )
+}
+
_ssh()
{
- local cur prev
- local optconfigfile
+ local cur prev configfile
local -a config
COMPREPLY=()
@@ -15,51 +34,136 @@ _ssh()
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
- -F)
+ -@(F|i|S))
+ _filedir
+ return 0
+ ;;
+ -c)
+ COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \
+ aes192-cbc aes256-cbc aes128-ctr aes192-ctr \
+ aes256-ctr arcfour128 arcfour256 arcfour \
+ blowfish-cbc cast128-cbc' -- "$cur" ) )
+ return 0
+ ;;
+ -c)
+ COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
+ umac-64@openssh.com hmac-ripemd160 \
+ hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
+ return 0
+ ;;
+ -l)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
+ -w)
+ _available_interfaces
+ return 0
+ ;;
+ -b)
+ COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
+ awk '/adr:/ {print $2}' | \
+ awk -F: '{print $2}' )" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
_filedir
- ;;
- -*c)
- COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
- arcfour cast128-cbc' -- $cur ) )
- ;;
- -*i)
- _filedir
- ;;
- -*l)
- COMPREPLY=( $( compgen -u -- $cur ) )
- ;;
- *)
- # Search COMP_WORDS for '-F configfile' argument
+ # Prefix completions with '-F'
+ COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
+ cur=-F$cur # Restore cur
+ elif [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
+ -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
+ -i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
set -- "${COMP_WORDS[@]}"
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
- optconfigfile="$(dequote "$1")"
+ configfile="$(dequote "${1:2}")"
else
shift
- [ "$1" ] && optconfigfile="$(dequote "-F$1")"
+ [ "$1" ] && configfile="$(dequote "$1")"
fi
break
fi
shift
done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ if [ $COMP_CWORD -ne 1 ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
+ fi
+ fi
- _known_hosts -a "$optconfigfile"
+ return 0
+}
+shopt -u hostcomplete && complete -F _ssh ssh slogin autossh
- [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
+# sftp(1) completion
+#
+_sftp()
+{
+ local cur prev configfile
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(b|F|P))
+ _filedir
+ return 0
+ ;;
+ -o)
+ _ssh_options
+ return 0
+ ;;
esac
+ if [[ "$cur" == -F* ]]; then
+ cur=${cur#-F}
+ _filedir
+ # Prefix completions with '-F'
+ COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
+ cur=-F$cur # Restore cur
+ elif [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
+ -- "$cur" ) )
+ else
+ # Search COMP_WORDS for '-F configfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
+ fi
+ shift
+ done
+ _known_hosts_real -a -F "$configfile" "$cur"
+ fi
+
return 0
}
-shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh
+shopt -u hostcomplete && complete -F _sftp sftp
+
# scp(1) completion
#
_scp()
{
- local cur userhost path
- local optconfigfile
+ local configfile cur userhost path prefix
COMPREPLY=()
cur=`_get_cword ":"`
@@ -81,40 +185,43 @@ _scp()
# escape spaces; remove executables, aliases, pipes and sockets;
# add space at end of file names
COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
- command ls -aF1d "$path*" 2>/dev/null | \
- sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \
- -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
+ command ls -aF1d "$path*" 2>/dev/null | \
+ sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \
+ -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
return 0
fi
- # Search COMP_WORDS for '-F configfile' argument
- set -- "${COMP_WORDS[@]}"
- while [ $# -gt 0 ]; do
- if [ "${1:0:2}" = -F ]; then
- if [ ${#1} -gt 2 ]; then
- optconfigfile="$(dequote "$1")"
- else
- shift
- [ "$1" ] && optconfigfile="$(dequote "-F$1")"
+ if [[ "$cur" = -F* ]]; then
+ cur=${cur#-F}
+ prefix=-F
+ else
+ # Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
+ set -- "${COMP_WORDS[@]}"
+ while [ $# -gt 0 ]; do
+ if [ "${1:0:2}" = -F ]; then
+ if [ ${#1} -gt 2 ]; then
+ configfile="$(dequote "${1:2}")"
+ else
+ shift
+ [ "$1" ] && configfile="$(dequote "$1")"
+ fi
+ break
fi
- break
- fi
- shift
- done
-
- [[ "$cur" == */* ]] || _known_hosts -c -a "$optconfigfile"
+ shift
+ done
+ [[ "$cur" == */* ]] || _known_hosts_real -c -a -F "$configfile" "$cur"
+ fi
# This approach is used instead of _filedir to get a space appended
# after local file/dir completions, and $nospace retained for others.
local IFS=$'\t\n'
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
- 2>/dev/null | sed \
- -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
- -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
+ -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
+ -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") )
return 0
}
-complete -F _scp $nospace scp
+complete -F _scp $nospace scp sshfs
# ssh-copy-id(1) completion
#
@@ -126,17 +233,27 @@ _ssh_copy_id() {
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
- -*i)
- _filedir
- ;;
- *)
- _known_hosts -a
-
- [ $COMP_CWORD -eq 1 ] || \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -- $cur ) )
+ -i)
+ _filedir
+ return 0
+ ;;
esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
+ else
+ _known_hosts_real -a "$cur"
+ fi
+
return 0
}
complete -F _ssh_copy_id $filenames ssh-copy-id
}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/strace b/contrib/strace
new file mode 100644
index 00000000..7925890a
--- /dev/null
+++ b/contrib/strace
@@ -0,0 +1,103 @@
+# bash completion for strace
+
+have strace &&
+_strace()
+{
+ local cur prev offset i syscalls arch unistd
+
+ # check if we're still completing strace
+ offset=0
+ for (( i=1; i <= COMP_CWORD; i++ )); do
+ case ${COMP_WORDS[$i]} in
+ -@(o|e|p))
+ i=$((i+1))
+ continue
+ ;;
+ -*)
+ continue
+ ;;
+ esac
+ offset=$i
+ break
+ done
+
+ if [ $offset -gt 0 ]; then
+ # FAIL: _command_offset is not defined anywhere. Guillame?
+ _command_offset $offset
+ else
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ -e)
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur/=*/}
+ cur=${cur/*=/}
+
+ # Import arch-specific syscalls -- not foolproof IMHO
+ #+ --David Paleino
+ arch=$(command uname -m)
+ syscalls=$(awk '/^#define __NR/ {print $2}' \
+ /usr/include/asm/unistd.h | sed -e \
+ 's/__NR_//')
+ if [ -z "$syscalls" ]; then
+ if [[ "$arch" =~ 86$ ]]; then
+ unistd=/usr/include/asm/unistd_32.h
+ else
+ unistd=/usr/include/asm/unistd_64.h
+ fi
+ syscalls=$(awk '/^#define __NR/ {print $2}' \
+ $unistd | sed -e 's/__NR_//')
+ fi
+
+ case $prev in
+ trace)
+ COMPREPLY=( $( compgen -W "$syscalls file process \
+ network signal ipc desc all none" -- "$cur") )
+ return 0
+ ;;
+ esac
+ else
+ COMPREPLY=( $( compgen -S"=" -W 'trace abbrev \
+ verbose raw signal read write' -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ -o)
+ _filedir
+ return 0
+ ;;
+ -p)
+ _pids
+ return 0
+ ;;
+ -S)
+ COMPREPLY=( $( compgen -W 'time calls name nothing' -- "$cur" ) )
+ return 0
+ ;;
+ -u)
+ COMPREPLY=( $( compgen -u -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -f -ff -F -h --help -i -q \
+ -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p \
+ -s -S -u -E' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ fi
+ fi
+} &&
+complete -F _strace $default strace
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/svk b/contrib/svk
index e2d0fac7..1b6f70fd 100644
--- a/contrib/svk
+++ b/contrib/svk
@@ -1,263 +1,227 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# svk completion by Guillaume Rousse <guillomovitch@zarb.org>
+have svk &&
_svk()
{
- local cur prev commands options command
+ local cur prev commands options command
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- commands='add admin annotate ann blame praise cat checkout co cleanup \
- cmerge cm commit ci copy cp delete del remove rm depotmap \
- depot describe desc diff di help h ? import info list ls log \
- merge mirror mi mkdir move mv ren rename patch propdel pd pdel \
- propedit pe pedit propget pg pget proplist pl plist propset ps \
- pset pull push resolved revert smerge sm status st stat switch \
- sw sync sy update up verify'
+ commands='add admin annotate ann blame praise cat checkout co cleanup \
+ cmerge cm commit ci copy cp delete del remove rm depotmap \
+ depot describe desc diff di help h ? import info list ls log \
+ merge mirror mi mkdir move mv ren rename patch propdel pd pdel \
+ propedit pe pedit propget pg pget proplist pl plist propset ps \
+ pset pull push resolved revert smerge sm status st stat switch \
+ sw sync sy update up verify'
- if [[ $COMP_CWORD -eq 1 ]] ; then
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--version' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
- fi
- else
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
+ fi
+ else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -@(F|-file|-targets))
- _filedir
- return 0;
- ;;
- --encoding)
- COMPREPLY=( $( compgen -W \
- '$( iconv --list | sed -e "s@//@@;" )' \
- -- "$cur" ) )
- return 0;
- ;;
- esac
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case $prev in
+ -@(F|-file|-targets))
+ _filedir
+ return 0;
+ ;;
+ --encoding)
+ COMPREPLY=( $( compgen -W \
+ '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
+ return 0;
+ ;;
+ esac
- command=${COMP_WORDS[1]}
+ command=${COMP_WORDS[1]}
- if [[ "$cur" == -* ]]; then
- # possible options for the command
- case $command in
- add)
- options=' --non-recursive -N -q --quiet'
- ;;
- @(blame|annotate|ann|praise))
- options='-r --revisions -x --cross'
- ;;
- cat)
- options='-r --revision'
- ;;
- @(checkout|co))
- options='-r --revision -q --quiet -N \
- --non-recursive -l --list -d \
- --detach --export --relocate \
- --purge'
- ;;
- cleanup)
- options='-a --all'
- ;;
- @(cmerge|cm))
- options='-c --change -l --log -r \
- --revision -a --auto \
- --verbatim --no-ticket -m \
- --message -F --file --template \ --encoding -P --patch -S \
- --sign -C --check-only --direct'
- ;;
- @(commit|ci))
- options='--import -m --message -F \
- --file --encoding --template \
- -P --patch -S --sign -C \
- --check-only -N \
- --non-recursive --direct'
- ;;
- @(copy|cp))
- options='-r --revision -p --parent -q \
- --quiet -m --message -F --file \
- --template --encoding -P \
- --patch -S --sign -C \
- --check-only --direct'
- ;;
- @(delete|del|remove|rm))
- options='-k --keep-local -m --message \
- -F --file --encoding \
- --template -P --patch -S \
- --sign -C --check-only --direct'
- ;;
- @(depotmap|depot))
- options='-i --init -l --list -d \
- --detach --relocate'
- ;;
- @(diff|di))
- options='-r --revision -s --summarize \
- -b --verbose -N --non-recursive'
- ;;
- import)
- options='-f --from-checkout -t \
- --to-checkout -m --message -F \
- --file --template --encoding \
- -P --patch -S --sign -C \
- --check-only -N \
- --non-recursive --direct'
- ;;
- @(list|ls))
- options='-r --revision -v --verbose -R \
- --recursive -d --depth -f \
- --full-path'
- ;;
- log)
- options='-r --revision -l --limit -q \
- --quiet -x --cross -v --verbose'
- ;;
- merge)
- options='-r --revision -c --change -I \
- --incremental -a --auto -l \
- --log -s --sync -t --to -f \
- --from --verbatim --no-ticket \
- --track-rename -m --message \
- -F --file --template \
- --encoding -P --patch -S \
- --sign -C --check-only --direct'
- ;;
- @(mirror|mi))
- options='-l --list -d --detach \
- --relocate --recover --unlock \
- --upgrade'
- ;;
- mkdir)
- options='-p --parent -m --message -F \
- --file --template --encoding \
- -P --patch -S --sign -C \
- --check-only --direct'
- ;;
- @(move|mv|rename|ren))
- options='-r --revision -p --parent -q \
- --quiet -m --message -F --file \
- --encoding --template -P \
- --patch -S --sign -C \
- --check-only --direct'
- ;;
- patch)
- options='--depot'
- ;;
- @(propdel|propset|pdel|pset|pd|ps))
- options='-R --recursive -r --revision \
- --revprop -m --message -F \
- --file --template --encoding \
- -P --patch -S --sign -C \
- --check-only -q --quiet \
- --direct'
- ;;
- @(propedit|pedit|pe))
- options='-R --recursive -r --revision \
- --revprop -m --message -F \
- --file --template --encoding \
- -P --patch -S --sign -C \
- --check-only --direct'
- ;;
- @(propget|pget|pg))
- options='-R --recursive -r --revision \
- --revprop --strict'
- ;;
- @(proplist|plist|pl))
- options='-R --recursive -v --verbose \
- -r --revision --revprop'
- ;;
- pull)
- options='-a --all -l --lump'
- ;;
- push)
- options='-f --from -l --lump -C \
- --check -P --patch -S --sign \
- --verbatim'
- ;;
- resolved)
- options='-R --recursive'
- ;;
- revert)
- options='-R --recursive -q --quiet'
- ;;
- @(smerge|sm))
- options='-I --incremental -l --log -B \
- --baseless -b --base -s --sync \
- -t --to -f --from --verbatim \
- --no-ticket --track-rename \
- --host --remoterev -m \
- --message -F --file --template \
- --encoding -P --patch -S \
- --sign -C --check-only --direct'
- ;;
- @(status|stat|st))
- options='-q --quiet --no-ignore -N \
- --non-recursive -v --verbose'
- ;;
- @(switch|sw))
- options='-r --revision -d --detach -q \
- --quiet'
- ;;
- @(sync|sy))
- options='-a --all -s --skipto -t \
- --torev'
- ;;
- @(update|up))
- options='-r --revision -N \
- --non-recursive -C \
- --check-only -s --sync -m \
- --merge -q --quiet'
- ;;
- esac
- options="$options --help -h"
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ add)
+ options=' --non-recursive -N -q --quiet'
+ ;;
+ @(blame|annotate|ann|praise))
+ options='-r --revisions -x --cross'
+ ;;
+ cat)
+ options='-r --revision'
+ ;;
+ @(checkout|co))
+ options='-r --revision -q --quiet -N --non-recursive -l \
+ --list -d --detach --export --relocate --purge'
+ ;;
+ cleanup)
+ options='-a --all'
+ ;;
+ @(cmerge|cm))
+ options='-c --change -l --log -r --revision -a --auto \
+ --verbatim --no-ticket -m --message -F --file \
+ --template --encoding -P --patch -S --sign -C \
+ --check-only --direct'
+ ;;
+ @(commit|ci))
+ options='--import -m --message -F --file --encoding \
+ --template -P --patch -S --sign -C --check-only -N \
+ --non-recursive --direct'
+ ;;
+ @(copy|cp))
+ options='-r --revision -p --parent -q --quiet -m --message \
+ -F --file --template --encoding -P --patch -S --sign \
+ -C --check-only --direct'
+ ;;
+ @(delete|del|remove|rm))
+ options='-k --keep-local -m --message -F --file --encoding \
+ --template -P --patch -S --sign -C --check-only \
+ --direct'
+ ;;
+ @(depotmap|depot))
+ options='-i --init -l --list -d --detach --relocate'
+ ;;
+ @(diff|di))
+ options='-r --revision -s --summarize -b --verbose -N \
+ --non-recursive'
+ ;;
+ import)
+ options='-f --from-checkout -t --to-checkout -m --message \
+ -F --file --template --encoding -P --patch -S --sign \
+ -C --check-only -N --non-recursive --direct'
+ ;;
+ @(list|ls))
+ options='-r --revision -v --verbose -R --recursive -d \
+ --depth -f --full-path'
+ ;;
+ log)
+ options='-r --revision -l --limit -q --quiet -x --cross \
+ -v --verbose'
+ ;;
+ merge)
+ options='-r --revision -c --change -I --incremental -a \
+ --auto -l --log -s --sync -t --to -f --from \
+ --verbatim --no-ticket --track-rename -m --message \
+ -F --file --template --encoding -P --patch -S --sign \
+ -C --check-only --direct'
+ ;;
+ @(mirror|mi))
+ options='-l --list -d --detach --relocate --recover \
+ --unlock --upgrade'
+ ;;
+ mkdir)
+ options='-p --parent -m --message -F --file --template \
+ --encoding -P --patch -S --sign -C --check-only \
+ --direct'
+ ;;
+ @(move|mv|rename|ren))
+ options='-r --revision -p --parent -q --quiet -m \
+ --message -F --file --encoding --template -P --patch \
+ -S --sign -C --check-only --direct'
+ ;;
+ patch)
+ options='--depot'
+ ;;
+ @(propdel|propset|pdel|pset|pd|ps))
+ options='-R --recursive -r --revision --revprop -m \
+ --message -F --file --template --encoding -P --patch \
+ -S --sign -C --check-only -q --quiet --direct'
+ ;;
+ @(propedit|pedit|pe))
+ options='-R --recursive -r --revision --revprop -m \
+ --message -F --file --template --encoding -P --patch \
+ -S --sign -C --check-only --direct'
+ ;;
+ @(propget|pget|pg))
+ options='-R --recursive -r --revision --revprop --strict'
+ ;;
+ @(proplist|plist|pl))
+ options='-R --recursive -v --verbose \
+ -r --revision --revprop'
+ ;;
+ pull)
+ options='-a --all -l --lump'
+ ;;
+ push)
+ options='-f --from -l --lump -C --check -P --patch -S \
+ --sign --verbatim'
+ ;;
+ resolved)
+ options='-R --recursive'
+ ;;
+ revert)
+ options='-R --recursive -q --quiet'
+ ;;
+ @(smerge|sm))
+ options='-I --incremental -l --log -B --baseless -b \
+ --base -s --sync -t --to -f --from --verbatim \
+ --no-ticket --track-rename --host --remoterev -m \
+ --message -F --file --template --encoding -P --patch \
+ -S --sign -C --check-only --direct'
+ ;;
+ @(status|stat|st))
+ options='-q --quiet --no-ignore -N --non-recursive -v \
+ --verbose'
+ ;;
+ @(switch|sw))
+ options='-r --revision -d --detach -q --quiet'
+ ;;
+ @(sync|sy))
+ options='-a --all -s --skipto -t --torev'
+ ;;
+ @(update|up))
+ options='-r --revision -N --non-recursive -C --check-only \
+ -s --sync -m --merge -q --quiet'
+ ;;
+ esac
+ options="$options --help -h"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- case $command in
- @(help|h|\?))
- COMPREPLY=( $( compgen -W "$commands \
- environment commands intro" -- $cur ) )
- ;;
- admin)
- COMPREPLY=( $( compgen -W 'help \
- deltify dump hotcopy \
- list-dblogs list-unused-dblogs \
- load lstxns recover rmtxns \
- setlog verify rmcache' \
- -- $cur ) )
- ;;
- patch)
- COMPREPLY=( $( compgen -W '--ls --list \
- --cat --view --regen \
- --regenerate --up --update \
- --apply --rm --delete' \
- -- $cur ) )
- ;;
- sync)
- COMPREPLY=( $( compgen -W "$( svk \
- mirror --list 2>/dev/null | \
- awk '/^\//{print $1}' )" \
- -- $cur ) )
- ;;
- @(co|checkout|push|pull))
- if [[ "$cur" == //*/* ]]; then
- path=${cur%/*}/
- else
- path=//
- fi
- COMPREPLY=( $( compgen -W "$( svk \
- list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ) )
- ;;
- *)
- _filedir
- ;;
- esac
- fi
- fi
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ case $command in
+ @(help|h|\?))
+ COMPREPLY=( $( compgen -W "$commands \
+ environment commands intro" -- "$cur" ) )
+ ;;
+ admin)
+ COMPREPLY=( $( compgen -W 'help deltify dump hotcopy \
+ list-dblogs list-unused-dblogs load lstxns recover \
+ rmtxns setlog verify rmcache' -- "$cur" ) )
+ ;;
+ patch)
+ COMPREPLY=( $( compgen -W '--ls --list --cat --view \
+ --regen --regenerate --up --update --apply --rm \
+ --delete' -- "$cur" ) )
+ ;;
+ sync)
+ COMPREPLY=( $( compgen -W "$( svk mirror --list \
+ 2>/dev/null | awk '/^\//{print $1}' )" -- "$cur" ) )
+ ;;
+ @(co|checkout|push|pull))
+ if [[ "$cur" == //*/* ]]; then
+ path=${cur%/*}/
+ else
+ path=//
+ fi
+ COMPREPLY=( $( compgen -W "$( svk list $path 2>/dev/null | \
+ sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) )
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+ fi
+ fi
- return 0
-}
-complete -F _svk $default svk
+ return 0
+} &&
+complete -F _svk $filenames svk
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/sysctl b/contrib/sysctl
new file mode 100644
index 00000000..cd40c453
--- /dev/null
+++ b/contrib/sysctl
@@ -0,0 +1,23 @@
+# bash completion for sysctl
+
+have sysctl &&
+_sysctl()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- "$cur" ) )
+
+ return 0
+} &&
+complete -F _sysctl sysctl
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/sysv-rc b/contrib/sysv-rc
new file mode 100644
index 00000000..ac2062be
--- /dev/null
+++ b/contrib/sysv-rc
@@ -0,0 +1,113 @@
+# update-rc.d(8) completion
+#
+# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
+
+have update-rc.d &&
+_update_rc_d()
+{
+ local cur prev sysvdir services options valid_options
+
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
+ || sysvdir=/etc/init.d
+
+ services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
+ services=( ${services[@]#$sysvdir/} )
+ options=( -f -n )
+
+ if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
+ valid_options=( $( \
+ echo "${COMP_WORDS[@]} ${options[@]}" \
+ | tr " " "\n" \
+ | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
+ | sort | uniq -u \
+ ) )
+ COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
+ -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- "$cur" ) )
+ elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
+ COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) )
+ elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
+ COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
+ elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
+ COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
+ elif [[ "$prev" == defaults && -z "$cur" ]]; then
+ COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k )
+ elif [[ "$prev" == ?(start|stop) ]]; then
+ if [[ "$cur" == [0-9] || -z "$cur" ]]; then
+ COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
+ elif [[ "$cur" == [0-9][0-9] ]]; then
+ COMPREPLY=( $cur )
+ else
+ COMPREPLY=()
+ fi
+ elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
+ if [[ -z "$cur" ]]; then
+ if [[ $prev == [0-9][0-9] ]]; then
+ COMPREPLY=( 0 1 2 3 4 5 6 S )
+ else
+ COMPREPLY=( 0 1 2 3 4 5 6 S . )
+ fi
+ elif [[ "$cur" == [0-6S.] ]]; then
+ COMPREPLY=( $cur )
+ else
+ COMPREPLY=()
+ fi
+ elif [[ "$prev" == "." ]]; then
+ COMPREPLY=( $(compgen -W "start stop" -- "$cur") )
+ else
+ COMPREPLY=()
+ fi
+
+ return 0
+} &&
+complete -F _update_rc_d update-rc.d
+
+# invoke-rc.d(8) completion
+#
+# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
+#
+have invoke-rc.d &&
+_invoke_rc_d()
+{
+ local cur prev sysvdir services options valid_options
+
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
+ || sysvdir=/etc/init.d
+
+ services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
+ services=( ${services[@]#$sysvdir/} )
+ options=( --help --quiet --force --try-anyway --disclose-deny --query \
+ --no-fallback )
+
+ if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
+ valid_options=( $( \
+ echo ${COMP_WORDS[@]} ${options[@]} \
+ | tr " " "\n" \
+ | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
+ | sort | uniq -u \
+ ) )
+ COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) )
+ elif [ -x $sysvdir/$prev ]; then
+ COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
+ s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
+ $sysvdir/$prev`' -- "$cur" ) )
+ else
+ COMPREPLY=()
+ fi
+
+ return 0
+} &&
+complete -F _invoke_rc_d invoke-rc.d
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/tar b/contrib/tar
new file mode 100644
index 00000000..0802c881
--- /dev/null
+++ b/contrib/tar
@@ -0,0 +1,72 @@
+# bash completion for GNU tar
+
+have tar && {
+_tar()
+{
+ local cur ext regex tar untar
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
+ return 0
+ fi
+
+ case "${COMP_WORDS[1]}" in
+ ?(-)[cr]*f)
+ _filedir
+ return 0
+ ;;
+ +([^IZzJjy])f)
+ ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))'
+ regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\|xz\)\)\?\|gz\|bz2\?\|lzma\|xz\)'
+ ;;
+ *[Zz]*f)
+ ext='t?(ar.)@(gz|Z)'
+ regex='t\(ar\.\)\?\(gz\|Z\)'
+ ;;
+ *[Ijy]*f)
+ ext='t?(ar.)bz?(2)'
+ regex='t\(ar\.\)\?bz2\?'
+ ;;
+ *[J]*f)
+ ext='t?(ar.)@(lz?(ma)|xz)'
+ regex='t\(ar\.\)\?\(lzma\|xz\)\?'
+ ;;
+ *)
+ _filedir
+ return 0
+ ;;
+
+ esac
+
+ if [[ "$COMP_LINE" == *$ext' ' ]]; then
+ # complete on files in tar file
+ #
+ # get name of tar file from command line
+ tar=$( echo "$COMP_LINE" | sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
+ # devise how to untar and list it
+ untar=t${COMP_WORDS[1]//[^Izjyf]/}
+
+ COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
+ 2>/dev/null ) )" -- "$cur" ) )
+ return 0
+ fi
+
+ # file completion on relevant files
+ _filedir "$ext"
+
+ return 0
+}
+[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
+ complete -F _tar $filenames tar
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/tcpdump b/contrib/tcpdump
new file mode 100644
index 00000000..958ac8d7
--- /dev/null
+++ b/contrib/tcpdump
@@ -0,0 +1,38 @@
+# bash completion for tcpdump
+
+have tcpdump &&
+_tcpdump()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -@(r|w|F))
+ _filedir
+ return 0
+ ;;
+ -i)
+ _available_interfaces -a
+ return 0
+ ;;
+ esac
+
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
+ -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _tcpdump tcpdump
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/unace b/contrib/unace
index c6376742..d006ffbd 100644
--- a/contrib/unace
+++ b/contrib/unace
@@ -1,29 +1,36 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# unace(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
-_unace()
+have unace &&
+_unace()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- $cur ) )
- ;;
- *)
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'e l t v x' -- $cur ) )
- else
- _filedir '@(ace|ACE)'
- fi
- ;;
- esac
-
- return 0
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' \
+ -- "$cur" ) )
+ ;;
+ *)
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
+ else
+ _filedir '@(ace|ACE)'
+ fi
+ ;;
+ esac
-}
+ return 0
+
+} &&
complete -F _unace $filenames unace
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/unrar b/contrib/unrar
index 9dcd2065..a97fb0d1 100644
--- a/contrib/unrar
+++ b/contrib/unrar
@@ -1,30 +1,36 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# unrar(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
-_unrar()
+have unrar &&
+_unrar()
{
- local cur
+ local cur
- COMPREPLY=()
- cur=`_get_cword`
+ COMPREPLY=()
+ cur=`_get_cword`
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
- -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
- -tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ) )
- ;;
- *)
- if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- $cur ) )
- else
- _filedir '@(rar|RAR)'
- fi
- ;;
- esac
-
- return 0
-}
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
+ -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
+ -tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) )
+ ;;
+ *)
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
+ else
+ _filedir '@(rar|RAR)'
+ fi
+ ;;
+ esac
+
+ return 0
+} &&
complete -F _unrar $filenames unrar
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/update-alternatives b/contrib/update-alternatives
new file mode 100644
index 00000000..7e12b96e
--- /dev/null
+++ b/contrib/update-alternatives
@@ -0,0 +1,99 @@
+# bash completion for update-alternatives
+
+have update-alternatives && {
+_installed_alternatives()
+{
+ local admindir
+ # find the admin dir
+ for i in alternatives dpkg/alternatives rpm/alternatives; do
+ [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
+ done
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
+ admindir=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- "$cur" ) )
+}
+
+_update_alternatives()
+{
+ local cur prev mode args i
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --@(altdir|admindir))
+ _filedir -d
+ return 0
+ ;;
+ --@(help|version))
+ return 0
+ ;;
+ esac
+
+ # find which mode to use and how many real args used so far
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
+ mode=${COMP_WORDS[i]}
+ args=$(($COMP_CWORD - i))
+ break
+ fi
+ done
+
+ case $mode in
+ --install)
+ case $args in
+ 1)
+ _filedir
+ ;;
+ 2)
+ _installed_alternatives
+ ;;
+ 3)
+ _filedir
+ ;;
+ esac
+ ;;
+ --remove)
+ case $args in
+ 1)
+ _installed_alternatives
+ ;;
+ 2)
+ _filedir
+ ;;
+ esac
+ ;;
+ --auto)
+ _installed_alternatives
+ ;;
+ --remove-all)
+ _installed_alternatives
+ ;;
+ --display)
+ _installed_alternatives
+ ;;
+ --config)
+ _installed_alternatives
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
+ --altdir --admindir' -- "$cur" ) \
+ $( compgen -W '--install --remove --auto --display \
+ --config' -- "$cur" ) )
+ esac
+}
+complete -F _update_alternatives update-alternatives alternatives
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/vncviewer b/contrib/vncviewer
index 933783a4..7e9c00da 100644
--- a/contrib/vncviewer
+++ b/contrib/vncviewer
@@ -1,126 +1,132 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
# bash completion for vncviewer
-
+have vncviewer &&
_vncviewer_bootstrap() {
- local fname
- case "$(_realcommand vncviewer)" in
- # If `vncviewer' not installed, default file-dir completion
- '') _filedir `_get_cword` ;;
- *xvnc4viewer) fname=_xvnc4viewer ;;
- *tightvncviewer|*) fname=_tightvncviewer ;;
- esac
- if [ $fname ]; then
- # Install real completion for subsequent completions
- complete -F $fname vncviewer
- $fname # Generate completions once for now
- unset -f _vncviewer_bootstrap
- fi
+ local fname
+ case "$(_realcommand vncviewer)" in
+ # If `vncviewer' not installed, default file-dir completion
+ '') _filedir `_get_cword` ;;
+ *xvnc4viewer) fname=_xvnc4viewer ;;
+ *tightvncviewer|*) fname=_tightvncviewer ;;
+ esac
+ if [ $fname ]; then
+ # Install real completion for subsequent completions
+ complete -F $fname vncviewer
+ $fname # Generate completions once for now
+ unset -f _vncviewer_bootstrap
+ fi
} &&
complete -F _vncviewer_bootstrap vncviewer
-
+have tightvncviewer &&
_tightvncviewer()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- case $prev in
- -passwd)
- _filedir
- return 0
- ;;
- -encodings)
- COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib \
- corre rre raw' -- $cur ) )
- return 0
- ;;
- -via)
- _known_hosts
- return 0
- ;;
- esac
+ case $prev in
+ -passwd)
+ _filedir
+ return 0
+ ;;
+ -encodings)
+ COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib \
+ corre rre raw' -- "$cur" ) )
+ return 0
+ ;;
+ -via)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-help -listen -via -shared -noshared\
- -viewonly -fullscreen -noraiseonbeep -passwd -encodings\
- -bgr233 -owncmap -truecolour -truecolor -depth \
- -compresslevel -quality -nojpeg -nocursorshape \
- -x11cursor' -- $cur ) )
- else
- _known_hosts
- fi
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -listen -via -shared -noshared\
+ -viewonly -fullscreen -noraiseonbeep -passwd -encodings\
+ -bgr233 -owncmap -truecolour -truecolor -depth \
+ -compresslevel -quality -nojpeg -nocursorshape \
+ -x11cursor' -- $cur ) )
+ else
+ _known_hosts_real "$cur"
+ fi
} &&
complete -F _tightvncviewer tightvncviewer
# NOTE: - VNC Viewer options are case-insensivite. Preferred case is taken from -help.
# - Both single dash (-) and double dash (--) are allowed as option prefix
+have xvnc4viewer &&
_xvnc4viewer()
{
- local cur prev
+ local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
- # Convert double dash to single dash
- case ${prev/#--/-} in
- # -passwd, -PasswordFile
- -[pP][aA][sS][sS][wW][dD]|-[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE])
- _filedir
- return 0
- ;;
- # -PreferredEncoding
- -[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG])
- COMPREPLY=( $( compgen -W 'zrle hextile raw' -- $cur ) )
- return 0
- ;;
- # -via
- -[vV][iI][aA])
- _known_hosts
- return 0
- ;;
- esac
+ # Convert double dash to single dash
+ case ${prev/#--/-} in
+ # -passwd, -PasswordFile
+ -[pP][aA][sS][sS][wW][dD]|-[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE])
+ _filedir
+ return 0
+ ;;
+ # -PreferredEncoding
+ -[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG])
+ COMPREPLY=( $( compgen -W 'zrle hextile raw' -- $cur ) )
+ return 0
+ ;;
+ # -via
+ -[vV][iI][aA])
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* || "$cur" == --* ]]; then
- # Default to vncviewer camelcase options, see `vncviewer -help'
- 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 \
- )
- [[ "$cur" == --* ]] && dash=-- || dash=-
- # Is a `nocasematch' variable available (bash > v3.1)?
- if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then
- # Variable `nocasematch' is available
- # Use vncviewer camelcase options
- local option oldNoCaseMatch=$(shopt -p nocasematch)
- shopt -s nocasematch
- COMPREPLY=( $( for option in "${options[@]}"; do
- [[ $dash$option == "$cur"* ]] && echo $dash$option
- done ) )
- eval "$oldNoCaseMatch" 2> /dev/null
- else
- # Variable 'nocasematch' isn't available;
- # Convert completions to lowercase
- COMPREPLY=( $( compgen -W "$(
- echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
- )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ) )
- fi
- else
- _known_hosts
- fi
+ if [[ "$cur" == -* || "$cur" == --* ]]; then
+ # Default to vncviewer camelcase options, see `vncviewer -help'
+ 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 \
+ )
+ [[ "$cur" == --* ]] && dash=-- || dash=-
+ # Is a `nocasematch' variable available (bash > v3.1)?
+ if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then
+ # Variable `nocasematch' is available
+ # Use vncviewer camelcase options
+ local option oldNoCaseMatch=$(shopt -p nocasematch)
+ shopt -s nocasematch
+ COMPREPLY=( $( for option in "${options[@]}"; do
+ [[ $dash$option == "$cur"* ]] && echo $dash$option
+ done ) )
+ eval "$oldNoCaseMatch" 2> /dev/null
+ else
+ # Variable 'nocasematch' isn't available;
+ # Convert completions to lowercase
+ COMPREPLY=( $( compgen -W "$(
+ echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
+ )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ) )
+ fi
+ else
+ _known_hosts_real "$cur"
+ fi
} &&
complete -F _xvnc4viewer xvnc4viewer
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/vpnc b/contrib/vpnc
new file mode 100644
index 00000000..aaf0300a
--- /dev/null
+++ b/contrib/vpnc
@@ -0,0 +1,50 @@
+# bash completion for vpnc
+
+have vpnc &&
+_vpnc()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --pfs)
+ COMPREPLY=( $( compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur" ) )
+ return 0
+ ;;
+ --pfs)
+ COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- "$cur" ) )
+ return 0
+ ;;
+ --@(pid-file|script))
+ _filedir
+ return 0
+ ;;
+ --gateway)
+ _known_hosts_real "$cur"
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--version --print-config --help \
+ --long-help --gateway --id --username --udp --domain \
+ --xauth-inter --script --dh --pfs --enable-1des \
+ --application-version --ifname --debug --no-detach \
+ --pid-file --local-port --udp-port --disable-natt \
+ --non-inter' -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W '$( command ls /etc/vpnc )' -- "$cur" ) )
+ fi
+} &&
+complete -F _vpnc vpnc
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/wireless-tools b/contrib/wireless-tools
new file mode 100644
index 00000000..22da1b2e
--- /dev/null
+++ b/contrib/wireless-tools
@@ -0,0 +1,183 @@
+# bash completion for Linux wireless-tools
+
+[ $UNAME = Linux ] &&
+{
+
+have iwconfig &&
+_iwconfig()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ mode)
+ COMPREPLY=( $( compgen -W 'managed ad-hoc master \
+ repeater secondary monitor' -- "$cur" ) )
+ return 0
+ ;;
+ essid)
+ COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
+ if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} scan | \
+ awk -F '\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ nwid)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ channel)
+ COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
+ awk '/^[[:space:]]*Channel/ {print $2}' )" -- "$cur" ) )
+ return 0
+ ;;
+
+ freq)
+ COMPREPLY=( $( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | \
+ awk '/^[[:space:]]*Channel/ {print $4\"G\"}')" -- "$cur" ) )
+ return 0
+ ;;
+ ap)
+ COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
+ if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} scan | \
+ awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
+ fi
+ return 0
+ ;;
+ rate)
+ COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} rate | \
+ awk '/^[[:space:]]*[0-9]/ {print $1\"M\"}' )" -- "$cur" ) )
+ return 0
+ ;;
+ rts|frag)
+ COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) )
+ return 0
+ ;;
+ key|enc)
+ COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) )
+ return 0
+ ;;
+ power)
+ COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) )
+ return 0
+ ;;
+ txpower)
+ COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) )
+ return 0
+ ;;
+ retry)
+ COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
+ else
+ _available_interfaces -w
+ fi
+ else
+ COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
+ ap nick rate rts frag enc key power txpower commit' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _iwconfig iwconfig
+
+
+have iwlist &&
+_iwlist()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
+ else
+ _available_interfaces -w
+ fi
+ else
+ COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
+ channel rate bit bitrate key enc encryption power \
+ txpower retry ap accesspoint peers event' -- "$cur" ) )
+ fi
+} &&
+complete -F _iwlist iwlist
+
+
+have iwspy &&
+_iwspy()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
+ else
+ _available_interfaces -w
+ fi
+ else
+ COMPREPLY=( $( compgen -W 'setthr getthr off' -- "$cur" ) )
+ fi
+} &&
+complete -F _iwspy iwspy
+
+
+have iwpriv &&
+_iwpriv()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ roam)
+ COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
+ return 0
+ ;;
+ port)
+ COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
+ else
+ _available_interfaces -w
+ fi
+ else
+ COMPREPLY=( $( compgen -W '--all roam port' -- "$cur" ) )
+ fi
+} &&
+complete -F _iwpriv iwpriv
+
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/wodim b/contrib/wodim
new file mode 100644
index 00000000..6359ec59
--- /dev/null
+++ b/contrib/wodim
@@ -0,0 +1,85 @@
+# bash completion for cdrecord/wodim
+
+have cdrecord || have wodim &&
+_cdrecord()
+{
+ local cur prev i generic_options track_options track_mode
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ # foo=bar style option
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur/=*/}
+ cur=${cur/*=/}
+ case "$prev" in
+ @(text|cue)file)
+ _filedir
+ return 0
+ ;;
+ blank)
+ COMPREPLY=( $( compgen -W 'help all fast \
+ track unreserve trtail unclose session' \
+ -- "$cur" ) )
+ return 0
+ ;;
+ driveropts)
+ COMPREPLY=( $( compgen -W 'burnfree noburnfree\
+ varirec= audiomaster forcespeed noforcespeed\
+ speedread nospeedread singlesession \
+ nosinglesession hidecdr nohidecdr tattooinfo\
+ tattoofile=' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ 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=)
+ 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=)
+ # look if previous was either a file or a track option
+ track_mode=0
+ if [ $COMP_CWORD -gt 1 ]; then
+ if [ -f "$prev" ]; then
+ track_mode=1
+ else
+ for (( i=0; i < ${#track_options[@]}; i++ )); do
+ if [[ "${track_options[i]}" == "$prev" ]]; then
+ track_mode=1
+ break
+ fi
+ done
+ fi
+ fi
+
+ # files are always eligible completion
+ _filedir
+ # track options are always available
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W '${track_options[@]}' -- "$cur" ) )
+ # general options are no more available after file or track option
+ if [ $track_mode -eq 0 ]; then
+ COMPREPLY=( "${COMPREPLY[@]}" \
+ $( compgen -W '${generic_options[@]}' -- "$cur" ) )
+ fi
+
+} &&
+complete -F _cdrecord $filenames cdrecord wodim
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/wvdial b/contrib/wvdial
new file mode 100644
index 00000000..9081f6f8
--- /dev/null
+++ b/contrib/wvdial
@@ -0,0 +1,53 @@
+# bash completion for wvdial
+
+have wvdial &&
+_wvdial()
+{
+ local cur prev config i IFS=$'\t\n'
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --config)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ case $cur in
+ -*)
+ COMPREPLY=( $( compgen -W '--config --chat \
+ --remotename --help --version --no-syslog' \
+ -- "$cur" ) )
+ ;;
+ *)
+ # start with global and personal config files
+ config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
+ # replace with command line config file if present
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
+ config=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ # parse config files for sections and
+ # remove default section
+ COMPREPLY=( $( sed -ne "s|^\[Dialer \($cur.*\)\]$|\1|p" $config \
+ 2>/dev/null |grep -v '^Defaults$'))
+ # escape spaces
+ COMPREPLY=${COMPREPLY// /\\ }
+ ;;
+ esac
+
+} &&
+complete -F _wvdial wvdial
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xhost b/contrib/xhost
new file mode 100644
index 00000000..006c961e
--- /dev/null
+++ b/contrib/xhost
@@ -0,0 +1,24 @@
+# xhost(1) completion
+
+have xhost &&
+_xhost ()
+{
+ local cur=`_get_cword`
+
+ case "$cur" in
+ +*) _known_hosts_real -p+ "${cur:1}" ;;
+ -*) _known_hosts_real -p- "${cur:1}" ;;
+ *) _known_hosts_real "$cur" ;;
+ esac
+
+ return 0
+}
+complete -F _xhost xhost
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xm b/contrib/xm
new file mode 100644
index 00000000..b8337e5a
--- /dev/null
+++ b/contrib/xm
@@ -0,0 +1,231 @@
+# bash completion for xm
+
+have xm && {
+_xen_domain_names()
+{
+ COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | \
+ awk '!/Name|Domain-0/ { print $1 }' )" -- "$cur") )
+}
+
+_xen_domain_ids()
+{
+ COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | \
+ awk '!/Name|Domain-0/ { print $2 }' )" -- "$cur") )
+}
+
+_xm()
+{
+ # TODO: _split_longopt
+
+ local cur prev command options
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ commands='console create new delete destroy domid domname dump-core \
+ list mem-max mem-set migrate pause reboot rename restore \
+ resume save shutdown start suspend sysrq trigger top unpause \
+ uptime vcpu-list vcpu-pin vcpu-set debug-keys dmesg info log \
+ serve sched-credit sched-sedf block-attach block-detach \
+ block-list network-attach network-detach network-list \
+ vtpm-list vnet-list vnet-create vnet-delete labels addlabel \
+ rmlabel getlabel dry-run resources makepolicy loadpolicy \
+ cfgbootpolicy dumppolicy help'
+
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
+ else
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ if [[ "$cur" == *=* ]]; then
+ prev=${cur/=*/}
+ cur=${cur/*=/}
+ fi
+
+ command=${COMP_WORDS[1]}
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ create)
+ options='-c'
+ ;;
+ dmesg)
+ options='--clear'
+ ;;
+ list)
+ options='--long'
+ ;;
+ reboot)
+ options='-w -a'
+ ;;
+ shutdown)
+ options='-w -a -R -H'
+ ;;
+ sched-credit)
+ options='-d -w -c'
+ ;;
+ @(block|network|vtpm|vnet)-list)
+ options='-l --long'
+ ;;
+ getpolicy)
+ options='--dumpxml'
+ ;;
+ new)
+ options='-h --help --help_config -q \
+ --quiet --path= -f= \
+ --defconfig= -F= --config= \
+ -b --dryrun -x --xmldryrun \
+ -s --skipdtd -p --paused -c \
+ --console_autoconnect'
+ ;;
+ esac
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ case $command in
+ @(console|destroy|domname|domid|list|mem-@(set|max)|pause|reboot|rename|shutdown|unpause|vcpu-@(list|pin|set)|block-list|network-list|vtpm-list))
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ esac
+ ;;
+ migrate)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ _known_hosts_real "$cur"
+ ;;
+ esac
+ ;;
+ @(restore|dry-run|vnet-create))
+ _filedir
+ ;;
+ save)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ _filedir
+ ;;
+ esac
+ ;;
+ sysrq)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "r s e i u b" -- "$cur") )
+ ;;
+ esac
+ ;;
+ block-attach)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "phy: file:" -- "$cur") )
+ ;;
+ 5)
+ COMPREPLY=( $(compgen -W "w r" -- "$cur") )
+ ;;
+ 6)
+ _xen_domain_names
+ ;;
+ esac
+ ;;
+ block-detach)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "$( xm block-list $prev \
+ 2>/dev/null | awk '!/Vdev/ { print $1 }' )" \
+ -- "$cur") )
+ ;;
+ esac
+ ;;
+ network-attach)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ *)
+ COMPREPLY=( $(compgen -W "script= ip= mac= \
+ bridge= backend=" -- "$cur") )
+ ;;
+ esac
+ ;;
+ network-detach)
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "$( xm network-list $prev \
+ 2>/dev/null | awk '!/Idx/ { print $1 }' )" \
+ -- "$cur") )
+ ;;
+ esac
+ ;;
+ sched-credit)
+ case $prev in
+ -d)
+ _xen_domain_names
+ return 0
+ ;;
+ esac
+ ;;
+ create)
+ _filedir
+ COMPREPLY=( ${COMPREPLY[@]:-} \
+ $( compgen -W '$( command ls /etc/xen 2>/dev/null )' \
+ -- "$cur" ) )
+ ;;
+ new)
+ case $prev in
+ -@(f|F|-defconfig|-config))
+ _filedir
+ return 0
+ ;;
+ --path)
+ _filedir -d
+ return 0
+ ;;
+ esac
+
+ _count_args
+ case $args in
+ 2)
+ _xen_domain_names
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ fi
+
+ return 0
+}
+complete -F _xm xm
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xmllint b/contrib/xmllint
new file mode 100644
index 00000000..ff201ec1
--- /dev/null
+++ b/contrib/xmllint
@@ -0,0 +1,56 @@
+# bash completion for xmllint(1)
+
+have xmllint &&
+_xmllint()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -o|--output)
+ _filedir
+ return 0
+ ;;
+ --path|--dtdvalidfpi|--maxmem|--encode|--pattern)
+ # argument required but no completions available
+ return 0
+ ;;
+ --dtdvalid)
+ _filedir dtd
+ return 0
+ ;;
+ --relaxng)
+ _filedir rng
+ return 0
+ ;;
+ --schema)
+ _filedir xsd
+ return 0
+ ;;
+ --schematron)
+ _filedir sch
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( xmllint --help 2>&1 | \
+ sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \
+ -o' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir '@(*ml|htm|svg)'
+} &&
+complete -F _xmllint $filenames xmllint
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xmlwf b/contrib/xmlwf
new file mode 100644
index 00000000..de8b7250
--- /dev/null
+++ b/contrib/xmlwf
@@ -0,0 +1,40 @@
+# bash completion for xmlwf(1)
+
+have xmlwf &&
+_xmlwf()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -e)
+ COMPREPLY=( $( compgen -W 'US-ASCII UTF-8 UTF-16 \
+ ISO-8859-1' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-c -d -e -m -n -p -r -s -t -v -w \
+ -x' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir '@(*ml|htm|svg)'
+} &&
+complete -F _xmlwf $filenames xmlwf
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xmms b/contrib/xmms
new file mode 100644
index 00000000..ca49545b
--- /dev/null
+++ b/contrib/xmms
@@ -0,0 +1,30 @@
+# bash completion for xmms
+
+have xmms &&
+_xmms()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
+ -u --pause -s --stop -t --play-pause -f --fwd -e \
+ --enqueue -m --show-main-window -i --sm-client-id \
+ -v --version' -- "$cur" ) )
+ else
+ _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
+
+ fi
+
+} &&
+complete -F _xmms $filenames xmms
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xrandr b/contrib/xrandr
new file mode 100644
index 00000000..cd5c05b8
--- /dev/null
+++ b/contrib/xrandr
@@ -0,0 +1,56 @@
+# bash completion for xrandr
+
+have xrandr &&
+_xrandr()
+{
+ local cur prev output modes
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --output)
+ local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
+ COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
+ return 0
+ ;;
+ --mode)
+ for(( i = 1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
+ output=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ modes=$(xrandr|sed -e "1,/$output/ d" \
+ -e "/connected/,$ d"|awk '{print $1}')
+ COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ *)
+ COMPREPLY=( $(compgen -W '-d -display -help -o \
+ --orientation -q --query -s --size\
+ -r --rate -v --version -x -y --screen \
+ --verbose --dryrun --prop --fb \
+ --fbmm --dpi --output --auto --mode \
+ --preferred --pos --reflect --rotate \
+ --left-of --right-of --above --below \
+ --same-as --set --off --crtc --newmode \
+ --rmmode --addmode --delmode' -- "$cur"))
+ return 0
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _xrandr xrandr
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/xz b/contrib/xz
new file mode 100644
index 00000000..f2719861
--- /dev/null
+++ b/contrib/xz
@@ -0,0 +1,103 @@
+# xz(1) completion
+
+have xz &&
+_xz()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-z --compress -d --decompress \
+ -t --test -l --list -k --keep -f --force -c --stdout \
+ -S --suffix --files --files0 -F --format -C --check \
+ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -M --memory --lzma1 \
+ --lzma2 --x86 --powerpc --ia64 --arm --armthumb \
+ --sparc --delta -q --quiet -v --verbose -h --help \
+ -H --long-help -V --version' -- "$cur" ) )
+ return 0
+ fi
+
+ local split=false
+ _split_longopt && split=true
+
+ local xspec="*.@(xz|lzma)"
+
+ case "$prev" in
+ -@(!(-*)[dlt]*|-decompress|-list|-test))
+ xspec="!"$xspec
+ ;;
+ --files|--files0)
+ _filedir
+ return 0
+ ;;
+ -C|--check)
+ COMPREPLY=( $( compgen -W 'crc32 crc64 sha256' -- "$cur" ) )
+ return 0
+ ;;
+ -F|--format)
+ COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- "$cur" ) )
+ return 0
+ ;;
+ -M|--memory|-S|--suffix|--delta|--lzma1|--lzma2)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|-H|--long-help|-V|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ _expand || return 0
+
+ local IFS=$'\t\n'
+ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+ $( compgen -d -- "$cur" ) )
+} &&
+complete -F _xz $filenames xz
+
+# xzdec(1) completion
+#
+have xzdec &&
+_xzdec()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-M --memory -h --help -V --version' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ local split=false
+ _split_longopt && split=true
+
+ case "$prev" in
+ -M|--memory)
+ # argument required but no completions available
+ return 0
+ ;;
+ -h|--help|-V|--version)
+ # all other arguments are noop with these
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ _filedir xz # no lzma support here as of xz 4.999.8beta
+} &&
+complete -F _xzdec $filenames xzdec
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/yp-tools b/contrib/yp-tools
new file mode 100644
index 00000000..60155279
--- /dev/null
+++ b/contrib/yp-tools
@@ -0,0 +1,35 @@
+# bash completion for yp-tools
+
+have ypmatch &&
+_ypmatch()
+{
+ local cur map
+
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
+ [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
+
+ if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
+ [ ${#COMP_WORDS[@]} -eq 3 ]; then
+ map=${COMP_WORDS[2]}
+ COMPREPLY=( $( compgen -W '$( ypcat $map | \
+ cut -d':' -f 1 )' -- "$cur") )
+ else
+ [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
+ COMPREPLY=( $( compgen -W \
+ '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- "$cur"))
+ fi
+
+ return 0
+} &&
+complete -F _ypmatch ypmatch ypcat
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/contrib/yum-arch b/contrib/yum-arch
new file mode 100644
index 00000000..1cc8320c
--- /dev/null
+++ b/contrib/yum-arch
@@ -0,0 +1,30 @@
+# yum-arch(8) completion
+
+have yum-arch &&
+_yum_arch()
+{
+ local cur
+ COMPREPLY=()
+ cur=`_get_cword`
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l \
+ -q' -- "$cur" ) )
+ ;;
+ *)
+ _filedir -d
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _yum_arch $filenames yum-arch
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/install-sh b/install-sh
index a5897de6..6781b987 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2006-12-25.00
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,5 +515,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/missing b/missing
index 1c8ff704..28055d2a 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake@gnu.org>."
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
-# the program).
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
case $1 in
- lex|yacc)
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
+ tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
@@ -138,7 +146,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
- bison|yacc)
+ bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg. You should only need it if
fi
;;
- lex|flex)
+ lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg. You should only need it if
fi
;;
- help2man)
+ help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg. You should only need it if
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar)
+ tar*)
shift
# We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End: