From b0c9212c544e53861a90e9c4f9c015965eba37b2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 7 Jul 2010 18:44:32 +0200 Subject: [PATCH 01/77] mplayer: run mplayer with -nomsgmodule -nomsgcolor this fixes completion if user has msgmodule and/or msgcolor enabled in the config file. --- contrib/mplayer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/mplayer b/contrib/mplayer index 2786b7ad..0c15cd11 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -4,7 +4,7 @@ have mplayer && { _mplayer_options_list() { cur=${cur%\\} - COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \ + COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \ sed -e '1,/^Available/d' | awk '{print $1}' | \ sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) } @@ -230,7 +230,7 @@ _mplayer() case $cur in -*) - COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \ + COMPREPLY=( $( compgen -W '$( $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null | \ sed -ne '1,/^[[:space:]]*Name/d' \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ -e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) ) From d1f5b983af7a08246780106d1463b6e5f685ef9e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 7 Jul 2010 18:44:33 +0200 Subject: [PATCH 02/77] mplayer: complete on .nut and .bik files. --- contrib/mplayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mplayer b/contrib/mplayer index 0c15cd11..1f8a4acf 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK)' ;; esac From 78107506c61d6224f4b4f1a27f078b5d1ade22a8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 7 Jul 2010 18:44:34 +0200 Subject: [PATCH 03/77] mplayer: fix profile names completion. unlike other '-foo help' style options for which the first line is mplayer copyright info followed by ^Available line, -profile help outputs first the list of profile names and copyirght info is actually the last line. --- contrib/mplayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mplayer b/contrib/mplayer index 1f8a4acf..e74db5e4 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -5,7 +5,7 @@ _mplayer_options_list() { cur=${cur%\\} COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \ - sed -e '1,/^Available/d' | awk '{print $1}' | \ + sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \ sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) } From b925bff04c008a2b0469c53b3b206059239f7c18 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 7 Jul 2010 18:44:35 +0200 Subject: [PATCH 04/77] mplayer: update lavdopts suboptions also sort them in alphabetical order --- contrib/mplayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mplayer b/contrib/mplayer index e74db5e4..5f5dd648 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -115,7 +115,7 @@ _mplayer() return 0 ;; -lavdopts) - COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' -- "$cur" ) ) + COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur" ) ) return 0 ;; -lavcopts) From bb8ba402357cb029235c12a5253b7d33e5872001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 11 Jul 2010 12:16:52 +0300 Subject: [PATCH 05/77] Note Anton's mplayer completion improvements. --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index e1ba72b8..5c463ee6 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,9 @@ bash-completion (2.x) * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) * Speed up `compopt' availability detection + [ Anton Khirnov ] + * Improve mplayer and mencoder completions. + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) From 5eead0ebeecf7d3212df3fea9cfe0fa88b6d0274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 11 Jul 2010 14:51:06 +0300 Subject: [PATCH 06/77] Fix p4 completion, was broken in f8bafe285e7d20fdd82f77289059dd18f78312c2 (Alioth: #312625). --- CHANGES | 1 + contrib/p4 | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 5c463ee6..c65de5a3 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ bash-completion (2.x) * Add gif to mplayer filename completions (Alioth: #312512). * Add "short" tarball extensions to unxz, unlzma etc completions. * Improve /etc/init.d/* and sqlite3 completions. + * Fix p4 completion (Alioth: #312625). [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/contrib/p4 b/contrib/p4 index 0795a28e..59b02c1d 100644 --- a/contrib/p4 +++ b/contrib/p4 @@ -3,10 +3,10 @@ have p4 && _p4() { - local cur prev preprev p4commands p4filetypes + local cur prev words cword p4commands p4filetypes COMPREPLY=() - _get_comp_words_by_ref cur prev preprev + _get_comp_words_by_ref cur prev words cword # rename isn't really a command p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )" @@ -14,9 +14,9 @@ _p4() uresource uxbinary xbinary xltext xtempobj xtext \ text binary resource" - if [ $COMP_CWORD -eq 1 ]; then + if [ $cword -eq 1 ]; then COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) ) - elif [ $COMP_CWORD -eq 2 ]; then + elif [ $cword -eq 2 ]; then case $prev in help) COMPREPLY=( $( compgen -W "simple commands \ @@ -29,10 +29,10 @@ _p4() *) ;; esac - elif [ $COMP_CWORD -gt 2 ]; then + elif [ $cword -gt 2 ]; then case $prev in -t) - case $preprev in + case ${words[$cword-2]} in add|edit|reopen) COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") ) ;; From fc3c16e95302d1bcc9f2a543fcb48d5b815603af Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Tue, 13 Jul 2010 21:05:26 +0300 Subject: [PATCH 07/77] Add *.webm to mplayer file completions (Debian: #588079). --- CHANGES | 3 +++ contrib/mplayer | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c65de5a3..b79a4cf0 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,9 @@ bash-completion (2.x) [ Anton Khirnov ] * Improve mplayer and mencoder completions. + [ Paul Walmsley ] + * Add *.webm to mplayer file completions (Debian: #588079). + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) diff --git a/contrib/mplayer b/contrib/mplayer index 5f5dd648..2f76c666 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM)' ;; esac From 51b4f5b5c4a1016d8389a29f2461fa9ae4f6e146 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 27 Jul 2010 20:11:31 +0200 Subject: [PATCH 08/77] Add *.amr to mplayer file completions (Alioth: #312634). --- CHANGES | 3 +++ contrib/mplayer | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b79a4cf0..1879c0cc 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,9 @@ bash-completion (2.x) [ Paul Walmsley ] * Add *.webm to mplayer file completions (Debian: #588079). + [ Miklos Vajna ] + * Add *.amr to mplayer file completions (Alioth: #312634). + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) diff --git a/contrib/mplayer b/contrib/mplayer index 2f76c666..b4b1b3cf 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR)' ;; esac From bdf063edd132fc74a77d022e9bc2a8a2d446d396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 27 Jul 2010 23:40:19 +0300 Subject: [PATCH 09/77] Add *.awb to mplayer filename completions. --- CHANGES | 2 +- contrib/mplayer | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1879c0cc..81a97207 100644 --- a/CHANGES +++ b/CHANGES @@ -6,7 +6,7 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. * Add crontab and lrzip completions. - * Add gif to mplayer filename completions (Alioth: #312512). + * Add *.gif (Alioth: #312512) and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. * Improve /etc/init.d/* and sqlite3 completions. * Fix p4 completion (Alioth: #312625). diff --git a/contrib/mplayer b/contrib/mplayer index b4b1b3cf..6d1e977d 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)' ;; esac From 6d556ee5b782acc623d10c6dd22aa3b7f3b3e6e6 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Mon, 2 Aug 2010 22:07:24 +0200 Subject: [PATCH 10/77] split installation logic for completions in a separate Makefile.am, for easier management of generated files --- Makefile.am | 174 +------------------------------------------- configure.ac | 3 +- contrib/Makefile.am | 172 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 173 deletions(-) create mode 100644 contrib/Makefile.am diff --git a/Makefile.am b/Makefile.am index 331d234c..ffc84429 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,175 +1,7 @@ -SUBDIRS = test +SUBDIRS = contrib test sysconf_DATA = bash_completion -bashcompdir = $(sysconfdir)/bash_completion.d -bashcomp_DATA = contrib/abook \ - 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 \ - contrib/brctl \ - contrib/bzip2 \ - contrib/cardctl \ - contrib/cfengine \ - contrib/chkconfig \ - contrib/chsh \ - contrib/cksfv \ - contrib/clisp \ - contrib/configure \ - contrib/coreutils \ - contrib/cowsay \ - contrib/cpan2dist \ - contrib/cpio \ - contrib/crontab \ - contrib/cups \ - contrib/cryptsetup \ - contrib/cvs \ - contrib/cvsps \ - contrib/dd \ - contrib/dhclient \ - contrib/dict \ - contrib/dpkg \ - contrib/dselect \ - contrib/dsniff \ - contrib/findutils \ - contrib/freeciv \ - contrib/fuse \ - contrib/gcc \ - contrib/gcl \ - contrib/gdb \ - contrib/genisoimage \ - contrib/getent \ - contrib/gkrellm \ - contrib/gnatmake \ - contrib/gpg \ - contrib/gpg2 \ - contrib/gzip \ - contrib/heimdal \ - contrib/hping2 \ - contrib/iconv \ - contrib/ifupdown \ - contrib/imagemagick \ - contrib/info \ - contrib/iptables \ - contrib/ipmitool \ - contrib/ipsec \ - contrib/ipv6calc \ - contrib/isql \ - contrib/jar \ - contrib/java \ - contrib/k3b \ - contrib/kldload \ - contrib/larch \ - contrib/ldapvi \ - contrib/lftp \ - contrib/lilo \ - contrib/links \ - contrib/lintian \ - contrib/lisp \ - contrib/lrzip \ - contrib/lvm \ - contrib/lzma \ - contrib/lzop \ - contrib/mailman \ - contrib/make \ - contrib/man \ - contrib/mc \ - contrib/mcrypt \ - contrib/mdadm \ - contrib/medusa \ - contrib/minicom \ - contrib/mkinitrd \ - contrib/module-init-tools \ - contrib/monodevelop \ - contrib/mount \ - contrib/mplayer \ - contrib/msynctool \ - contrib/mtx \ - contrib/munin-node \ - contrib/mutt \ - contrib/mysqladmin \ - contrib/ncftp \ - contrib/net-tools \ - contrib/nmap \ - contrib/ntpdate \ - contrib/openldap \ - contrib/openssl \ - contrib/p4 \ - contrib/perl \ - contrib/pine \ - contrib/pkg-config \ - contrib/pkg_install \ - contrib/pkgtools \ - contrib/pm-utils \ - contrib/portupgrade \ - contrib/postfix \ - contrib/postgresql \ - contrib/povray \ - contrib/procps \ - contrib/python \ - contrib/qdbus \ - contrib/qemu \ - contrib/quota-tools \ - contrib/rcs \ - contrib/rdesktop \ - contrib/reportbug \ - contrib/resolvconf \ - contrib/rfkill \ - contrib/ri \ - contrib/rpcdebug \ - contrib/rpm \ - contrib/rpmcheck \ - contrib/rrdtool \ - contrib/rsync \ - contrib/rtcwake \ - contrib/samba \ - contrib/sbcl \ - contrib/screen \ - contrib/service \ - contrib/shadow \ - contrib/sitecopy \ - contrib/smartctl \ - contrib/snownews \ - contrib/sqlite3 \ - contrib/ssh \ - contrib/sshfs \ - contrib/strace \ - contrib/svk \ - contrib/sysctl \ - contrib/sysv-rc \ - contrib/tar \ - contrib/tcpdump \ - contrib/unace \ - contrib/unrar \ - contrib/update-alternatives \ - contrib/util-linux \ - contrib/vncviewer \ - contrib/vpnc \ - contrib/wireless-tools \ - contrib/wodim \ - contrib/wol \ - contrib/wtf \ - contrib/wvdial \ - contrib/xhost \ - contrib/xm \ - contrib/xmllint \ - contrib/xmlwf \ - contrib/xmms \ - contrib/xrandr \ - contrib/xsltproc \ - contrib/xz \ - contrib/yp-tools \ - contrib/yum-arch - profiledir = $(sysconfdir)/profile.d profile_DATA = bash_completion.sh @@ -178,6 +10,4 @@ bash_completion.sh: bash_completion.sh.in Makefile CLEANFILES = bash_completion.sh -EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) bash_completion.sh.in \ - contrib/_mock contrib/_modules contrib/_subversion contrib/_yum \ - contrib/_yum-utils +EXTRA_DIST = CHANGES $(sysconf_DATA) bash_completion.sh.in diff --git a/configure.ac b/configure.ac index 63f0898a..1aba9e32 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,6 @@ AC_PREREQ([2.59]) AC_INIT([bash-completion], [1.99]) AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror]) -AC_CONFIG_FILES([Makefile test/Makefile]) +AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d) +AC_CONFIG_FILES([Makefile contrib/Makefile test/Makefile]) AC_OUTPUT diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 00000000..6c5a5869 --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1,172 @@ +bashcomp_DATA = abook \ + ant \ + apache2ctl \ + apt \ + apt-build \ + aptitude \ + aspell \ + autorpm \ + bash-builtins \ + bind-utils \ + bitkeeper \ + bittorrent \ + bluez \ + brctl \ + bzip2 \ + cardctl \ + cfengine \ + chkconfig \ + chsh \ + cksfv \ + clisp \ + configure \ + coreutils \ + cowsay \ + cpan2dist \ + cpio \ + crontab \ + cups \ + cryptsetup \ + cvs \ + cvsps \ + dd \ + dhclient \ + dict \ + dpkg \ + dselect \ + dsniff \ + findutils \ + freeciv \ + fuse \ + gcc \ + gcl \ + gdb \ + genisoimage \ + getent \ + gkrellm \ + gnatmake \ + gpg \ + gpg2 \ + gzip \ + heimdal \ + hping2 \ + iconv \ + ifupdown \ + imagemagick \ + info \ + iptables \ + ipmitool \ + ipsec \ + ipv6calc \ + isql \ + jar \ + java \ + k3b \ + kldload \ + larch \ + ldapvi \ + lftp \ + lilo \ + links \ + lintian \ + lisp \ + lrzip \ + lvm \ + lzma \ + lzop \ + mailman \ + make \ + man \ + mc \ + mcrypt \ + mdadm \ + medusa \ + minicom \ + mkinitrd \ + module-init-tools \ + monodevelop \ + mount \ + mplayer \ + msynctool \ + mtx \ + munin-node \ + mutt \ + mysqladmin \ + ncftp \ + net-tools \ + nmap \ + ntpdate \ + openldap \ + openssl \ + p4 \ + perl \ + pine \ + pkg-config \ + pkg_install \ + pkgtools \ + pm-utils \ + portupgrade \ + postfix \ + postgresql \ + povray \ + procps \ + python \ + qdbus \ + qemu \ + quota-tools \ + rcs \ + rdesktop \ + reportbug \ + resolvconf \ + rfkill \ + ri \ + rpcdebug \ + rpm \ + rpmcheck \ + rrdtool \ + rsync \ + rtcwake \ + samba \ + sbcl \ + screen \ + service \ + shadow \ + sitecopy \ + smartctl \ + snownews \ + sqlite3 \ + ssh \ + sshfs \ + strace \ + svk \ + sysctl \ + sysv-rc \ + tar \ + tcpdump \ + unace \ + unrar \ + update-alternatives \ + util-linux \ + vncviewer \ + vpnc \ + wireless-tools \ + wodim \ + wol \ + wtf \ + wvdial \ + xhost \ + xm \ + xmllint \ + xmlwf \ + xmms \ + xrandr \ + xsltproc \ + xz \ + yp-tools \ + yum-arch + +EXTRA_DIST = $(bashcomp_DATA) \ + _mock _modules _subversion _yum _yum-utils + +CLEANFILES = perl + From 07b7ddd1dd9311a4bd8ca9bac415c8e6ab84518d Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Mon, 2 Aug 2010 22:15:35 +0200 Subject: [PATCH 11/77] add pure perl perldoc completion helper --- CHANGES | 3 ++ configure.ac | 3 +- contrib/perl | 127 -------------------------------------------- contrib/perl.in | 61 +++++++++++++++++++++ helpers/Makefile.am | 3 ++ helpers/perldoc | 102 +++++++++++++++++++++++++++++++++++ 6 files changed, 171 insertions(+), 128 deletions(-) delete mode 100644 contrib/perl create mode 100644 contrib/perl.in create mode 100644 helpers/Makefile.am create mode 100755 helpers/perldoc diff --git a/CHANGES b/CHANGES index 81a97207..d0e70c68 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ bash-completion (2.x) + [ Guillaume Rousse ] + * added pure-perl perldoc completion helper, using work from Aristotle + Pagaltzis (pagaltzis@gmx.de) [ David Paleino ] * Fixed "service" completion, thanks to John Hedges (Debian: #586210) diff --git a/configure.ac b/configure.ac index 1aba9e32..4b647c7c 100644 --- a/configure.ac +++ b/configure.ac @@ -2,5 +2,6 @@ AC_PREREQ([2.59]) AC_INIT([bash-completion], [1.99]) AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror]) AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d) -AC_CONFIG_FILES([Makefile contrib/Makefile test/Makefile]) +AC_SUBST(helpersdir, $datadir/bash-completion/helpers) +AC_CONFIG_FILES([Makefile contrib/Makefile helpers/Makefile test/Makefile]) AC_OUTPUT diff --git a/contrib/perl b/contrib/perl deleted file mode 100644 index 67996f94..00000000 --- a/contrib/perl +++ /dev/null @@ -1,127 +0,0 @@ -# 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" ) ) - __ltrim_colon_completions "$1" -} - -_perl() -{ - local cur prev prefix temp - local optPrefix optSuffix - - COMPREPLY=() - _get_comp_words_by_ref -n : cur prev - 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 "$cur" - 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 -o nospace -o filenames perl - -_perldoc() -{ - local cur prev prefix temp - - COMPREPLY=() - _get_comp_words_by_ref -n : cur prev - 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 say 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 break caller import local my our state 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 lock' -- "$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 "$cur" - COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \ - '$( PAGER=/bin/cat man perl | \ - sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ - awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) ) - fi - _filedir '@(pl|PL|pm|PM|pod|POD)' - fi -} -complete -F _perldoc -o bashdefault 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/perl.in b/contrib/perl.in new file mode 100644 index 00000000..8fb7f5cf --- /dev/null +++ b/contrib/perl.in @@ -0,0 +1,61 @@ +# 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" ) ) + __ltrim_colon_completions "$1" +} + +_perl() +{ + local cur prev prefix temp + local optPrefix optSuffix + + COMPREPLY=() + _get_comp_words_by_ref -n : cur prev + 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 "$cur" + 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 -o nospace -o filenames perl + +complete -C @helpersdir@/perldoc -o nospace -o 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/helpers/Makefile.am b/helpers/Makefile.am new file mode 100644 index 00000000..991cfce0 --- /dev/null +++ b/helpers/Makefile.am @@ -0,0 +1,3 @@ +helpers_SCRIPTS = perldoc + +EXTRA_DIST = $(helpers_SCRIPTS) diff --git a/helpers/perldoc b/helpers/perldoc new file mode 100755 index 00000000..a366eed7 --- /dev/null +++ b/helpers/perldoc @@ -0,0 +1,102 @@ +#!/usr/bin/env perl +use strict; +use File::Spec::Functions qw( rel2abs catdir catfile no_upwards ); + +sub uniq { my %seen; grep { not $seen{$_}++ } @_ } + +sub get_command_line { + my $comp = substr $ENV{'COMP_LINE'}, 0, $ENV{'COMP_POINT'}; + return split /[ \t]+/, $comp, -1; # if not good enough, use Text::ParseWords +} + +sub slurp_dir { + opendir my $dir, shift or return; + no_upwards readdir $dir; +} + +sub suggestion_from_name { + my ( $file_rx, $path, $name ) = @_; + return if not $name =~ /$file_rx/; + return $name.'::' if -d catdir $path, $name; + return $1; +} + +sub suggestions_from_path { + my ( $file_rx, $path ) = @_; + map { suggestion_from_name $file_rx, $path, $_ } slurp_dir $path; +} + +sub get_package_suggestions { + my ( $pkg ) = @_; + + my @segment = split /::|:\z/, $pkg, -1; + my $file_rx = qr/\A(${\quotemeta pop @segment}\w*)(?:\.pm|\.pod)?\z/; + + my $home = rel2abs $ENV{'HOME'}; + my $cwd = rel2abs do { require Cwd; Cwd::cwd() }; + + my @suggestion = + map { suggestions_from_path $file_rx, $_ } + uniq map { catdir $_, @segment } + grep { $home ne $_ and $cwd ne $_ } + map { $_, ( catdir $_, 'pod' ) } + map { rel2abs $_ } + @INC; + + # fixups + if ( $pkg eq '' ) { + my $total = @suggestion; + @suggestion = grep { not /^perl/ } @suggestion; + my $num_hidden = $total - @suggestion; + push @suggestion, "perl* ($num_hidden hidden)" if $num_hidden; + } + elsif ( $pkg =~ /(? ) { + next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/; + ++$nest_level if /^=over/; + --$nest_level if /^=back/; + next if $nest_level; + push @suggestion, /^=item (-?\w+)/; + } + + my $func_rx = qr/\A${\quotemeta $func}/; + + return grep { /$func_rx/ } @suggestion; +} + +sub usage { + die map "\n$_\n", ( + "To use, issue the following command in bash:", + "\tcomplete -C perldoc-complete -o nospace -o default perldoc", + "You probably want to put that line in your ~/.bashrc file.\n", + ); +} + +usage() if not exists $ENV{'COMP_LINE'}; + +my ( $cmd, @arg ) = get_command_line(); +my $word = pop @arg; + +print "$_\n" for ( @arg and @arg[-1] eq '-f' ) + ? get_function_suggestions( $word ) + : get_package_suggestions( $word ); From c030827fdce7f7bd647fa3ebce6841dcdce4f4ce Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Mon, 9 Aug 2010 22:24:52 +0200 Subject: [PATCH 12/77] dynamic creation of perldoc completion, to point to helper script --- contrib/Makefile.am | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 6c5a5869..f8420e17 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,4 +1,4 @@ -bashcomp_DATA = abook \ +static_bashcomp = abook \ ant \ apache2ctl \ apt \ @@ -99,7 +99,6 @@ bashcomp_DATA = abook \ openldap \ openssl \ p4 \ - perl \ pine \ pkg-config \ pkg_install \ @@ -165,7 +164,14 @@ bashcomp_DATA = abook \ yp-tools \ yum-arch -EXTRA_DIST = $(bashcomp_DATA) \ +generated_bashcomp = perl + +bashcomp_DATA = $(static_bashcomp) $(generated_bashcomp) + +perl: perl.in Makefile + sed -e 's|@helpersdir[@]|$(helpersdir)|' <$(srcdir)/$@.in >$@ + +EXTRA_DIST = $(bashcomp_DATA) perl.in \ _mock _modules _subversion _yum _yum-utils CLEANFILES = perl From 30849031446ab7fb98342ddd73f2c75c04ab2449 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Mon, 9 Aug 2010 22:29:56 +0200 Subject: [PATCH 13/77] recurse in helpers dir --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ffc84429..df2140af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = contrib test +SUBDIRS = contrib helpers test sysconf_DATA = bash_completion From 9b97b40c4a646d847b52cf3eb19d0c1a1c1ee229 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Mon, 16 Aug 2010 21:17:51 +0200 Subject: [PATCH 14/77] don't source Makefiles when run from test suite --- bash_completion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index ef00f05a..cd717c52 100644 --- a/bash_completion +++ b/bash_completion @@ -1625,7 +1625,7 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ -x $BASH_COMPLETION_COMPAT_DIR ]]; then for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do i=$BASH_COMPLETION_COMPAT_DIR/$i - [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \ + [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \ && ( -f $i || -h $i ) && -r $i ]] && . "$i" done fi @@ -1634,7 +1634,7 @@ if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \ -x $BASH_COMPLETION_DIR ]]; then for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do i=$BASH_COMPLETION_DIR/$i - [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \ + [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \ && ( -f $i || -h $i ) && -r $i ]] && . "$i" done fi From b867bcd64fcac0fbfb610b1acc96895a719278c0 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Wed, 18 Aug 2010 23:01:26 +0200 Subject: [PATCH 15/77] Fix _filedir error message on bash-3 In case of `sudo cmd', _filedir might be triggered for a cmd not having a complete command, hence `complete -p cmd' could yield an error. (Alioth --- CHANGES | 1 + bash_completion | 3 ++- test/lib/completions/sudo.exp | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d0e70c68..947511e1 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ bash-completion (2.x) [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) * Speed up `compopt' availability detection + * Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646) [ Anton Khirnov ] * Improve mplayer and mencoder completions. diff --git a/bash_completion b/bash_completion index cd717c52..8661d402 100644 --- a/bash_completion +++ b/bash_completion @@ -647,7 +647,8 @@ _filedir() # Is `-o filenames' set? [[ ( ${COMP_WORDS[0]} && - "$(complete -p ${COMP_WORDS[0]})" == *"-o filenames"* + "$(complete -p ${COMP_WORDS[0]} &>/dev/null)" == \ + *"-o filenames"* ) ]] || { # No, `-o filenames' isn't set; # Emulate `-o filenames' diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp index e7a39162..1afd9933 100644 --- a/test/lib/completions/sudo.exp +++ b/test/lib/completions/sudo.exp @@ -17,4 +17,10 @@ assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/defaul sync_after_int +assert_complete "fixtures/" "sudo sh fix" + + +sync_after_int + + teardown From 3f0d8f8e9f1991e7d7610fd210c68421eef4e09f Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Thu, 19 Aug 2010 13:36:47 +0200 Subject: [PATCH 16/77] merge iconv and getent completions, as they are both glibc utils --- contrib/Makefile.am | 3 +-- contrib/{getent => glibc} | 43 ++++++++++++++++++++++++++++++++++- contrib/iconv | 48 --------------------------------------- 3 files changed, 43 insertions(+), 51 deletions(-) rename contrib/{getent => glibc} (54%) delete mode 100644 contrib/iconv diff --git a/contrib/Makefile.am b/contrib/Makefile.am index f8420e17..aceea785 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -42,15 +42,14 @@ static_bashcomp = abook \ gcl \ gdb \ genisoimage \ - getent \ gkrellm \ + glibc \ gnatmake \ gpg \ gpg2 \ gzip \ heimdal \ hping2 \ - iconv \ ifupdown \ imagemagick \ info \ diff --git a/contrib/getent b/contrib/glibc similarity index 54% rename from contrib/getent rename to contrib/glibc index 54e62ab8..954a1c62 100644 --- a/contrib/getent +++ b/contrib/glibc @@ -1,5 +1,46 @@ -# bash completion for getent +# Completions for tools included in glibc +# iconv(1) +have iconv && +_iconv() +{ + local cur prev split=false + + COMPREPLY=() + _get_comp_words_by_ref cur prev + + _split_longopt && split=true + + case $prev in + -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ + --widechar-subst) + return 0 + ;; + -f|--from-code|-t|--to-code) + COMPREPLY=( $( compgen -W '$( iconv -l | \ + sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + return 0 + ;; + -o|--output) + _filedir + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '--from-code --to-code --list -c + --unicode-subst --byte-subst --widechar-subst --output --silent + --verbose --help --usage --version' -- "$cur" ) ) + return 0 + fi +} && +complete -F _iconv -o default iconv +# Intentionally not -o filenames here, -f/-t completions may contain slashes +# and -o filenames would break them. + +# getent(1) have getent && _getent() { diff --git a/contrib/iconv b/contrib/iconv deleted file mode 100644 index 14b618dc..00000000 --- a/contrib/iconv +++ /dev/null @@ -1,48 +0,0 @@ -# iconv(1) completion - -have iconv && -_iconv() -{ - local cur prev split=false - - COMPREPLY=() - _get_comp_words_by_ref cur prev - - _split_longopt && split=true - - case $prev in - -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ - --widechar-subst) - return 0 - ;; - -f|--from-code|-t|--to-code) - COMPREPLY=( $( compgen -W '$( iconv -l | \ - sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) - return 0 - ;; - -o|--output) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $( compgen -W '--from-code --to-code --list -c - --unicode-subst --byte-subst --widechar-subst --output --silent - --verbose --help --usage --version' -- "$cur" ) ) - return 0 - fi -} && -complete -F _iconv -o default iconv -# Intentionally not -o filenames here, -f/-t completions may contain slashes -# and -o filenames would break them. - -# 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 From e846d84ed196a213f7a3c70c8e0b575ddfbf5746 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Fri, 20 Aug 2010 11:28:19 +0200 Subject: [PATCH 17/77] Fix _filedir to redirect only stderr --- bash_completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 8661d402..fed2d940 100644 --- a/bash_completion +++ b/bash_completion @@ -647,7 +647,7 @@ _filedir() # Is `-o filenames' set? [[ ( ${COMP_WORDS[0]} && - "$(complete -p ${COMP_WORDS[0]} &>/dev/null)" == \ + "$(complete -p ${COMP_WORDS[0]} 2>/dev/null)" == \ *"-o filenames"* ) ]] || { # No, `-o filenames' isn't set; From 37308e35949fc9cf463860c66b0666ab8ac2f9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 20 Aug 2010 13:35:12 +0300 Subject: [PATCH 18/77] Simplify _filedir arguments. --- contrib/mcrypt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/mcrypt b/contrib/mcrypt index e777150f..9e746fb1 100644 --- a/contrib/mcrypt +++ b/contrib/mcrypt @@ -58,12 +58,12 @@ _mcrypt() --list-hash --verbose --quiet --help \ --version --license' -- "$cur" ) ) elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then - _filedir '@(nc)' + _filedir nc else decrypt=0 for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then - _filedir '@(nc)' + _filedir nc decrypt=1 break fi From 486369d45be92c0f1ffa55a153d645f1e01bb16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 20 Aug 2010 13:37:19 +0300 Subject: [PATCH 19/77] Add *.3gpp and *.3gpp2 to mplayer filename completions. --- CHANGES | 3 ++- contrib/mplayer | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 947511e1..3fd2297e 100644 --- a/CHANGES +++ b/CHANGES @@ -9,7 +9,8 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. * Add crontab and lrzip completions. - * Add *.gif (Alioth: #312512) and *.awb to mplayer filename completions. + * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer + filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. * Improve /etc/init.d/* and sqlite3 completions. * Fix p4 completion (Alioth: #312625). diff --git a/contrib/mplayer b/contrib/mplayer index 6d1e977d..d51be1db 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)' ;; esac From fa04cb811450d8c8e77b7c52c67b9914fec2409c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 20 Aug 2010 14:09:28 +0300 Subject: [PATCH 20/77] Add *.part to mplayer and xine-based player completions (Alioth: #312657). --- CHANGES | 4 ++++ bash_completion | 2 +- contrib/mplayer | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 3fd2297e..7eada893 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,10 @@ bash-completion (2.x) [ Miklos Vajna ] * Add *.amr to mplayer file completions (Alioth: #312634). + [ Andrej Gelenberg ] + * Add *.part (partially downloaded) to mplayer and xine-based player + completions (Alioth: #312657). + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) diff --git a/bash_completion b/bash_completion index fed2d940..ad45a8d7 100644 --- a/bash_completion +++ b/bash_completion @@ -93,7 +93,7 @@ complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 p complete -f -X '!*.texi*' makeinfo texi2html complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS|ltx|LTX)' 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|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|wav|WAV|flac|FLAC|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 dragon +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|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|wav|WAV|flac|FLAC|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))?(.part)' xine aaxine fbxine kaffeine dragon 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 diff --git a/contrib/mplayer b/contrib/mplayer index d51be1db..ad458eba 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -236,7 +236,7 @@ _mplayer() -e "/^-\(Total\|.*\*\)\{0,1\}$/!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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)' + _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]|fxm|FXM|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|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB)?(.part)' ;; esac From 2d699bd8b54620791e54c32f1969c744aa20ac3d Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 22 Aug 2010 11:16:33 +0200 Subject: [PATCH 21/77] Revert "merge iconv and getent completions, as they are both glibc utils" This reverts commit 3f0d8f8e9f1991e7d7610fd210c68421eef4e09f, as this is only true for Linux --- contrib/Makefile.am | 3 ++- contrib/{glibc => getent} | 43 +---------------------------------- contrib/iconv | 48 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 43 deletions(-) rename contrib/{glibc => getent} (54%) create mode 100644 contrib/iconv diff --git a/contrib/Makefile.am b/contrib/Makefile.am index aceea785..f8420e17 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -42,14 +42,15 @@ static_bashcomp = abook \ gcl \ gdb \ genisoimage \ + getent \ gkrellm \ - glibc \ gnatmake \ gpg \ gpg2 \ gzip \ heimdal \ hping2 \ + iconv \ ifupdown \ imagemagick \ info \ diff --git a/contrib/glibc b/contrib/getent similarity index 54% rename from contrib/glibc rename to contrib/getent index 954a1c62..54e62ab8 100644 --- a/contrib/glibc +++ b/contrib/getent @@ -1,46 +1,5 @@ -# Completions for tools included in glibc +# bash completion for getent -# iconv(1) -have iconv && -_iconv() -{ - local cur prev split=false - - COMPREPLY=() - _get_comp_words_by_ref cur prev - - _split_longopt && split=true - - case $prev in - -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ - --widechar-subst) - return 0 - ;; - -f|--from-code|-t|--to-code) - COMPREPLY=( $( compgen -W '$( iconv -l | \ - sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) - return 0 - ;; - -o|--output) - _filedir - return 0 - ;; - esac - - $split && return 0 - - if [[ "$cur" = -* ]]; then - COMPREPLY=( $( compgen -W '--from-code --to-code --list -c - --unicode-subst --byte-subst --widechar-subst --output --silent - --verbose --help --usage --version' -- "$cur" ) ) - return 0 - fi -} && -complete -F _iconv -o default iconv -# Intentionally not -o filenames here, -f/-t completions may contain slashes -# and -o filenames would break them. - -# getent(1) have getent && _getent() { diff --git a/contrib/iconv b/contrib/iconv new file mode 100644 index 00000000..14b618dc --- /dev/null +++ b/contrib/iconv @@ -0,0 +1,48 @@ +# iconv(1) completion + +have iconv && +_iconv() +{ + local cur prev split=false + + COMPREPLY=() + _get_comp_words_by_ref cur prev + + _split_longopt && split=true + + case $prev in + -'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\ + --widechar-subst) + return 0 + ;; + -f|--from-code|-t|--to-code) + COMPREPLY=( $( compgen -W '$( iconv -l | \ + sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) ) + return 0 + ;; + -o|--output) + _filedir + return 0 + ;; + esac + + $split && return 0 + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '--from-code --to-code --list -c + --unicode-subst --byte-subst --widechar-subst --output --silent + --verbose --help --usage --version' -- "$cur" ) ) + return 0 + fi +} && +complete -F _iconv -o default iconv +# Intentionally not -o filenames here, -f/-t completions may contain slashes +# and -o filenames would break them. + +# 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 From 217735d807e1809d8dd4eae2f6aeb3810676d513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 3 Sep 2010 20:23:35 +0300 Subject: [PATCH 22/77] Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. --- CHANGES | 1 + contrib/xmllint | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 7eada893..48a98137 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ bash-completion (2.x) * Add "short" tarball extensions to unxz, unlzma etc completions. * Improve /etc/init.d/* and sqlite3 completions. * Fix p4 completion (Alioth: #312625). + * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/contrib/xmllint b/contrib/xmllint index 82feb4a3..d8b5051c 100644 --- a/contrib/xmllint +++ b/contrib/xmllint @@ -42,7 +42,7 @@ _xmllint() return 0 fi - _filedir '@(*ml|htm|svg)' + _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl)' } && complete -F _xmllint -o filenames xmllint From 4d0b8be863f4ae2fc254f7571622ab84a2fccc2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 5 Sep 2010 00:03:10 +0300 Subject: [PATCH 23/77] Recognize rpm query mode based on the --file, --group, --package, and --all long options (RedHat: #630328). --- CHANGES | 2 ++ contrib/rpm | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 48a98137..d41dccb4 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,8 @@ bash-completion (2.x) * Improve /etc/init.d/* and sqlite3 completions. * Fix p4 completion (Alioth: #312625). * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. + * Recognize rpm query mode based on the --file, --group, --package, and + --all long options (RedHat: #630328). [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/contrib/rpm b/contrib/rpm index 20f98522..ceb4cfc3 100644 --- a/contrib/rpm +++ b/contrib/rpm @@ -185,7 +185,7 @@ _rpm() --queryformat --rcfile --requires --scripts --suggests --triggeredby --triggers --whatprovides --whatrequires --xml" - if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + if [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then # -qf completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ @@ -193,10 +193,10 @@ _rpm() else _filedir fi - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then # -qg completion _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ @@ -209,7 +209,7 @@ _rpm() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ --last --root --state" -- "$cur" ) ) - elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])a|-all )}" == "$COMP_LINE" ]; then _rpm_installed_packages "$nodig" "$nosig" fi fi @@ -229,11 +229,11 @@ _rpm() --nofiles --noscripts --nomd5 --querytags --specfile \ --whatrequires --whatprovides" -- "$cur" ) ) # check whether we're doing file completion - elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then _filedir - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then _filedir 'rpm' else _rpm_installed_packages "$nodig" "$nosig" From c8fb5f2eb1df48fd98e370967829d3e65d7c9f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 5 Sep 2010 00:12:24 +0300 Subject: [PATCH 24/77] Simplify rpm query mode detection expressions. --- contrib/rpm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/rpm b/contrib/rpm index ceb4cfc3..1be2ff52 100644 --- a/contrib/rpm +++ b/contrib/rpm @@ -185,7 +185,7 @@ _rpm() --queryformat --rcfile --requires --scripts --suggests --triggeredby --triggers --whatprovides --whatrequires --xml" - if [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then + if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ @@ -193,10 +193,10 @@ _rpm() else _filedir fi - elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then # -qg completion _rpm_groups - elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ @@ -209,7 +209,7 @@ _rpm() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ --last --root --state" -- "$cur" ) ) - elif [ "${COMP_LINE#* -@(*([^ -])a|-all )}" == "$COMP_LINE" ]; then + elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages "$nodig" "$nosig" fi fi @@ -229,11 +229,11 @@ _rpm() --nofiles --noscripts --nomd5 --querytags --specfile \ --whatrequires --whatprovides" -- "$cur" ) ) # check whether we're doing file completion - elif [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then _filedir - elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups - elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then _filedir 'rpm' else _rpm_installed_packages "$nodig" "$nosig" From a26e92e6f35e80f931788f30851ad378ead39961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 5 Sep 2010 10:44:10 +0300 Subject: [PATCH 25/77] Improve rpm query option completions. Add --nomanifest, --all, --file, --fileid, --ftswalk, --group, --hdrid, --package, --pkgid, and --specfile; suggest --triggeredby, --whatprovides, and --whatrequires only in installed package query mode. --- CHANGES | 1 + contrib/rpm | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index d41dccb4..1628488c 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ bash-completion (2.x) * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Recognize rpm query mode based on the --file, --group, --package, and --all long options (RedHat: #630328). + * Improve rpm query option completions. [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/contrib/rpm b/contrib/rpm index 1be2ff52..d268cabd 100644 --- a/contrib/rpm +++ b/contrib/rpm @@ -142,7 +142,7 @@ _rpm() -- "$cur" ) ) return 0 ;; - --define|-D) + --define|-D|--fileid|--hdrid|--pkgid) # argument required but no completions available return 0 ;; @@ -180,10 +180,9 @@ _rpm() # 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" + --filecolor --fileprovide --filerequire --filesbypkg --info + --list --obsoletes --pipe --provides --queryformat --rcfile + --requires --scripts --suggests --triggers --xml" if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion @@ -200,15 +199,18 @@ _rpm() # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ - --httpport --httpproxy" -- "$cur" ) ) + --httpport --httpproxy --nomanifest" -- "$cur" ) ) else _filedir 'rpm' fi else # -q; installed package completion if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ - --last --root --state" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$opts --all --file --fileid + --dbpath --fscontext --ftswalk --group --hdrid --last + --package --pkgid --root --specfile --state + --triggeredby --whatprovides --whatrequires" \ + -- "$cur" ) ) elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages "$nodig" "$nosig" fi From 063013969700f71d4edc911ac6dee7c4e3a7b744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 5 Sep 2010 11:02:03 +0300 Subject: [PATCH 26/77] Add POSIX sh completion. --- CHANGES | 2 +- contrib/Makefile.am | 1 + contrib/sh | 41 +++++++++++++++++++++++++++++++++++++ test/completion/sh.exp | 1 + test/lib/completions/sh.exp | 38 ++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 contrib/sh create mode 100644 test/completion/sh.exp create mode 100644 test/lib/completions/sh.exp diff --git a/CHANGES b/CHANGES index 1628488c..79c8396f 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,7 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add crontab and lrzip completions. + * Add crontab, lrzip, and POSIX sh completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/contrib/Makefile.am b/contrib/Makefile.am index f8420e17..3733c602 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -129,6 +129,7 @@ static_bashcomp = abook \ sbcl \ screen \ service \ + sh \ shadow \ sitecopy \ smartctl \ diff --git a/contrib/sh b/contrib/sh new file mode 100644 index 00000000..f33705de --- /dev/null +++ b/contrib/sh @@ -0,0 +1,41 @@ +# POSIX sh(1) completion + +have sh && +_sh() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -c) + return 0 + ;; + -o|+o) + COMPREPLY=( $( compgen -W 'allexport errexit ignoreeof monitor + noclobber noglob noexec nolog notify nounset verbose vi + xtrace' -- "$cur" ) ) + return 0 + ;; + esac + + local opts="-a -b -C -e -f -h -i -m -n -o -u -v -x" + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$opts -c -s" -- "$cur" ) ) + return 0 + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W "${opts//-/+}" -- "$cur" ) ) + return 0 + fi + + _filedir sh +} && +complete -F _sh -o filenames sh + +# 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/test/completion/sh.exp b/test/completion/sh.exp new file mode 100644 index 00000000..599f3b29 --- /dev/null +++ b/test/completion/sh.exp @@ -0,0 +1 @@ +assert_source_completions sh diff --git a/test/lib/completions/sh.exp b/test/lib/completions/sh.exp new file mode 100644 index 00000000..e1a51bb9 --- /dev/null +++ b/test/lib/completions/sh.exp @@ -0,0 +1,38 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "sh -" + + +sync_after_int + + +assert_complete_any "sh +" + + +sync_after_int + + +assert_complete_any "sh -o " + + +sync_after_int + + +assert_no_complete "sh -c " + + +sync_after_int + + +teardown From c78db545f56bb7d29eb71953f0e0660e843515b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 10 Sep 2010 00:12:03 +0300 Subject: [PATCH 27/77] Add iftop(8) completion. --- CHANGES | 2 +- contrib/Makefile.am | 1 + contrib/iftop | 35 ++++++++++++++++++++++++++++++++++ test/completion/iftop.exp | 1 + test/lib/completions/iftop.exp | 20 +++++++++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 contrib/iftop create mode 100644 test/completion/iftop.exp create mode 100644 test/lib/completions/iftop.exp diff --git a/CHANGES b/CHANGES index 79c8396f..a2a317a5 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,7 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add crontab, lrzip, and POSIX sh completions. + * Add crontab, iftop, lrzip, and POSIX sh completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 3733c602..ea129d03 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -51,6 +51,7 @@ static_bashcomp = abook \ heimdal \ hping2 \ iconv \ + iftop \ ifupdown \ imagemagick \ info \ diff --git a/contrib/iftop b/contrib/iftop new file mode 100644 index 00000000..eefcf9c6 --- /dev/null +++ b/contrib/iftop @@ -0,0 +1,35 @@ +# iftop(8) completion + +have iftop && +_iftop() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -h|-f|-F|-m) + return 0 + ;; + -i) + _available_interfaces -a + return 0 + ;; + -c) + _filedir + return 0 + ;; + esac + + COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \ + -- "$cur" ) ) +} && +complete -F _iftop -o filenames iftop + +# 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/test/completion/iftop.exp b/test/completion/iftop.exp new file mode 100644 index 00000000..5ec1cb57 --- /dev/null +++ b/test/completion/iftop.exp @@ -0,0 +1 @@ +assert_source_completions iftop diff --git a/test/lib/completions/iftop.exp b/test/lib/completions/iftop.exp new file mode 100644 index 00000000..12941610 --- /dev/null +++ b/test/lib/completions/iftop.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "iftop " + + +sync_after_int + + +teardown From a3ae00956daceceda9a1f44f955b35fa110b33fa Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 11:37:58 +0200 Subject: [PATCH 28/77] add freerdp completion --- contrib/Makefile.am | 1 + contrib/freerdp | 47 ++++++++++++++++++++++++++++++++ test/completion/freerdp.exp | 1 + test/lib/completions/freerdp.exp | 20 ++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 contrib/freerdp create mode 100644 test/completion/freerdp.exp create mode 100644 test/lib/completions/freerdp.exp diff --git a/contrib/Makefile.am b/contrib/Makefile.am index ea129d03..b3aea2d9 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -37,6 +37,7 @@ static_bashcomp = abook \ dsniff \ findutils \ freeciv \ + freerdp \ fuse \ gcc \ gcl \ diff --git a/contrib/freerdp b/contrib/freerdp new file mode 100644 index 00000000..82a46462 --- /dev/null +++ b/contrib/freerdp @@ -0,0 +1,47 @@ +# bash completion for xfreerdp + +have xfreerdp && +_xfreerdp() +{ + local cur prev + + COMPREPLY=() + _get_comp_words_by_ref cur prev + + case $prev in + -k) + COMPREPLY=( $( compgen -W "$(xfreerdp --kbd-list | \ + awk '/^0x/ {print $1}')" -- "$cur" ) ) + return 0 + ;; + -a) + COMPREPLY=( $( compgen -W '8 15 16 24 32' -- "$cur" ) ) + return 0 + ;; + -x) + COMPREPLY=( $( compgen -W 'b broadband m modem l lan' -- $cur ) ) + return 0 + ;; + --plugin) + COMPREPLY=( $( compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -t -g -a -z -f -x -O -o \ + -k --kbd-list -h --plugin --data' -- "$cur" ) ) + else + _known_hosts_real "$cur" + fi + +} && +complete -F _xfreerdp xfreerdp + +# 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/test/completion/freerdp.exp b/test/completion/freerdp.exp new file mode 100644 index 00000000..5ca649a2 --- /dev/null +++ b/test/completion/freerdp.exp @@ -0,0 +1 @@ +assert_source_completions xfreerdp diff --git a/test/lib/completions/freerdp.exp b/test/lib/completions/freerdp.exp new file mode 100644 index 00000000..be61d459 --- /dev/null +++ b/test/lib/completions/freerdp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xfreerdp" + + +sync_after_int + + +teardown From ff6172097df8fda0f1085528b74f63887c876f91 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 16:38:59 +0200 Subject: [PATCH 29/77] symlinks are automatically dereferenced for -f test, so don't use -h test --- bash_completion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index ad45a8d7..eabb38d6 100644 --- a/bash_completion +++ b/bash_completion @@ -1627,7 +1627,7 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \ for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do i=$BASH_COMPLETION_COMPAT_DIR/$i [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \ - && ( -f $i || -h $i ) && -r $i ]] && . "$i" + && -f $i && -r $i ]] && . "$i" done fi if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \ @@ -1636,7 +1636,7 @@ if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \ for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do i=$BASH_COMPLETION_DIR/$i [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \ - && ( -f $i || -h $i ) && -r $i ]] && . "$i" + && -f $i && -r $i ]] && . "$i" done fi unset i From c85a8b9a3e36beabb3c95ff36404aaee71de878f Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 16:39:30 +0200 Subject: [PATCH 30/77] install helpers in a subdirectory of completions --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4b647c7c..1879a51e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,6 +2,6 @@ AC_PREREQ([2.59]) AC_INIT([bash-completion], [1.99]) AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror]) AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d) -AC_SUBST(helpersdir, $datadir/bash-completion/helpers) +AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers) AC_CONFIG_FILES([Makefile contrib/Makefile helpers/Makefile test/Makefile]) AC_OUTPUT From 276e3a780ec48fe1577c45e73d62bc68c70b1c00 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 16:40:04 +0200 Subject: [PATCH 31/77] use BASH_COMPLETION_DIR for locating helpers, avoiding the use of an install-time substitution --- contrib/Makefile.am | 15 +++------------ contrib/{perl.in => perl} | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) rename contrib/{perl.in => perl} (95%) diff --git a/contrib/Makefile.am b/contrib/Makefile.am index b3aea2d9..86f62251 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,4 +1,4 @@ -static_bashcomp = abook \ +bashcomp_DATA = abook \ ant \ apache2ctl \ apt \ @@ -101,6 +101,7 @@ static_bashcomp = abook \ openldap \ openssl \ p4 \ + perl \ pine \ pkg-config \ pkg_install \ @@ -167,15 +168,5 @@ static_bashcomp = abook \ yp-tools \ yum-arch -generated_bashcomp = perl - -bashcomp_DATA = $(static_bashcomp) $(generated_bashcomp) - -perl: perl.in Makefile - sed -e 's|@helpersdir[@]|$(helpersdir)|' <$(srcdir)/$@.in >$@ - -EXTRA_DIST = $(bashcomp_DATA) perl.in \ +EXTRA_DIST = $(bashcomp_DATA) \ _mock _modules _subversion _yum _yum-utils - -CLEANFILES = perl - diff --git a/contrib/perl.in b/contrib/perl similarity index 95% rename from contrib/perl.in rename to contrib/perl index 8fb7f5cf..ea71b2f4 100644 --- a/contrib/perl.in +++ b/contrib/perl @@ -49,7 +49,7 @@ _perl() } complete -F _perl -o nospace -o filenames perl -complete -C @helpersdir@/perldoc -o nospace -o default perldoc +complete -C $BASH_COMPLETION_DIR/helpers/perldoc -o nospace -o default perldoc } # Local variables: From cb7fc2f7c4a4c7c5a665c5bf8b73b40fc5e268a9 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 16:42:21 +0200 Subject: [PATCH 32/77] rename 'contrib' directory to 'completions' --- Makefile.am | 2 +- {contrib => completions}/Makefile.am | 0 {contrib => completions}/_mock | 0 {contrib => completions}/_modules | 0 {contrib => completions}/_subversion | 0 {contrib => completions}/_yum | 0 {contrib => completions}/_yum-utils | 0 {contrib => completions}/abook | 0 {contrib => completions}/ant | 0 {contrib => completions}/apache2ctl | 0 {contrib => completions}/apt | 0 {contrib => completions}/apt-build | 0 {contrib => completions}/aptitude | 0 {contrib => completions}/aspell | 0 {contrib => completions}/autorpm | 0 {contrib => completions}/bash-builtins | 0 {contrib => completions}/bind-utils | 0 {contrib => completions}/bitkeeper | 0 {contrib => completions}/bittorrent | 0 {contrib => completions}/bluez | 0 {contrib => completions}/brctl | 0 {contrib => completions}/bzip2 | 0 {contrib => completions}/cardctl | 0 {contrib => completions}/cfengine | 0 {contrib => completions}/chkconfig | 0 {contrib => completions}/chsh | 0 {contrib => completions}/cksfv | 0 {contrib => completions}/clisp | 0 {contrib => completions}/configure | 0 {contrib => completions}/coreutils | 0 {contrib => completions}/cowsay | 0 {contrib => completions}/cpan2dist | 0 {contrib => completions}/cpio | 0 {contrib => completions}/crontab | 0 {contrib => completions}/cryptsetup | 0 {contrib => completions}/cups | 0 {contrib => completions}/cvs | 0 {contrib => completions}/cvsps | 0 {contrib => completions}/dd | 0 {contrib => completions}/dhclient | 0 {contrib => completions}/dict | 0 {contrib => completions}/dpkg | 0 {contrib => completions}/dselect | 0 {contrib => completions}/dsniff | 0 {contrib => completions}/findutils | 0 {contrib => completions}/freeciv | 0 {contrib => completions}/freerdp | 0 {contrib => completions}/fuse | 0 {contrib => completions}/gcc | 0 {contrib => completions}/gcl | 0 {contrib => completions}/gdb | 0 {contrib => completions}/genisoimage | 0 {contrib => completions}/getent | 0 {contrib => completions}/gkrellm | 0 {contrib => completions}/gnatmake | 0 {contrib => completions}/gpg | 0 {contrib => completions}/gpg2 | 0 {contrib => completions}/gzip | 0 {contrib => completions}/heimdal | 0 {contrib => completions}/hping2 | 0 {contrib => completions}/iconv | 0 {contrib => completions}/iftop | 0 {contrib => completions}/ifupdown | 0 {contrib => completions}/imagemagick | 0 {contrib => completions}/info | 0 {contrib => completions}/ipmitool | 0 {contrib => completions}/ipsec | 0 {contrib => completions}/iptables | 0 {contrib => completions}/ipv6calc | 0 {contrib => completions}/isql | 0 {contrib => completions}/jar | 0 {contrib => completions}/java | 0 {contrib => completions}/k3b | 0 {contrib => completions}/kldload | 0 {contrib => completions}/larch | 0 {contrib => completions}/ldapvi | 0 {contrib => completions}/lftp | 0 {contrib => completions}/lilo | 0 {contrib => completions}/links | 0 {contrib => completions}/lintian | 0 {contrib => completions}/lisp | 0 {contrib => completions}/lrzip | 0 {contrib => completions}/lvm | 0 {contrib => completions}/lzma | 0 {contrib => completions}/lzop | 0 {contrib => completions}/mailman | 0 {contrib => completions}/make | 0 {contrib => completions}/man | 0 {contrib => completions}/mc | 0 {contrib => completions}/mcrypt | 0 {contrib => completions}/mdadm | 0 {contrib => completions}/medusa | 0 {contrib => completions}/minicom | 0 {contrib => completions}/mkinitrd | 0 {contrib => completions}/module-init-tools | 0 {contrib => completions}/monodevelop | 0 {contrib => completions}/mount | 0 {contrib => completions}/mplayer | 0 {contrib => completions}/msynctool | 0 {contrib => completions}/mtx | 0 {contrib => completions}/munin-node | 0 {contrib => completions}/mutt | 0 {contrib => completions}/mysqladmin | 0 {contrib => completions}/ncftp | 0 {contrib => completions}/net-tools | 0 {contrib => completions}/nmap | 0 {contrib => completions}/ntpdate | 0 {contrib => completions}/openldap | 0 {contrib => completions}/openssl | 0 {contrib => completions}/p4 | 0 {contrib => completions}/perl | 0 {contrib => completions}/pine | 0 {contrib => completions}/pkg-config | 0 {contrib => completions}/pkg_install | 0 {contrib => completions}/pkgtools | 0 {contrib => completions}/pm-utils | 0 {contrib => completions}/portupgrade | 0 {contrib => completions}/postfix | 0 {contrib => completions}/postgresql | 0 {contrib => completions}/povray | 0 {contrib => completions}/procps | 0 {contrib => completions}/python | 0 {contrib => completions}/qdbus | 0 {contrib => completions}/qemu | 0 {contrib => completions}/quota-tools | 0 {contrib => completions}/rcs | 0 {contrib => completions}/rdesktop | 0 {contrib => completions}/reportbug | 0 {contrib => completions}/resolvconf | 0 {contrib => completions}/rfkill | 0 {contrib => completions}/ri | 0 {contrib => completions}/rpcdebug | 0 {contrib => completions}/rpm | 0 {contrib => completions}/rpmcheck | 0 {contrib => completions}/rrdtool | 0 {contrib => completions}/rsync | 0 {contrib => completions}/rtcwake | 0 {contrib => completions}/samba | 0 {contrib => completions}/sbcl | 0 {contrib => completions}/screen | 0 {contrib => completions}/service | 0 {contrib => completions}/sh | 0 {contrib => completions}/shadow | 0 {contrib => completions}/sitecopy | 0 {contrib => completions}/smartctl | 0 {contrib => completions}/snownews | 0 {contrib => completions}/sqlite3 | 0 {contrib => completions}/ssh | 0 {contrib => completions}/sshfs | 0 {contrib => completions}/strace | 0 {contrib => completions}/svk | 0 {contrib => completions}/sysctl | 0 {contrib => completions}/sysv-rc | 0 {contrib => completions}/tar | 0 {contrib => completions}/tcpdump | 0 {contrib => completions}/unace | 0 {contrib => completions}/unrar | 0 {contrib => completions}/update-alternatives | 0 {contrib => completions}/util-linux | 0 {contrib => completions}/vncviewer | 0 {contrib => completions}/vpnc | 0 {contrib => completions}/wireless-tools | 0 {contrib => completions}/wodim | 0 {contrib => completions}/wol | 0 {contrib => completions}/wtf | 0 {contrib => completions}/wvdial | 0 {contrib => completions}/xhost | 0 {contrib => completions}/xm | 0 {contrib => completions}/xmllint | 0 {contrib => completions}/xmlwf | 0 {contrib => completions}/xmms | 0 {contrib => completions}/xrandr | 0 {contrib => completions}/xsltproc | 0 {contrib => completions}/xz | 0 {contrib => completions}/yp-tools | 0 {contrib => completions}/yum-arch | 0 configure.ac | 2 +- 177 files changed, 2 insertions(+), 2 deletions(-) rename {contrib => completions}/Makefile.am (100%) rename {contrib => completions}/_mock (100%) rename {contrib => completions}/_modules (100%) rename {contrib => completions}/_subversion (100%) rename {contrib => completions}/_yum (100%) rename {contrib => completions}/_yum-utils (100%) rename {contrib => completions}/abook (100%) rename {contrib => completions}/ant (100%) rename {contrib => completions}/apache2ctl (100%) rename {contrib => completions}/apt (100%) rename {contrib => completions}/apt-build (100%) rename {contrib => completions}/aptitude (100%) rename {contrib => completions}/aspell (100%) rename {contrib => completions}/autorpm (100%) rename {contrib => completions}/bash-builtins (100%) rename {contrib => completions}/bind-utils (100%) rename {contrib => completions}/bitkeeper (100%) rename {contrib => completions}/bittorrent (100%) rename {contrib => completions}/bluez (100%) rename {contrib => completions}/brctl (100%) rename {contrib => completions}/bzip2 (100%) rename {contrib => completions}/cardctl (100%) rename {contrib => completions}/cfengine (100%) rename {contrib => completions}/chkconfig (100%) rename {contrib => completions}/chsh (100%) rename {contrib => completions}/cksfv (100%) rename {contrib => completions}/clisp (100%) rename {contrib => completions}/configure (100%) rename {contrib => completions}/coreutils (100%) rename {contrib => completions}/cowsay (100%) rename {contrib => completions}/cpan2dist (100%) rename {contrib => completions}/cpio (100%) rename {contrib => completions}/crontab (100%) rename {contrib => completions}/cryptsetup (100%) rename {contrib => completions}/cups (100%) rename {contrib => completions}/cvs (100%) rename {contrib => completions}/cvsps (100%) rename {contrib => completions}/dd (100%) rename {contrib => completions}/dhclient (100%) rename {contrib => completions}/dict (100%) rename {contrib => completions}/dpkg (100%) rename {contrib => completions}/dselect (100%) rename {contrib => completions}/dsniff (100%) rename {contrib => completions}/findutils (100%) rename {contrib => completions}/freeciv (100%) rename {contrib => completions}/freerdp (100%) rename {contrib => completions}/fuse (100%) rename {contrib => completions}/gcc (100%) rename {contrib => completions}/gcl (100%) rename {contrib => completions}/gdb (100%) rename {contrib => completions}/genisoimage (100%) rename {contrib => completions}/getent (100%) rename {contrib => completions}/gkrellm (100%) rename {contrib => completions}/gnatmake (100%) rename {contrib => completions}/gpg (100%) rename {contrib => completions}/gpg2 (100%) rename {contrib => completions}/gzip (100%) rename {contrib => completions}/heimdal (100%) rename {contrib => completions}/hping2 (100%) rename {contrib => completions}/iconv (100%) rename {contrib => completions}/iftop (100%) rename {contrib => completions}/ifupdown (100%) rename {contrib => completions}/imagemagick (100%) rename {contrib => completions}/info (100%) rename {contrib => completions}/ipmitool (100%) rename {contrib => completions}/ipsec (100%) rename {contrib => completions}/iptables (100%) rename {contrib => completions}/ipv6calc (100%) rename {contrib => completions}/isql (100%) rename {contrib => completions}/jar (100%) rename {contrib => completions}/java (100%) rename {contrib => completions}/k3b (100%) rename {contrib => completions}/kldload (100%) rename {contrib => completions}/larch (100%) rename {contrib => completions}/ldapvi (100%) rename {contrib => completions}/lftp (100%) rename {contrib => completions}/lilo (100%) rename {contrib => completions}/links (100%) rename {contrib => completions}/lintian (100%) rename {contrib => completions}/lisp (100%) rename {contrib => completions}/lrzip (100%) rename {contrib => completions}/lvm (100%) rename {contrib => completions}/lzma (100%) rename {contrib => completions}/lzop (100%) rename {contrib => completions}/mailman (100%) rename {contrib => completions}/make (100%) rename {contrib => completions}/man (100%) rename {contrib => completions}/mc (100%) rename {contrib => completions}/mcrypt (100%) rename {contrib => completions}/mdadm (100%) rename {contrib => completions}/medusa (100%) rename {contrib => completions}/minicom (100%) rename {contrib => completions}/mkinitrd (100%) rename {contrib => completions}/module-init-tools (100%) rename {contrib => completions}/monodevelop (100%) rename {contrib => completions}/mount (100%) rename {contrib => completions}/mplayer (100%) rename {contrib => completions}/msynctool (100%) rename {contrib => completions}/mtx (100%) rename {contrib => completions}/munin-node (100%) rename {contrib => completions}/mutt (100%) rename {contrib => completions}/mysqladmin (100%) rename {contrib => completions}/ncftp (100%) rename {contrib => completions}/net-tools (100%) rename {contrib => completions}/nmap (100%) rename {contrib => completions}/ntpdate (100%) rename {contrib => completions}/openldap (100%) rename {contrib => completions}/openssl (100%) rename {contrib => completions}/p4 (100%) rename {contrib => completions}/perl (100%) rename {contrib => completions}/pine (100%) rename {contrib => completions}/pkg-config (100%) rename {contrib => completions}/pkg_install (100%) rename {contrib => completions}/pkgtools (100%) rename {contrib => completions}/pm-utils (100%) rename {contrib => completions}/portupgrade (100%) rename {contrib => completions}/postfix (100%) rename {contrib => completions}/postgresql (100%) rename {contrib => completions}/povray (100%) rename {contrib => completions}/procps (100%) rename {contrib => completions}/python (100%) rename {contrib => completions}/qdbus (100%) rename {contrib => completions}/qemu (100%) rename {contrib => completions}/quota-tools (100%) rename {contrib => completions}/rcs (100%) rename {contrib => completions}/rdesktop (100%) rename {contrib => completions}/reportbug (100%) rename {contrib => completions}/resolvconf (100%) rename {contrib => completions}/rfkill (100%) rename {contrib => completions}/ri (100%) rename {contrib => completions}/rpcdebug (100%) rename {contrib => completions}/rpm (100%) rename {contrib => completions}/rpmcheck (100%) rename {contrib => completions}/rrdtool (100%) rename {contrib => completions}/rsync (100%) rename {contrib => completions}/rtcwake (100%) rename {contrib => completions}/samba (100%) rename {contrib => completions}/sbcl (100%) rename {contrib => completions}/screen (100%) rename {contrib => completions}/service (100%) rename {contrib => completions}/sh (100%) rename {contrib => completions}/shadow (100%) rename {contrib => completions}/sitecopy (100%) rename {contrib => completions}/smartctl (100%) rename {contrib => completions}/snownews (100%) rename {contrib => completions}/sqlite3 (100%) rename {contrib => completions}/ssh (100%) rename {contrib => completions}/sshfs (100%) rename {contrib => completions}/strace (100%) rename {contrib => completions}/svk (100%) rename {contrib => completions}/sysctl (100%) rename {contrib => completions}/sysv-rc (100%) rename {contrib => completions}/tar (100%) rename {contrib => completions}/tcpdump (100%) rename {contrib => completions}/unace (100%) rename {contrib => completions}/unrar (100%) rename {contrib => completions}/update-alternatives (100%) rename {contrib => completions}/util-linux (100%) rename {contrib => completions}/vncviewer (100%) rename {contrib => completions}/vpnc (100%) rename {contrib => completions}/wireless-tools (100%) rename {contrib => completions}/wodim (100%) rename {contrib => completions}/wol (100%) rename {contrib => completions}/wtf (100%) rename {contrib => completions}/wvdial (100%) rename {contrib => completions}/xhost (100%) rename {contrib => completions}/xm (100%) rename {contrib => completions}/xmllint (100%) rename {contrib => completions}/xmlwf (100%) rename {contrib => completions}/xmms (100%) rename {contrib => completions}/xrandr (100%) rename {contrib => completions}/xsltproc (100%) rename {contrib => completions}/xz (100%) rename {contrib => completions}/yp-tools (100%) rename {contrib => completions}/yum-arch (100%) diff --git a/Makefile.am b/Makefile.am index df2140af..94016028 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = contrib helpers test +SUBDIRS = completions helpers test sysconf_DATA = bash_completion diff --git a/contrib/Makefile.am b/completions/Makefile.am similarity index 100% rename from contrib/Makefile.am rename to completions/Makefile.am diff --git a/contrib/_mock b/completions/_mock similarity index 100% rename from contrib/_mock rename to completions/_mock diff --git a/contrib/_modules b/completions/_modules similarity index 100% rename from contrib/_modules rename to completions/_modules diff --git a/contrib/_subversion b/completions/_subversion similarity index 100% rename from contrib/_subversion rename to completions/_subversion diff --git a/contrib/_yum b/completions/_yum similarity index 100% rename from contrib/_yum rename to completions/_yum diff --git a/contrib/_yum-utils b/completions/_yum-utils similarity index 100% rename from contrib/_yum-utils rename to completions/_yum-utils diff --git a/contrib/abook b/completions/abook similarity index 100% rename from contrib/abook rename to completions/abook diff --git a/contrib/ant b/completions/ant similarity index 100% rename from contrib/ant rename to completions/ant diff --git a/contrib/apache2ctl b/completions/apache2ctl similarity index 100% rename from contrib/apache2ctl rename to completions/apache2ctl diff --git a/contrib/apt b/completions/apt similarity index 100% rename from contrib/apt rename to completions/apt diff --git a/contrib/apt-build b/completions/apt-build similarity index 100% rename from contrib/apt-build rename to completions/apt-build diff --git a/contrib/aptitude b/completions/aptitude similarity index 100% rename from contrib/aptitude rename to completions/aptitude diff --git a/contrib/aspell b/completions/aspell similarity index 100% rename from contrib/aspell rename to completions/aspell diff --git a/contrib/autorpm b/completions/autorpm similarity index 100% rename from contrib/autorpm rename to completions/autorpm diff --git a/contrib/bash-builtins b/completions/bash-builtins similarity index 100% rename from contrib/bash-builtins rename to completions/bash-builtins diff --git a/contrib/bind-utils b/completions/bind-utils similarity index 100% rename from contrib/bind-utils rename to completions/bind-utils diff --git a/contrib/bitkeeper b/completions/bitkeeper similarity index 100% rename from contrib/bitkeeper rename to completions/bitkeeper diff --git a/contrib/bittorrent b/completions/bittorrent similarity index 100% rename from contrib/bittorrent rename to completions/bittorrent diff --git a/contrib/bluez b/completions/bluez similarity index 100% rename from contrib/bluez rename to completions/bluez diff --git a/contrib/brctl b/completions/brctl similarity index 100% rename from contrib/brctl rename to completions/brctl diff --git a/contrib/bzip2 b/completions/bzip2 similarity index 100% rename from contrib/bzip2 rename to completions/bzip2 diff --git a/contrib/cardctl b/completions/cardctl similarity index 100% rename from contrib/cardctl rename to completions/cardctl diff --git a/contrib/cfengine b/completions/cfengine similarity index 100% rename from contrib/cfengine rename to completions/cfengine diff --git a/contrib/chkconfig b/completions/chkconfig similarity index 100% rename from contrib/chkconfig rename to completions/chkconfig diff --git a/contrib/chsh b/completions/chsh similarity index 100% rename from contrib/chsh rename to completions/chsh diff --git a/contrib/cksfv b/completions/cksfv similarity index 100% rename from contrib/cksfv rename to completions/cksfv diff --git a/contrib/clisp b/completions/clisp similarity index 100% rename from contrib/clisp rename to completions/clisp diff --git a/contrib/configure b/completions/configure similarity index 100% rename from contrib/configure rename to completions/configure diff --git a/contrib/coreutils b/completions/coreutils similarity index 100% rename from contrib/coreutils rename to completions/coreutils diff --git a/contrib/cowsay b/completions/cowsay similarity index 100% rename from contrib/cowsay rename to completions/cowsay diff --git a/contrib/cpan2dist b/completions/cpan2dist similarity index 100% rename from contrib/cpan2dist rename to completions/cpan2dist diff --git a/contrib/cpio b/completions/cpio similarity index 100% rename from contrib/cpio rename to completions/cpio diff --git a/contrib/crontab b/completions/crontab similarity index 100% rename from contrib/crontab rename to completions/crontab diff --git a/contrib/cryptsetup b/completions/cryptsetup similarity index 100% rename from contrib/cryptsetup rename to completions/cryptsetup diff --git a/contrib/cups b/completions/cups similarity index 100% rename from contrib/cups rename to completions/cups diff --git a/contrib/cvs b/completions/cvs similarity index 100% rename from contrib/cvs rename to completions/cvs diff --git a/contrib/cvsps b/completions/cvsps similarity index 100% rename from contrib/cvsps rename to completions/cvsps diff --git a/contrib/dd b/completions/dd similarity index 100% rename from contrib/dd rename to completions/dd diff --git a/contrib/dhclient b/completions/dhclient similarity index 100% rename from contrib/dhclient rename to completions/dhclient diff --git a/contrib/dict b/completions/dict similarity index 100% rename from contrib/dict rename to completions/dict diff --git a/contrib/dpkg b/completions/dpkg similarity index 100% rename from contrib/dpkg rename to completions/dpkg diff --git a/contrib/dselect b/completions/dselect similarity index 100% rename from contrib/dselect rename to completions/dselect diff --git a/contrib/dsniff b/completions/dsniff similarity index 100% rename from contrib/dsniff rename to completions/dsniff diff --git a/contrib/findutils b/completions/findutils similarity index 100% rename from contrib/findutils rename to completions/findutils diff --git a/contrib/freeciv b/completions/freeciv similarity index 100% rename from contrib/freeciv rename to completions/freeciv diff --git a/contrib/freerdp b/completions/freerdp similarity index 100% rename from contrib/freerdp rename to completions/freerdp diff --git a/contrib/fuse b/completions/fuse similarity index 100% rename from contrib/fuse rename to completions/fuse diff --git a/contrib/gcc b/completions/gcc similarity index 100% rename from contrib/gcc rename to completions/gcc diff --git a/contrib/gcl b/completions/gcl similarity index 100% rename from contrib/gcl rename to completions/gcl diff --git a/contrib/gdb b/completions/gdb similarity index 100% rename from contrib/gdb rename to completions/gdb diff --git a/contrib/genisoimage b/completions/genisoimage similarity index 100% rename from contrib/genisoimage rename to completions/genisoimage diff --git a/contrib/getent b/completions/getent similarity index 100% rename from contrib/getent rename to completions/getent diff --git a/contrib/gkrellm b/completions/gkrellm similarity index 100% rename from contrib/gkrellm rename to completions/gkrellm diff --git a/contrib/gnatmake b/completions/gnatmake similarity index 100% rename from contrib/gnatmake rename to completions/gnatmake diff --git a/contrib/gpg b/completions/gpg similarity index 100% rename from contrib/gpg rename to completions/gpg diff --git a/contrib/gpg2 b/completions/gpg2 similarity index 100% rename from contrib/gpg2 rename to completions/gpg2 diff --git a/contrib/gzip b/completions/gzip similarity index 100% rename from contrib/gzip rename to completions/gzip diff --git a/contrib/heimdal b/completions/heimdal similarity index 100% rename from contrib/heimdal rename to completions/heimdal diff --git a/contrib/hping2 b/completions/hping2 similarity index 100% rename from contrib/hping2 rename to completions/hping2 diff --git a/contrib/iconv b/completions/iconv similarity index 100% rename from contrib/iconv rename to completions/iconv diff --git a/contrib/iftop b/completions/iftop similarity index 100% rename from contrib/iftop rename to completions/iftop diff --git a/contrib/ifupdown b/completions/ifupdown similarity index 100% rename from contrib/ifupdown rename to completions/ifupdown diff --git a/contrib/imagemagick b/completions/imagemagick similarity index 100% rename from contrib/imagemagick rename to completions/imagemagick diff --git a/contrib/info b/completions/info similarity index 100% rename from contrib/info rename to completions/info diff --git a/contrib/ipmitool b/completions/ipmitool similarity index 100% rename from contrib/ipmitool rename to completions/ipmitool diff --git a/contrib/ipsec b/completions/ipsec similarity index 100% rename from contrib/ipsec rename to completions/ipsec diff --git a/contrib/iptables b/completions/iptables similarity index 100% rename from contrib/iptables rename to completions/iptables diff --git a/contrib/ipv6calc b/completions/ipv6calc similarity index 100% rename from contrib/ipv6calc rename to completions/ipv6calc diff --git a/contrib/isql b/completions/isql similarity index 100% rename from contrib/isql rename to completions/isql diff --git a/contrib/jar b/completions/jar similarity index 100% rename from contrib/jar rename to completions/jar diff --git a/contrib/java b/completions/java similarity index 100% rename from contrib/java rename to completions/java diff --git a/contrib/k3b b/completions/k3b similarity index 100% rename from contrib/k3b rename to completions/k3b diff --git a/contrib/kldload b/completions/kldload similarity index 100% rename from contrib/kldload rename to completions/kldload diff --git a/contrib/larch b/completions/larch similarity index 100% rename from contrib/larch rename to completions/larch diff --git a/contrib/ldapvi b/completions/ldapvi similarity index 100% rename from contrib/ldapvi rename to completions/ldapvi diff --git a/contrib/lftp b/completions/lftp similarity index 100% rename from contrib/lftp rename to completions/lftp diff --git a/contrib/lilo b/completions/lilo similarity index 100% rename from contrib/lilo rename to completions/lilo diff --git a/contrib/links b/completions/links similarity index 100% rename from contrib/links rename to completions/links diff --git a/contrib/lintian b/completions/lintian similarity index 100% rename from contrib/lintian rename to completions/lintian diff --git a/contrib/lisp b/completions/lisp similarity index 100% rename from contrib/lisp rename to completions/lisp diff --git a/contrib/lrzip b/completions/lrzip similarity index 100% rename from contrib/lrzip rename to completions/lrzip diff --git a/contrib/lvm b/completions/lvm similarity index 100% rename from contrib/lvm rename to completions/lvm diff --git a/contrib/lzma b/completions/lzma similarity index 100% rename from contrib/lzma rename to completions/lzma diff --git a/contrib/lzop b/completions/lzop similarity index 100% rename from contrib/lzop rename to completions/lzop diff --git a/contrib/mailman b/completions/mailman similarity index 100% rename from contrib/mailman rename to completions/mailman diff --git a/contrib/make b/completions/make similarity index 100% rename from contrib/make rename to completions/make diff --git a/contrib/man b/completions/man similarity index 100% rename from contrib/man rename to completions/man diff --git a/contrib/mc b/completions/mc similarity index 100% rename from contrib/mc rename to completions/mc diff --git a/contrib/mcrypt b/completions/mcrypt similarity index 100% rename from contrib/mcrypt rename to completions/mcrypt diff --git a/contrib/mdadm b/completions/mdadm similarity index 100% rename from contrib/mdadm rename to completions/mdadm diff --git a/contrib/medusa b/completions/medusa similarity index 100% rename from contrib/medusa rename to completions/medusa diff --git a/contrib/minicom b/completions/minicom similarity index 100% rename from contrib/minicom rename to completions/minicom diff --git a/contrib/mkinitrd b/completions/mkinitrd similarity index 100% rename from contrib/mkinitrd rename to completions/mkinitrd diff --git a/contrib/module-init-tools b/completions/module-init-tools similarity index 100% rename from contrib/module-init-tools rename to completions/module-init-tools diff --git a/contrib/monodevelop b/completions/monodevelop similarity index 100% rename from contrib/monodevelop rename to completions/monodevelop diff --git a/contrib/mount b/completions/mount similarity index 100% rename from contrib/mount rename to completions/mount diff --git a/contrib/mplayer b/completions/mplayer similarity index 100% rename from contrib/mplayer rename to completions/mplayer diff --git a/contrib/msynctool b/completions/msynctool similarity index 100% rename from contrib/msynctool rename to completions/msynctool diff --git a/contrib/mtx b/completions/mtx similarity index 100% rename from contrib/mtx rename to completions/mtx diff --git a/contrib/munin-node b/completions/munin-node similarity index 100% rename from contrib/munin-node rename to completions/munin-node diff --git a/contrib/mutt b/completions/mutt similarity index 100% rename from contrib/mutt rename to completions/mutt diff --git a/contrib/mysqladmin b/completions/mysqladmin similarity index 100% rename from contrib/mysqladmin rename to completions/mysqladmin diff --git a/contrib/ncftp b/completions/ncftp similarity index 100% rename from contrib/ncftp rename to completions/ncftp diff --git a/contrib/net-tools b/completions/net-tools similarity index 100% rename from contrib/net-tools rename to completions/net-tools diff --git a/contrib/nmap b/completions/nmap similarity index 100% rename from contrib/nmap rename to completions/nmap diff --git a/contrib/ntpdate b/completions/ntpdate similarity index 100% rename from contrib/ntpdate rename to completions/ntpdate diff --git a/contrib/openldap b/completions/openldap similarity index 100% rename from contrib/openldap rename to completions/openldap diff --git a/contrib/openssl b/completions/openssl similarity index 100% rename from contrib/openssl rename to completions/openssl diff --git a/contrib/p4 b/completions/p4 similarity index 100% rename from contrib/p4 rename to completions/p4 diff --git a/contrib/perl b/completions/perl similarity index 100% rename from contrib/perl rename to completions/perl diff --git a/contrib/pine b/completions/pine similarity index 100% rename from contrib/pine rename to completions/pine diff --git a/contrib/pkg-config b/completions/pkg-config similarity index 100% rename from contrib/pkg-config rename to completions/pkg-config diff --git a/contrib/pkg_install b/completions/pkg_install similarity index 100% rename from contrib/pkg_install rename to completions/pkg_install diff --git a/contrib/pkgtools b/completions/pkgtools similarity index 100% rename from contrib/pkgtools rename to completions/pkgtools diff --git a/contrib/pm-utils b/completions/pm-utils similarity index 100% rename from contrib/pm-utils rename to completions/pm-utils diff --git a/contrib/portupgrade b/completions/portupgrade similarity index 100% rename from contrib/portupgrade rename to completions/portupgrade diff --git a/contrib/postfix b/completions/postfix similarity index 100% rename from contrib/postfix rename to completions/postfix diff --git a/contrib/postgresql b/completions/postgresql similarity index 100% rename from contrib/postgresql rename to completions/postgresql diff --git a/contrib/povray b/completions/povray similarity index 100% rename from contrib/povray rename to completions/povray diff --git a/contrib/procps b/completions/procps similarity index 100% rename from contrib/procps rename to completions/procps diff --git a/contrib/python b/completions/python similarity index 100% rename from contrib/python rename to completions/python diff --git a/contrib/qdbus b/completions/qdbus similarity index 100% rename from contrib/qdbus rename to completions/qdbus diff --git a/contrib/qemu b/completions/qemu similarity index 100% rename from contrib/qemu rename to completions/qemu diff --git a/contrib/quota-tools b/completions/quota-tools similarity index 100% rename from contrib/quota-tools rename to completions/quota-tools diff --git a/contrib/rcs b/completions/rcs similarity index 100% rename from contrib/rcs rename to completions/rcs diff --git a/contrib/rdesktop b/completions/rdesktop similarity index 100% rename from contrib/rdesktop rename to completions/rdesktop diff --git a/contrib/reportbug b/completions/reportbug similarity index 100% rename from contrib/reportbug rename to completions/reportbug diff --git a/contrib/resolvconf b/completions/resolvconf similarity index 100% rename from contrib/resolvconf rename to completions/resolvconf diff --git a/contrib/rfkill b/completions/rfkill similarity index 100% rename from contrib/rfkill rename to completions/rfkill diff --git a/contrib/ri b/completions/ri similarity index 100% rename from contrib/ri rename to completions/ri diff --git a/contrib/rpcdebug b/completions/rpcdebug similarity index 100% rename from contrib/rpcdebug rename to completions/rpcdebug diff --git a/contrib/rpm b/completions/rpm similarity index 100% rename from contrib/rpm rename to completions/rpm diff --git a/contrib/rpmcheck b/completions/rpmcheck similarity index 100% rename from contrib/rpmcheck rename to completions/rpmcheck diff --git a/contrib/rrdtool b/completions/rrdtool similarity index 100% rename from contrib/rrdtool rename to completions/rrdtool diff --git a/contrib/rsync b/completions/rsync similarity index 100% rename from contrib/rsync rename to completions/rsync diff --git a/contrib/rtcwake b/completions/rtcwake similarity index 100% rename from contrib/rtcwake rename to completions/rtcwake diff --git a/contrib/samba b/completions/samba similarity index 100% rename from contrib/samba rename to completions/samba diff --git a/contrib/sbcl b/completions/sbcl similarity index 100% rename from contrib/sbcl rename to completions/sbcl diff --git a/contrib/screen b/completions/screen similarity index 100% rename from contrib/screen rename to completions/screen diff --git a/contrib/service b/completions/service similarity index 100% rename from contrib/service rename to completions/service diff --git a/contrib/sh b/completions/sh similarity index 100% rename from contrib/sh rename to completions/sh diff --git a/contrib/shadow b/completions/shadow similarity index 100% rename from contrib/shadow rename to completions/shadow diff --git a/contrib/sitecopy b/completions/sitecopy similarity index 100% rename from contrib/sitecopy rename to completions/sitecopy diff --git a/contrib/smartctl b/completions/smartctl similarity index 100% rename from contrib/smartctl rename to completions/smartctl diff --git a/contrib/snownews b/completions/snownews similarity index 100% rename from contrib/snownews rename to completions/snownews diff --git a/contrib/sqlite3 b/completions/sqlite3 similarity index 100% rename from contrib/sqlite3 rename to completions/sqlite3 diff --git a/contrib/ssh b/completions/ssh similarity index 100% rename from contrib/ssh rename to completions/ssh diff --git a/contrib/sshfs b/completions/sshfs similarity index 100% rename from contrib/sshfs rename to completions/sshfs diff --git a/contrib/strace b/completions/strace similarity index 100% rename from contrib/strace rename to completions/strace diff --git a/contrib/svk b/completions/svk similarity index 100% rename from contrib/svk rename to completions/svk diff --git a/contrib/sysctl b/completions/sysctl similarity index 100% rename from contrib/sysctl rename to completions/sysctl diff --git a/contrib/sysv-rc b/completions/sysv-rc similarity index 100% rename from contrib/sysv-rc rename to completions/sysv-rc diff --git a/contrib/tar b/completions/tar similarity index 100% rename from contrib/tar rename to completions/tar diff --git a/contrib/tcpdump b/completions/tcpdump similarity index 100% rename from contrib/tcpdump rename to completions/tcpdump diff --git a/contrib/unace b/completions/unace similarity index 100% rename from contrib/unace rename to completions/unace diff --git a/contrib/unrar b/completions/unrar similarity index 100% rename from contrib/unrar rename to completions/unrar diff --git a/contrib/update-alternatives b/completions/update-alternatives similarity index 100% rename from contrib/update-alternatives rename to completions/update-alternatives diff --git a/contrib/util-linux b/completions/util-linux similarity index 100% rename from contrib/util-linux rename to completions/util-linux diff --git a/contrib/vncviewer b/completions/vncviewer similarity index 100% rename from contrib/vncviewer rename to completions/vncviewer diff --git a/contrib/vpnc b/completions/vpnc similarity index 100% rename from contrib/vpnc rename to completions/vpnc diff --git a/contrib/wireless-tools b/completions/wireless-tools similarity index 100% rename from contrib/wireless-tools rename to completions/wireless-tools diff --git a/contrib/wodim b/completions/wodim similarity index 100% rename from contrib/wodim rename to completions/wodim diff --git a/contrib/wol b/completions/wol similarity index 100% rename from contrib/wol rename to completions/wol diff --git a/contrib/wtf b/completions/wtf similarity index 100% rename from contrib/wtf rename to completions/wtf diff --git a/contrib/wvdial b/completions/wvdial similarity index 100% rename from contrib/wvdial rename to completions/wvdial diff --git a/contrib/xhost b/completions/xhost similarity index 100% rename from contrib/xhost rename to completions/xhost diff --git a/contrib/xm b/completions/xm similarity index 100% rename from contrib/xm rename to completions/xm diff --git a/contrib/xmllint b/completions/xmllint similarity index 100% rename from contrib/xmllint rename to completions/xmllint diff --git a/contrib/xmlwf b/completions/xmlwf similarity index 100% rename from contrib/xmlwf rename to completions/xmlwf diff --git a/contrib/xmms b/completions/xmms similarity index 100% rename from contrib/xmms rename to completions/xmms diff --git a/contrib/xrandr b/completions/xrandr similarity index 100% rename from contrib/xrandr rename to completions/xrandr diff --git a/contrib/xsltproc b/completions/xsltproc similarity index 100% rename from contrib/xsltproc rename to completions/xsltproc diff --git a/contrib/xz b/completions/xz similarity index 100% rename from contrib/xz rename to completions/xz diff --git a/contrib/yp-tools b/completions/yp-tools similarity index 100% rename from contrib/yp-tools rename to completions/yp-tools diff --git a/contrib/yum-arch b/completions/yum-arch similarity index 100% rename from contrib/yum-arch rename to completions/yum-arch diff --git a/configure.ac b/configure.ac index 1879a51e..8cb69952 100644 --- a/configure.ac +++ b/configure.ac @@ -3,5 +3,5 @@ AC_INIT([bash-completion], [1.99]) AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 -Wall -Werror]) AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d) AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers) -AC_CONFIG_FILES([Makefile contrib/Makefile helpers/Makefile test/Makefile]) +AC_CONFIG_FILES([Makefile completions/Makefile helpers/Makefile test/Makefile]) AC_OUTPUT From 796f77ef22ec484b4814af92223b6fc0e108c132 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Sun, 12 Sep 2010 16:44:39 +0200 Subject: [PATCH 33/77] rename 'contrib' directory to 'completions' --- test/lib/library.exp | 2 +- test/runLint | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/library.exp b/test/lib/library.exp index a79ec526..eaafcbc4 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -698,7 +698,7 @@ proc _save_env {{file ""}} { # Source bash_completion package proc source_bash_completion {} { - assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/contrib} + assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/completions} assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR} assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion} assert_bash_exec {source "$BASH_COMPLETION"} diff --git a/test/runLint b/test/runLint index b2bf005c..88c717a2 100755 --- a/test/runLint +++ b/test/runLint @@ -3,7 +3,7 @@ gitgrep() { local out=$(git grep -I -E -n "$1" | \ - grep -E '^(bash_completion|contrib/|test/)' | \ + grep -E '^(bash_completion|completions/|test/)' | \ grep -Fv 'test/runLint') if [ -n "$out" ] ; then printf '***** %s\n' "$2" From 0f426b077450c58d9cc187460eb1b9f727d8e9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 13 Sep 2010 21:25:21 +0300 Subject: [PATCH 34/77] Drop bad kompare filename completion (Alioth: #312708). --- CHANGES | 1 + bash_completion | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a2a317a5..65102c24 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ bash-completion (2.x) * Recognize rpm query mode based on the --file, --group, --package, and --all long options (RedHat: #630328). * Improve rpm query option completions. + * Drop bad kompare filename completion (Alioth: #312708). [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/bash_completion b/bash_completion index eabb38d6..d423753e 100644 --- a/bash_completion +++ b/bash_completion @@ -121,7 +121,6 @@ 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 complete -f -X '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff -complete -f -X '!*.@(dif?(f)|?(d)patch)' kompare complete -f -X '!*.lyx' lyx # FINISH exclude -- do not remove this line From 3b7ed984597d0b5a8e7234a3a1084370353a425c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 14 Sep 2010 21:00:31 +0300 Subject: [PATCH 35/77] Add xmodmap and xrdb completions. --- CHANGES | 2 +- completions/Makefile.am | 2 ++ completions/xmodmap | 32 +++++++++++++++++++++++++++ completions/xrdb | 37 ++++++++++++++++++++++++++++++++ test/completion/xmodmap.exp | 1 + test/completion/xrdb.exp | 1 + test/lib/completions/xmodmap.exp | 20 +++++++++++++++++ test/lib/completions/xrdb.exp | 20 +++++++++++++++++ 8 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 completions/xmodmap create mode 100644 completions/xrdb create mode 100644 test/completion/xmodmap.exp create mode 100644 test/completion/xrdb.exp create mode 100644 test/lib/completions/xmodmap.exp create mode 100644 test/lib/completions/xrdb.exp diff --git a/CHANGES b/CHANGES index 65102c24..0e254a2f 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,7 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add crontab, iftop, lrzip, and POSIX sh completions. + * Add crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/Makefile.am b/completions/Makefile.am index 86f62251..ffd3fdee 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -162,7 +162,9 @@ bashcomp_DATA = abook \ xmllint \ xmlwf \ xmms \ + xmodmap \ xrandr \ + xrdb \ xsltproc \ xz \ yp-tools \ diff --git a/completions/xmodmap b/completions/xmodmap new file mode 100644 index 00000000..f4f29150 --- /dev/null +++ b/completions/xmodmap @@ -0,0 +1,32 @@ +# xmodmap(1) completion + +have xmodmap && +_xmodmap() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -display|-e) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-display -help -grammar -verbose -quiet -n + -e -pm -pk -pke -pp' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _xmodmap -o filenames xmodmap + +# 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/completions/xrdb b/completions/xrdb new file mode 100644 index 00000000..423c0927 --- /dev/null +++ b/completions/xrdb @@ -0,0 +1,37 @@ +# xrdb(1) completion + +have xrdb && +_xrdb() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -backup|-display|-help) + return 0 + ;; + -cpp|-edit) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-help -display -all -global -screen -screens + -n -quiet -cpp -nocpp -symbols -query -load -override -merge + -remove -retain -edit -backup' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _xrdb -o filenames xrdb + +# 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/test/completion/xmodmap.exp b/test/completion/xmodmap.exp new file mode 100644 index 00000000..a80bb027 --- /dev/null +++ b/test/completion/xmodmap.exp @@ -0,0 +1 @@ +assert_source_completions xmodmap diff --git a/test/completion/xrdb.exp b/test/completion/xrdb.exp new file mode 100644 index 00000000..522ac311 --- /dev/null +++ b/test/completion/xrdb.exp @@ -0,0 +1 @@ +assert_source_completions xrdb diff --git a/test/lib/completions/xmodmap.exp b/test/lib/completions/xmodmap.exp new file mode 100644 index 00000000..2bf4da1c --- /dev/null +++ b/test/lib/completions/xmodmap.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xmodmap " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xrdb.exp b/test/lib/completions/xrdb.exp new file mode 100644 index 00000000..f02625dc --- /dev/null +++ b/test/lib/completions/xrdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xrdb " + + +sync_after_int + + +teardown From 806bc113dec88f358014cb3967927e57449bde79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 14 Sep 2010 21:03:00 +0300 Subject: [PATCH 36/77] Line wrapping tweak. --- completions/bash-builtins | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/completions/bash-builtins b/completions/bash-builtins index aac75ae0..75ee1f5e 100644 --- a/completions/bash-builtins +++ b/completions/bash-builtins @@ -85,10 +85,9 @@ _complete() ;; -A) - COMPREPLY=( $( compgen -W 'alias arrayvar binding \ - builtin command directory disabled enabled \ - export file function group helptopic hostname \ - job keyword running service setopt shopt \ + 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 ;; From 45668c23d37f6dfbf8771866c2a6f85ba3e45e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 14 Sep 2010 21:04:36 +0300 Subject: [PATCH 37/77] Add compgen completion. --- CHANGES | 3 ++- completions/bash-builtins | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 0e254a2f..46b7ceb2 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,8 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb completions. + * Add compgen, crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb + completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/bash-builtins b/completions/bash-builtins index 75ee1f5e..3eba8a11 100644 --- a/completions/bash-builtins +++ b/completions/bash-builtins @@ -110,13 +110,14 @@ _complete() if [[ "$cur" == -* ]]; then # relevant options completion - COMPREPLY=( $( compgen -W '-a -b -c -d -e -f -g -j -k -o -s -v -u -A \ - -G -W -P -S -X -F -C' -- "$cur" ) ) + local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X" + [[ $1 != compgen ]] && opts="$opts -F -C" + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) else COMPREPLY=( $( compgen -A command -- "$cur" ) ) fi } -complete -F _complete complete +complete -F _complete compgen complete # Local variables: # mode: shell-script From d2a551fad4e75452b3ba2fcd6f4cce3117af3fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 18 Sep 2010 20:51:51 +0300 Subject: [PATCH 38/77] Combine identical xdvi and kdvi completions. --- bash_completion | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index d423753e..22c33143 100644 --- a/bash_completion +++ b/bash_completion @@ -82,8 +82,7 @@ complete -f -X '!*.lrz' lrunzip 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 -complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi -complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' kdvi +complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi 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 From 8e23895fe5683417717c2461443a378e418ce1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 11:33:52 +0300 Subject: [PATCH 39/77] Avoid stderr output from compopt when invoking _filedir directly. The _filedir unit test currently does this, causing (harmless) error output. --- bash_completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 22c33143..e6edf87b 100644 --- a/bash_completion +++ b/bash_completion @@ -640,7 +640,7 @@ _filedir() toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) if [ ${#toks[@]} -ne 0 ]; then # If `compopt' is available, set `-o filenames' - type compopt &>/dev/null && compopt -o filenames || + type compopt &>/dev/null && compopt -o filenames 2>/dev/null || # No, `compopt' isn't available; # Is `-o filenames' set? [[ ( From d0bcb5347e5269437205a8a7310363db6a1d94b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 11:46:20 +0300 Subject: [PATCH 40/77] Don't complete jar and povray on filenames ending with a dot. --- CHANGES | 2 +- completions/jar | 2 +- completions/povray | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 46b7ceb2..e1225767 100644 --- a/CHANGES +++ b/CHANGES @@ -13,7 +13,7 @@ bash-completion (2.x) * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. - * Improve /etc/init.d/* and sqlite3 completions. + * Improve /etc/init.d/*, jar, povray, and sqlite3 completions. * Fix p4 completion (Alioth: #312625). * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Recognize rpm query mode based on the --file, --group, --package, and diff --git a/completions/jar b/completions/jar index 75dcaf3e..2969ce0f 100644 --- a/completions/jar +++ b/completions/jar @@ -18,7 +18,7 @@ _jar() _filedir ;; *f) - _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)' + _filedir '@([ejw]ar|zip|[EJW]AR|ZIP)' ;; *) _filedir diff --git a/completions/povray b/completions/povray index cd03b940..91602c7c 100644 --- a/completions/povray +++ b/completions/povray @@ -49,7 +49,7 @@ _povray() ;; *) cur="$povcur" - _filedir '?(ini|pov)' + _filedir '@(ini|pov)' return 0 ;; esac From c183a585b279dc29fcd8c5f18b9bab135cbdd358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 12:06:53 +0300 Subject: [PATCH 41/77] Match uppercased versions of _filedir and _filedir_xspec arguments too. This provides a bit of case insensivity to file extension matching, allowing for example _filedir foo to match both *.foo and *.FOO. Note that this is not real case insensivity; mixed case extensions like *.FOO.gz are not matched by _filedir foo.gz so those need to be handled like before this change. --- CHANGES | 2 ++ bash_completion | 21 ++++++++++++++++++--- test/fixtures/_filedir/ext/ii.E1 | 0 test/unit/_filedir.exp | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/_filedir/ext/ii.E1 diff --git a/CHANGES b/CHANGES index e1225767..ffe2d80e 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,8 @@ bash-completion (2.x) --all long options (RedHat: #630328). * Improve rpm query option completions. * Drop bad kompare filename completion (Alioth: #312708). + * Make _filedir and _filedir_xspec complete uppercase versions of their + filename extension arguments in addition to exact case matches. [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/bash_completion b/bash_completion index e6edf87b..2e56704a 100644 --- a/bash_completion +++ b/bash_completion @@ -610,7 +610,8 @@ _quote_readline_by_ref() # This function performs file and directory completion. It's better than # simply using 'compgen -f', because it honours spaces in filenames. # @param $1 If `-d', complete only on directories. Otherwise filter/pick only -# completions with `.$1' as file extension. +# completions with `.$1' and the uppercase version of it as file +# extension. # _filedir() { @@ -636,7 +637,10 @@ _filedir() )) if [[ "$1" != -d ]]; then - xspec=${1:+"!*.$1"} + # Munge xspec to contain uppercase version too + [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \ + xspec=${1:+"!*.@($1|${1^^})"} || \ + xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"} toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) if [ ${#toks[@]} -ne 0 ]; then # If `compopt' is available, set `-o filenames' @@ -1586,8 +1590,19 @@ _filedir_xspec() } )) + # Munge xspec to contain uppercase version too + eval xspec="${xspec}" + local matchop=! + if [[ $xspec == !* ]]; then + xspec=${xspec#!} + matchop=@ + fi + [[ ${BASH_VERSINFO[0]} -ge 4 ]] && \ + xspec="$matchop($xspec|${xspec^^})" || \ + xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))" + toks=( ${toks[@]-} $( - eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | { + eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [ -n $tmp ] && printf '%s\n' $tmp done diff --git a/test/fixtures/_filedir/ext/ii.E1 b/test/fixtures/_filedir/ext/ii.E1 new file mode 100644 index 00000000..e69de29b diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp index 204d31cf..59d50854 100644 --- a/test/unit/_filedir.exp +++ b/test/unit/_filedir.exp @@ -242,7 +242,7 @@ foreach name {f f2} { set test "completing with filter '.e1' should show completions" -assert_complete_dir {ee.e1 foo/ gg.e1} "g " "fixtures/_filedir/ext" $test +assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "fixtures/_filedir/ext" $test sync_after_int From 7ea7d7b2686a1c37d4b43c81b42e07054ae34acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 12:29:29 +0300 Subject: [PATCH 42/77] Simplify filename completions per new _filedir(_xspec) uppercasing behavior. --- bash_completion | 34 +++++++++++++++++----------------- completions/jar | 2 +- completions/mplayer | 10 +++++----- completions/unace | 2 +- completions/unrar | 2 +- completions/xmms | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bash_completion b/bash_completion index 2e56704a..f7e1a281 100644 --- a/bash_completion +++ b/bash_completion @@ -70,7 +70,7 @@ complete -d pushd # START exclude -- do NOT remove this line # bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510 complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat -complete -f -X '!*.@(zip|ZIP|[ejw]ar|[EJW]AR|exe|EXE|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub)' unzip zipinfo +complete -f -X '!*.@(zip|[ejw]ar|exe|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub)' unzip zipinfo complete -f -X '*.Z' compress znew # zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510 complete -f -X '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz @@ -79,32 +79,32 @@ complete -f -X '!*.Z' uncompress complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat complete -f -X '!*.lrz' lrunzip -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 '!*.@(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)' xv qiv complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi 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|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|fdf|FDF)' evince +complete -f -X '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx +complete -f -X '!*.pdf' acroread gpdf xpdf +complete -f -X '!*.@(?(e)ps|pdf)' kpdf +complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|fdf)' evince complete -f -X '!*.@(okular|@(?(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|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular -complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr +complete -f -X '!*.@(?(e)ps|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|ltx|LTX)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi -complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay +complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi +complete -f -X '!*.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|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|wav|WAV|flac|FLAC|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))?(.part)' xine aaxine fbxine kaffeine dragon 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 -complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123 -complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp +complete -f -X '!*.@(ogg|m3u|flac|spx)' ogg123 +complete -f -X '!*.@(mp3|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|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 modplug123 -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 emacs xemacs sxemacs kate kwrite +complete -f -X '!*.@(mid?(i)|cmf)' playmidi +complete -f -X '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity +complete -f -X '!*.@(m[eo]d|s[3t]m|xm|it)' modplugplay modplug123 +complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine -complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme +complete -f -X '!*.@(zip|z|gz|tgz)' bzme # konqueror not here on purpose, it's more than a web/html browser complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany complete -f -X '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|odt|ott|odm)' oowriter diff --git a/completions/jar b/completions/jar index 2969ce0f..6abfff3d 100644 --- a/completions/jar +++ b/completions/jar @@ -18,7 +18,7 @@ _jar() _filedir ;; *f) - _filedir '@([ejw]ar|zip|[EJW]AR|ZIP)' + _filedir '@([ejw]ar|zip)' ;; *) _filedir diff --git a/completions/mplayer b/completions/mplayer index ad458eba..7e4c5572 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -23,7 +23,7 @@ _mplayer() return 0 ;; -audiofile) - _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)' + _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)' return 0 ;; -font) @@ -31,11 +31,11 @@ _mplayer() return 0 ;; -sub) - _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|ass|ASS)' + _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' return 0 ;; -vobsub) - _filedir '@(idx|IDX|ifo|IFO|sub|SUB)' + _filedir '@(idx|ifo|sub)' IFS=$'\t\n' COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do if [[ -f $i && -r $i ]]; then @@ -48,11 +48,11 @@ _mplayer() return 0 ;; -ifo) - _filedir '@(ifo|IFO)' + _filedir ifo return 0 ;; -cuefile) - _filedir '@(bin|BIN|cue|CUE)' + _filedir '@(bin|cue)' return 0 ;; -skin) diff --git a/completions/unace b/completions/unace index 5ceb7646..73d635d5 100644 --- a/completions/unace +++ b/completions/unace @@ -14,7 +14,7 @@ _unace() if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) ) else - _filedir '@(ace|ACE)' + _filedir ace fi fi } && diff --git a/completions/unrar b/completions/unrar index 3fb24dbb..0f5f7094 100644 --- a/completions/unrar +++ b/completions/unrar @@ -16,7 +16,7 @@ _unrar() if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) ) else - _filedir '@(rar|RAR)' + _filedir rar fi fi diff --git a/completions/xmms b/completions/xmms index 42c5402c..91b9ff5c 100644 --- a/completions/xmms +++ b/completions/xmms @@ -14,7 +14,7 @@ _xmms() --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)' + _filedir '@(mp[23]|ogg|wav|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)' fi From 5bcf5bae41b30d54662ae3fa7005f95c4048259c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 12:39:53 +0300 Subject: [PATCH 43/77] Fix povray completion, broken in f8bafe285e7d20fdd82f77289059dd18f78312c2. --- CHANGES | 2 +- completions/povray | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index ffe2d80e..5418c02a 100644 --- a/CHANGES +++ b/CHANGES @@ -14,7 +14,7 @@ bash-completion (2.x) filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. * Improve /etc/init.d/*, jar, povray, and sqlite3 completions. - * Fix p4 completion (Alioth: #312625). + * Fix p4 and povray completions (Alioth: #312625). * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Recognize rpm query mode based on the --file, --group, --package, and --all long options (RedHat: #630328). diff --git a/completions/povray b/completions/povray index 91602c7c..7abc497a 100644 --- a/completions/povray +++ b/completions/povray @@ -7,7 +7,7 @@ _povray() defoext=png # default output extension, if cannot be determined FIXME COMPREPLY=() - _get_comp_words_by_ref povcur prev + _get_comp_words_by_ref -c povcur prev _expand || return 0 From b822b7cceb6540a97a96953eb4722a7c892a3004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 13:15:07 +0300 Subject: [PATCH 44/77] Indentation fix. --- completions/tar | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/completions/tar b/completions/tar index 400daa62..81ecbce0 100644 --- a/completions/tar +++ b/completions/tar @@ -14,31 +14,30 @@ _tar() fi case ${COMP_WORDS[1]} in - ?(-)[cr]*f) - _filedir - return 0 - ;; - +([^IZzJjy])f) - ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)|xz))|gz|bz?(2)|lz?(ma)|xz)' - 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 - ;; - + ?(-)[cr]*f) + _filedir + return 0 + ;; + +([^IZzJjy])f) + ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)|xz))|gz|bz?(2)|lz?(ma)|xz)' + 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 From 0ed0de30473e1ed2bd047ca864b56d99b44fa8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 14:33:09 +0300 Subject: [PATCH 45/77] Add badblocks, dumpe2fs, e2freefrag, e2label, filefrag, and tune2fs completions. --- CHANGES | 4 +- completions/Makefile.am | 1 + completions/e2fsprogs | 179 ++++++++++++++++++++++++++++ test/completion/badblocks.exp | 1 + test/completion/dumpe2fs.exp | 1 + test/completion/e2freefrag.exp | 1 + test/completion/e2label.exp | 1 + test/completion/filefrag.exp | 1 + test/completion/tune2fs.exp | 1 + test/lib/completions/badblocks.exp | 20 ++++ test/lib/completions/dumpe2fs.exp | 20 ++++ test/lib/completions/e2freefrag.exp | 20 ++++ test/lib/completions/e2label.exp | 20 ++++ test/lib/completions/filefrag.exp | 20 ++++ test/lib/completions/tune2fs.exp | 20 ++++ 15 files changed, 308 insertions(+), 2 deletions(-) create mode 100644 completions/e2fsprogs create mode 100644 test/completion/badblocks.exp create mode 100644 test/completion/dumpe2fs.exp create mode 100644 test/completion/e2freefrag.exp create mode 100644 test/completion/e2label.exp create mode 100644 test/completion/filefrag.exp create mode 100644 test/completion/tune2fs.exp create mode 100644 test/lib/completions/badblocks.exp create mode 100644 test/lib/completions/dumpe2fs.exp create mode 100644 test/lib/completions/e2freefrag.exp create mode 100644 test/lib/completions/e2label.exp create mode 100644 test/lib/completions/filefrag.exp create mode 100644 test/lib/completions/tune2fs.exp diff --git a/CHANGES b/CHANGES index 5418c02a..f272503e 100644 --- a/CHANGES +++ b/CHANGES @@ -8,8 +8,8 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add compgen, crontab, iftop, lrzip, POSIX sh, xmodmap, and xrdb - completions. + * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, filefrag, + iftop, lrzip, POSIX sh, tune2fs, xmodmap, and xrdb completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/Makefile.am b/completions/Makefile.am index ffd3fdee..f335b5d0 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -35,6 +35,7 @@ bashcomp_DATA = abook \ dpkg \ dselect \ dsniff \ + e2fsprogs \ findutils \ freeciv \ freerdp \ diff --git a/completions/e2fsprogs b/completions/e2fsprogs new file mode 100644 index 00000000..1a240f1b --- /dev/null +++ b/completions/e2fsprogs @@ -0,0 +1,179 @@ +# bash completion for e2fsprogs + +have badblocks && +_badblocks() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -b|-c|-e|-d|-p|-t) + return 0 + ;; + -i|-o) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # -w (dangerous) and -X (internal use) not here on purpose + COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \ + -- "$cur" ) ) + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _badblocks -o filenames badblocks + + +have dumpe2fs && +_dumpe2fs() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -o|-V) + return 0 + ;; + -i) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) ) + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _dumpe2fs -o filenames dumpe2fs + + +have e2freefrag && +_e2freefrag() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -c|-h) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) ) + return 0 + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _e2freefrag -o filenames e2freefrag + + +have e2label && +_e2label() +{ + COMPREPLY=() + local cur cword + _get_comp_words_by_ref cur cword + + if [ $cword -eq 1 ]; then + cur=${cur:=/dev/} + _filedir + fi +} && +complete -F _e2label -o filenames e2label + + +have filefrag && +_filefrag() +{ + COMPREPLY=() + local cur + _get_comp_words_by_ref cur + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) ) + return 0 + fi + + _filedir +} && +complete -F _filefrag -o filenames filefrag + + +have tune2fs && +_tune2fs() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref cur prev + + case $prev in + -c|-C|-E|-i|-J|-L|-m|-r|-T) + return 0 + ;; + -e) + COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) ) + return 0 + ;; + -g) + _gids + COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) ) + return 0 + ;; + -M) + _filedir -d + ;; + -o) + local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 + ^journal_data ^journal_data_ordered ^journal_data_writeback) + COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + return 0 + ;; + -O) + local -a opts=(^dir_index ^filetype ^flex_bg ^has_journal + ^large_file ^resize_inode ^sparse_super ^uninit_bg) + COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) ) + return 0 + ;; + -u) + _uids + COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) ) + return 0 + ;; + -U) + COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o + -O -r -T -u -U' -- "$cur" ) ) + fi + + cur=${cur:=/dev/} + _filedir +} && +complete -F _tune2fs -o filenames tune2fs + +# 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/test/completion/badblocks.exp b/test/completion/badblocks.exp new file mode 100644 index 00000000..74bfcd5d --- /dev/null +++ b/test/completion/badblocks.exp @@ -0,0 +1 @@ +assert_source_completions badblocks diff --git a/test/completion/dumpe2fs.exp b/test/completion/dumpe2fs.exp new file mode 100644 index 00000000..22d1523c --- /dev/null +++ b/test/completion/dumpe2fs.exp @@ -0,0 +1 @@ +assert_source_completions dumpe2fs diff --git a/test/completion/e2freefrag.exp b/test/completion/e2freefrag.exp new file mode 100644 index 00000000..713ee236 --- /dev/null +++ b/test/completion/e2freefrag.exp @@ -0,0 +1 @@ +assert_source_completions e2freefrag diff --git a/test/completion/e2label.exp b/test/completion/e2label.exp new file mode 100644 index 00000000..2383c98e --- /dev/null +++ b/test/completion/e2label.exp @@ -0,0 +1 @@ +assert_source_completions e2label diff --git a/test/completion/filefrag.exp b/test/completion/filefrag.exp new file mode 100644 index 00000000..eeb5f8ce --- /dev/null +++ b/test/completion/filefrag.exp @@ -0,0 +1 @@ +assert_source_completions filefrag diff --git a/test/completion/tune2fs.exp b/test/completion/tune2fs.exp new file mode 100644 index 00000000..db034967 --- /dev/null +++ b/test/completion/tune2fs.exp @@ -0,0 +1 @@ +assert_source_completions tune2fs diff --git a/test/lib/completions/badblocks.exp b/test/lib/completions/badblocks.exp new file mode 100644 index 00000000..d453b5bd --- /dev/null +++ b/test/lib/completions/badblocks.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "badblocks " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dumpe2fs.exp b/test/lib/completions/dumpe2fs.exp new file mode 100644 index 00000000..e935c504 --- /dev/null +++ b/test/lib/completions/dumpe2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "dumpe2fs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2freefrag.exp b/test/lib/completions/e2freefrag.exp new file mode 100644 index 00000000..1530c9c9 --- /dev/null +++ b/test/lib/completions/e2freefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2freefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2label.exp b/test/lib/completions/e2label.exp new file mode 100644 index 00000000..8ae7f443 --- /dev/null +++ b/test/lib/completions/e2label.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2label " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/filefrag.exp b/test/lib/completions/filefrag.exp new file mode 100644 index 00000000..fa80cd05 --- /dev/null +++ b/test/lib/completions/filefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "filefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tune2fs.exp b/test/lib/completions/tune2fs.exp new file mode 100644 index 00000000..df70d904 --- /dev/null +++ b/test/lib/completions/tune2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tune2fs " + + +sync_after_int + + +teardown From 0fe71268180e093ffccc3ec785a57730092b2274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 19 Sep 2010 19:12:51 +0300 Subject: [PATCH 46/77] (testsuite) Fix cd test when CDPATH is set. --- test/lib/completions/cd.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp index 2101f035..6616cd82 100644 --- a/test/lib/completions/cd.exp +++ b/test/lib/completions/cd.exp @@ -37,11 +37,12 @@ sync_after_int set test "Tab should complete CDPATH" # Set CDPATH +assert_bash_exec "declare -p CDPATH &>/dev/null && OLDCDPATH=\$CDPATH || :" assert_bash_exec "CDPATH=\$PWD"; assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test sync_after_int # Reset CDPATH -assert_bash_exec "unset CDPATH" +assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH" teardown From ba419108b7fdb94f2b28a405a1dd074d862b7114 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Mon, 20 Sep 2010 22:54:22 +0200 Subject: [PATCH 47/77] (testsuite) Comment multipass_name --- test/lib/library.exp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/lib/library.exp b/test/lib/library.exp index eaafcbc4..ffabefcf 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -33,6 +33,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { ] ] if {$out == -1 && [string length $results] > 0} { + # Is DejaGnu fully initialized, i.e. is "fail" method available? if {[info exists multipass_name]} { fail "ERROR Unexpected output from bash command \"$title\"" } @@ -44,6 +45,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { expect { -ex "$cmd\r\n0\r\n$prompt" {} $prompt { + # Is DejaGnu fully initialized, i.e. is "fail" method available? if {[info exists multipass_name]} { fail "ERROR executing bash command \"$title\"" } From 7a85f76d0151fd64472cd02723ff47da3a4d241f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 23 Sep 2010 22:43:13 +0300 Subject: [PATCH 48/77] (testsuite) Add basic ipmitool tests. --- test/completion/ipmitool.exp | 1 + test/lib/completions/ipmitool.exp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/completion/ipmitool.exp create mode 100644 test/lib/completions/ipmitool.exp diff --git a/test/completion/ipmitool.exp b/test/completion/ipmitool.exp new file mode 100644 index 00000000..a5c72a78 --- /dev/null +++ b/test/completion/ipmitool.exp @@ -0,0 +1 @@ +assert_source_completions ipmitool diff --git a/test/lib/completions/ipmitool.exp b/test/lib/completions/ipmitool.exp new file mode 100644 index 00000000..aa18e3ff --- /dev/null +++ b/test/lib/completions/ipmitool.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ipmitool " + + +sync_after_int + + +teardown From 622abf3a6eb6516fc58ebeaf8de5889cd007802f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 23 Sep 2010 22:45:49 +0300 Subject: [PATCH 49/77] Add quite a bit of more stuff to ipmitool completion. --- CHANGES | 2 +- completions/ipmitool | 196 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 187 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index f272503e..48d0f6af 100644 --- a/CHANGES +++ b/CHANGES @@ -13,7 +13,7 @@ bash-completion (2.x) * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. - * Improve /etc/init.d/*, jar, povray, and sqlite3 completions. + * Improve /etc/init.d/*, ipmitool, jar, povray, and sqlite3 completions. * Fix p4 and povray completions (Alioth: #312625). * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Recognize rpm query mode based on the --file, --group, --package, and diff --git a/completions/ipmitool b/completions/ipmitool index fc4ec71c..7af8da88 100644 --- a/completions/ipmitool +++ b/completions/ipmitool @@ -1,6 +1,13 @@ # bash completion for ipmitool -have ipmitool && +have ipmitool && { + +_ipmitool_singleline_help() +{ + COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \ + sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) ) +} + _ipmitool() { local cur prev @@ -9,25 +16,194 @@ _ipmitool() _get_comp_words_by_ref cur prev case $prev in + -h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l) + return 0 + ;; + -d) + COMPREPLY=( $( compgen -W "$( \ + command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \ + 2>/dev/null | sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \ + -- "$cur" ) ) + return 0 + ;; -I) - COMPREPLY=( $( compgen -W 'open imb lan lanplus free' -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \ + sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \ + -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \ + -- "$cur" ) ) + return 0 + ;; + -H) + _known_hosts_real "$cur" + return 0 + ;; + -f|-S|-O) + _filedir + return 0 + ;; + -C) + COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' \ + -- "$cur" ) ) + return 0 + ;; + -L) + COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \ + -- "$cur" ) ) + return 0 + ;; + -A) + COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) ) + return 0 + ;; + -o) + COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \ + awk '/^[ \t]+/ { print $1 }' ) list" -- "$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" ) ) + -e -C -k -y -L -A -P -E -K -m -b -t -B -T -l -o -O' -- "$cur" ) ) + return 0 fi + # Find out command and subcommand + + local cmds=( 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 shell exec set hpm ekanalyzer) + local i c cmd subcmd + for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do + [[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break + for c in ${cmds[@]}; do + [ ${COMP_WORDS[i]} = $c ] && cmd=$c && break + done + done + + if [ -z "$cmd" ]; then + COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) + return 0 + fi + + # Command/subcommand completions + + case $cmd in + + shell) + ;; + + exec) + _filedir + ;; + + chassis|power|kontronoem|fwum) + _ipmitool_singleline_help $1 $cmd + ;; + + lan) + case $subcmd in + print|set) + ;; + alert) + [ "$prev" = alert ] && \ + COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + ;; + stats) + [ "$prev" = stats ] && \ + COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'print set alert stats' \ + -- "$cur" ) ) + ;; + esac + ;; + + sdr) + case $subcmd in + get|info|type|list|entity) + ;; + elist) + COMPREPLY=( $( compgen -W 'all full compact event mclog fru + generic' -- "$cur" ) ) + ;; + dump) + _filedir + ;; + fill) + case $prev in + fill) + COMPREPLY=( $( compgen -W 'sensors file' \ + -- "$cur" ) ) + ;; + file) + _filedir + ;; + esac + ;; + *) + COMPREPLY=( $( compgen -W 'get info type list elist entity + dump fill' -- "$cur" ) ) + ;; + esac + ;; + + sensor) + case $subcmd in + list|get|thresh) + ;; + *) + COMPREPLY=( $( compgen -W 'list get thresh' -- "$cur" ) ) + ;; + esac + ;; + + sel) + case $subcmd in + info|clear|list|elist|delete) + ;; + add|save|writeraw|readraw) + _filedir + ;; + time) + [ "$prev" = time ] && \ + COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'info clear list elist delete add + get save writeraw readraw time' -- "$cur" ) ) + ;; + esac + ;; + + user) + case $subcmd in + summary|list|disable|enable|priv|test) + ;; + set) + [ "$prev" = set ] && \ + COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W 'summary list set disable enable + priv test' -- "$cur" ) ) + ;; + esac + ;; + + set) + [ "$prev" = set ] && \ + COMPREPLY=( $( compgen -W 'hostname username password privlvl + authtype localaddr targetaddr port csv verbose' \ + -- "$cur" ) ) + ;; + + esac +} + } && -complete -F _ipmitool ipmitool +complete -F _ipmitool -o filenames ipmitool # Local variables: # mode: shell-script From 372008342efa2ce6918cbc754c34c5f97d1de842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 17:55:51 +0300 Subject: [PATCH 50/77] (testsuite) Run sftp tests with fixtures/sftp data, comment fixes. --- test/lib/completions/sftp.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 7a197c7c..186a055d 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -20,7 +20,7 @@ set expected [get_hosts] # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts lappend expected doo gee hus ike -set dir fixtures/scp +set dir fixtures/sftp assert_complete_dir $expected "sftp -F config " $dir @@ -45,8 +45,8 @@ sync_after_int # Build string list of expected completions # Get hostnames and give them a colon (:) suffix set expected [get_hosts] - # Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf" - # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts + # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf" + # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts lappend expected doo gee hus ike jar set dir fixtures/sftp assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir From 7f5c64e58014bca82efdb34c0015b091a8c5d84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 17:59:31 +0300 Subject: [PATCH 51/77] (testsuite) Add some [host]:port cases to known hosts related tests. --- test/fixtures/_known_hosts_real/known_hosts | 2 ++ test/fixtures/scp/known_hosts | 1 + test/fixtures/sftp/known_hosts | 1 + test/lib/completions/scp.exp | 8 ++++---- test/lib/completions/sftp.exp | 8 ++++---- test/unit/_known_hosts_real.exp | 12 ++++++------ 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts index bf39e848..07e20ecf 100644 --- a/test/fixtures/_known_hosts_real/known_hosts +++ b/test/fixtures/_known_hosts_real/known_hosts @@ -4,3 +4,5 @@ doo ike ssh-rsa qwerty1234/Qwerty+1234== jub,10.0.0.1 kyl,100.0.0.2 +[10.10.0.3]:10022 +[blah]:1234 diff --git a/test/fixtures/scp/known_hosts b/test/fixtures/scp/known_hosts index d54a04d0..2dfa4b6f 100644 --- a/test/fixtures/scp/known_hosts +++ b/test/fixtures/scp/known_hosts @@ -2,3 +2,4 @@ |1|def doo ike ssh-rsa qwerty1234/Qwerty+1234== +[blah]:1234 diff --git a/test/fixtures/sftp/known_hosts b/test/fixtures/sftp/known_hosts index d54a04d0..6538eb4b 100644 --- a/test/fixtures/sftp/known_hosts +++ b/test/fixtures/sftp/known_hosts @@ -2,3 +2,4 @@ |1|def doo ike ssh-rsa qwerty1234/Qwerty+1234== +[10.10.10.10]:2222 diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index e1f7336e..4ab514d9 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -52,12 +52,12 @@ set test "Tab should complete known-hosts" # Build string list of expected completions # Get hostnames and give them a colon (:) suffix # Hosts `gee' and `hus' are defined in ./fixtures/scp/config - # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts + # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts set expected {} foreach host [get_hosts] { lappend expected "$host:" } -lappend expected doo: gee: hus: ike: +lappend expected blah: doo: gee: hus: ike: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" set dir fixtures/scp @@ -90,8 +90,8 @@ foreach host [get_hosts] { lappend expected "$host:" } # Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf" - # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts -lappend expected doo: gee: hus: ike: jar: + # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts +lappend expected blah: doo: gee: hus: ike: jar: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" set dir fixtures/scp diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 186a055d..30837ec6 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -18,8 +18,8 @@ setup # Build string list of expected completions set expected [get_hosts] # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config - # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected doo gee hus ike + # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts +lappend expected 10.10.10.10 doo gee hus ike set dir fixtures/sftp assert_complete_dir $expected "sftp -F config " $dir @@ -46,8 +46,8 @@ sync_after_int # Get hostnames and give them a colon (:) suffix set expected [get_hosts] # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf" - # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected doo gee hus ike jar + # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts +lappend expected 10.10.10.10 doo gee hus ike jar set dir fixtures/sftp assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp index 31842792..0b1a82f9 100644 --- a/test/unit/_known_hosts_real.exp +++ b/test/unit/_known_hosts_real.exp @@ -17,8 +17,8 @@ setup set test "Hosts should be put in COMPREPLY" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test @@ -29,8 +29,8 @@ sync_after_int set test "Hosts should have username prefix and colon suffix" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 set hosts [lsort -ascii $hosts] set expected {} foreach host $hosts { @@ -103,8 +103,8 @@ set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE" assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE=" set hosts [get_hosts_avahi] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl and 100.0.0.2 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 # Call _known_hosts set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test From 9341a1131cc9ed9e29d1e118819adb3d8dcf54a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 18:22:45 +0300 Subject: [PATCH 52/77] Fix known hosts completion for IPv6 addresses whose last 16 bits are digits (Alioth: #312695, RedHat: #630658). --- CHANGES | 2 ++ bash_completion | 3 +-- test/fixtures/_known_hosts_real/known_hosts | 2 ++ test/unit/_known_hosts_real.exp | 12 ++++++------ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 48d0f6af..6ccae2c2 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,8 @@ bash-completion (2.x) * Drop bad kompare filename completion (Alioth: #312708). * Make _filedir and _filedir_xspec complete uppercase versions of their filename extension arguments in addition to exact case matches. + * Fix known hosts completion for IPv6 addresses whose last 16 bits are digits + (Alioth: #312695, RedHat: #630658). [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/bash_completion b/bash_completion index f7e1a281..98f35ca1 100644 --- a/bash_completion +++ b/bash_completion @@ -1298,8 +1298,7 @@ _known_hosts_real() COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","} /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ gsub(" .*$", "", $i); \ - gsub("[\\[\\]]", "", $i); \ - gsub(":[0-9]+$", "", $i); \ + sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ if ($i ~ /'"$awkcur"'/) {print $i} \ }}' "${kh[@]}" 2>/dev/null ) ) fi diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts index 07e20ecf..65019090 100644 --- a/test/fixtures/_known_hosts_real/known_hosts +++ b/test/fixtures/_known_hosts_real/known_hosts @@ -6,3 +6,5 @@ jub,10.0.0.1 kyl,100.0.0.2 [10.10.0.3]:10022 [blah]:1234 +fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 +fe80::123:0xff:dead:beef%eth0 diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp index 0b1a82f9..8869de11 100644 --- a/test/unit/_known_hosts_real.exp +++ b/test/unit/_known_hosts_real.exp @@ -17,8 +17,8 @@ setup set test "Hosts should be put in COMPREPLY" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test @@ -29,8 +29,8 @@ sync_after_int set test "Hosts should have username prefix and colon suffix" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 set hosts [lsort -ascii $hosts] set expected {} foreach host $hosts { @@ -103,8 +103,8 @@ set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE" assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE=" set hosts [get_hosts_avahi] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 # Call _known_hosts set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test From 66e35aa4a13aa4c4f63f1d9c8da7a4421359ec1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 18:29:26 +0300 Subject: [PATCH 53/77] Use awk sub instead of gsub where appropriate. --- bash_completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 98f35ca1..9e16b9b7 100644 --- a/bash_completion +++ b/bash_completion @@ -1297,7 +1297,7 @@ _known_hosts_real() # FS needs to look for a comma separated list COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","} /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ - gsub(" .*$", "", $i); \ + sub(" .*$", "", $i); \ sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ if ($i ~ /'"$awkcur"'/) {print $i} \ }}' "${kh[@]}" 2>/dev/null ) ) From 729f6c4ea31709fb5b0e582bc74c2e10b38c50f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 18:50:38 +0300 Subject: [PATCH 54/77] Add mplayer -audio-demuxer and -sub-demuxer completions. --- CHANGES | 1 + completions/mplayer | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 6ccae2c2..962deda5 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ bash-completion (2.x) filename extension arguments in addition to exact case matches. * Fix known hosts completion for IPv6 addresses whose last 16 bits are digits (Alioth: #312695, RedHat: #630658). + * Improve mplayer and mencoder completions. [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/completions/mplayer b/completions/mplayer index 7e4c5572..c71c677b 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -18,7 +18,8 @@ _mplayer() _get_comp_words_by_ref cur prev case $prev in - -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile) + -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \ + -audio-demuxer|-sub-demuxer) _mplayer_options_list $cmd $prev return 0 ;; @@ -97,7 +98,7 @@ _mplayer() return 0 ;; -autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \ - -audo-demuxer|-sub-demuxer|-demuxer|-bandwidth|-cache|-chapter| \ + -demuxer|-bandwidth|-cache|-chapter| \ -dvd|-dvdangle|-fps|-frames|-mc|-passwd|-user|-sb|-srate|-ss|-vcd| \ -vi|-vid|-vivo|-ffactor|-sid|-slang|-spualign|-spuaa|-spugauss| \ -vobsubid|-delay|-bpp|-brightness|-contrast|-dfbopts|-display| \ From 3fbee9ae9e936d092ee6498ee50d51da0e8cdd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 18:52:23 +0300 Subject: [PATCH 55/77] Drop duplicate -demuxer from mplayer option 'case' statement. --- completions/mplayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/mplayer b/completions/mplayer index c71c677b..00c86f1e 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -98,7 +98,7 @@ _mplayer() return 0 ;; -autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \ - -demuxer|-bandwidth|-cache|-chapter| \ + -bandwidth|-cache|-chapter| \ -dvd|-dvdangle|-fps|-frames|-mc|-passwd|-user|-sb|-srate|-ss|-vcd| \ -vi|-vid|-vivo|-ffactor|-sid|-slang|-spualign|-spuaa|-spugauss| \ -vobsubid|-delay|-bpp|-brightness|-contrast|-dfbopts|-display| \ From 5134d0ac1d8f9a848ad57893060a24e19280f6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 18:53:33 +0300 Subject: [PATCH 56/77] Add mplayer -show-profile completion. --- completions/mplayer | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/completions/mplayer b/completions/mplayer index 00c86f1e..e7ee093e 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -23,6 +23,10 @@ _mplayer() _mplayer_options_list $cmd $prev return 0 ;; + -show-profile) + _mplayer_options_list $cmd -profile + return 0 + ;; -audiofile) _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)' return 0 From 06083c35639ea06f1463a219d935647338d6a283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 19:04:38 +0300 Subject: [PATCH 57/77] Add Fontconfig patterns to mplayer -font completions. --- completions/mplayer | 3 +++ 1 file changed, 3 insertions(+) diff --git a/completions/mplayer b/completions/mplayer index e7ee093e..23c45dd7 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -33,6 +33,9 @@ _mplayer() ;; -font) _filedir '@(desc|ttf)' + IFS=$'\n' + COMPREPLY=( "${COMPREPLY[@]}" + $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) return 0 ;; -sub) From 5a254604e7880ba2a38cb49be40b81de3c30a9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 19:07:01 +0300 Subject: [PATCH 58/77] Add mplayer -subfont completion. --- completions/mplayer | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/completions/mplayer b/completions/mplayer index 23c45dd7..051f77b8 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -31,8 +31,12 @@ _mplayer() _filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)' return 0 ;; - -font) - _filedir '@(desc|ttf)' + -font|-subfont) + if [ "$prev" = -font ]; then + _filedir '@(desc|ttf)' + else + _filedir ttf + fi IFS=$'\n' COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) From 1a2de64f80aa1899553de5f6176f3d2fdb63f2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 19:11:54 +0300 Subject: [PATCH 59/77] Localize IFS tighter in _mplayer(). --- completions/mplayer | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/completions/mplayer b/completions/mplayer index 051f77b8..f82d1c4d 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -11,7 +11,7 @@ _mplayer_options_list() _mplayer() { - local cmd cur prev skinsdir IFS=$' \t\n' i j k=0 + local cmd cur prev skinsdir i j k=0 COMPREPLY=() cmd=${COMP_WORDS[0]} @@ -37,7 +37,7 @@ _mplayer() else _filedir ttf fi - IFS=$'\n' + local IFS=$'\n' COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) return 0 @@ -48,7 +48,7 @@ _mplayer() ;; -vobsub) _filedir '@(idx|ifo|sub)' - IFS=$'\t\n' + local IFS=$'\t\n' COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do if [[ -f $i && -r $i ]]; then printf '%s\n' ${i%.*} @@ -56,7 +56,6 @@ _mplayer() printf '%s\n' $i fi done ) ) - IFS=$' \t\n' return 0 ;; -ifo) @@ -76,7 +75,7 @@ _mplayer() skinsdir=/usr/share/mplayer/Skin fi - IFS=$'\t\n' + local IFS=$'\t\n' for i in ~/.mplayer/Skin $skinsdir; do if [[ -d $i && -r $i ]]; then for j in $( compgen -d $i/$cur ); do @@ -85,7 +84,6 @@ _mplayer() done fi done - IFS=$' \t\n' return 0 ;; -cdrom-device) From 35ac650e306fab403dad34171e953f08874a4fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 28 Sep 2010 19:14:08 +0300 Subject: [PATCH 60/77] Make mplayer -skin completion work with post-2006 versions. The subdir was "Skin" until 1.0pre8 (Jun 2006), "skins" in and after it. --- completions/mplayer | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/completions/mplayer b/completions/mplayer index f82d1c4d..5d1b87cf 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -11,7 +11,7 @@ _mplayer_options_list() _mplayer() { - local cmd cur prev skinsdir i j k=0 + local cmd cur prev i j k=0 COMPREPLY=() cmd=${COMP_WORDS[0]} @@ -69,14 +69,15 @@ _mplayer() -skin) # if you don't have installed mplayer in /usr you # may want to set the MPLAYER_SKINS_DIR global variable + local -a dirs if [ -n "$MPLAYER_SKINS_DIR" ]; then - skinsdir=$MPLAYER_SKINS_DIR + dirs=($MPLAYER_SKINS_DIR) else - skinsdir=/usr/share/mplayer/Skin + dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins) fi local IFS=$'\t\n' - for i in ~/.mplayer/Skin $skinsdir; do + for i in ~/.mplayer/skins ${dirs[@]}; do if [[ -d $i && -r $i ]]; then for j in $( compgen -d $i/$cur ); do COMPREPLY[$k]=${j#$i/} From 3d8efed6182454fd0913522406a10d1bf8a3d19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 4 Oct 2010 20:49:17 +0300 Subject: [PATCH 61/77] Fixes to completions for filenames containing tabs (RedHat: #629518). --- CHANGES | 1 + bash_completion | 8 ++++---- completions/bzip2 | 2 +- completions/gzip | 2 +- completions/lrzip | 2 +- completions/lzma | 2 +- completions/lzop | 2 +- completions/mplayer | 4 ++-- completions/perl | 2 +- completions/ssh | 6 +++--- completions/wvdial | 4 ++-- completions/xz | 2 +- 12 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 962deda5..dd9574b0 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ bash-completion (2.x) * Fix known hosts completion for IPv6 addresses whose last 16 bits are digits (Alioth: #312695, RedHat: #630658). * Improve mplayer and mencoder completions. + * Fixes to completions for filenames containing tabs (RedHat: #629518). [ Freddy Vulto ] * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) diff --git a/bash_completion b/bash_completion index 9e16b9b7..e3ae3089 100644 --- a/bash_completion +++ b/bash_completion @@ -615,7 +615,7 @@ _quote_readline_by_ref() # _filedir() { - local i IFS=$'\t\n' xspec + local i IFS=$'\n' xspec _tilde "$cur" || return 0 @@ -1361,7 +1361,7 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \ # _cd() { - local cur IFS=$'\t\n' i j k + local cur IFS=$'\n' i j k _get_comp_words_by_ref cur # try to allow variable completion @@ -1384,7 +1384,7 @@ _cd() 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 + for i in ${CDPATH//:/$'\n'}; do # create an array of matched subdirs k="${#COMPREPLY[@]}" for j in $( compgen -d $i/$cur ); do @@ -1564,7 +1564,7 @@ _filedir_xspec() { local IFS cur xspec - IFS=$'\t\n' + IFS=$'\n' COMPREPLY=() _get_comp_words_by_ref cur diff --git a/completions/bzip2 b/completions/bzip2 index f4902e29..be030274 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -21,7 +21,7 @@ _bzip2() return 0 fi - local IFS=$'\t\n' + local IFS=$'\n' xspec="*.bz2" if [[ "$prev" == --* ]]; then diff --git a/completions/gzip b/completions/gzip index 0951f72f..afd647ed 100644 --- a/completions/gzip +++ b/completions/gzip @@ -21,7 +21,7 @@ _gzip() return 0 fi - local IFS=$'\t\n' + local IFS=$'\n' xspec="*.@(gz|t[ag]z)" if [[ "$prev" == --* ]]; then diff --git a/completions/lrzip b/completions/lrzip index e5848035..445fc3c5 100644 --- a/completions/lrzip +++ b/completions/lrzip @@ -48,7 +48,7 @@ _lrzip() _expand || return 0 - local IFS=$'\t\n' + local IFS=$'\n' COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ $( compgen -d -- "$cur" ) ) } && diff --git a/completions/lzma b/completions/lzma index a176f191..c2fece97 100644 --- a/completions/lzma +++ b/completions/lzma @@ -16,7 +16,7 @@ _lzma() return 0 fi - local IFS=$'\t\n' + local IFS=$'\n' xspec="*.@(lzma|tlz)" if [[ "$prev" == --* ]]; then diff --git a/completions/lzop b/completions/lzop index 19852b24..7a34ae3e 100644 --- a/completions/lzop +++ b/completions/lzop @@ -53,7 +53,7 @@ _lzop() _expand || return 0 - local IFS=$'\t\n' + local IFS=$'\n' COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ $( compgen -d -- "$cur" ) ) } && diff --git a/completions/mplayer b/completions/mplayer index 5d1b87cf..39ac93d3 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -48,7 +48,7 @@ _mplayer() ;; -vobsub) _filedir '@(idx|ifo|sub)' - local IFS=$'\t\n' + local IFS=$'\n' COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do if [[ -f $i && -r $i ]]; then printf '%s\n' ${i%.*} @@ -76,7 +76,7 @@ _mplayer() dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins) fi - local IFS=$'\t\n' + local IFS=$'\n' for i in ~/.mplayer/skins ${dirs[@]}; do if [[ -d $i && -r $i ]]; then for j in $( compgen -d $i/$cur ); do diff --git a/completions/perl b/completions/perl index ea71b2f4..9a1d84bf 100644 --- a/completions/perl +++ b/completions/perl @@ -30,7 +30,7 @@ _perl() # only handle module completion for now case $prev in -I|-x) - local IFS=$'\t\n' + local IFS=$'\n' COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) return 0 ;; diff --git a/completions/ssh b/completions/ssh index b4bafdee..2c20c2d3 100644 --- a/completions/ssh +++ b/completions/ssh @@ -246,13 +246,13 @@ _sftp() shopt -u hostcomplete && complete -F _sftp sftp # things we want to escape in remote scp paths -_scp_path_esc="[][(){}<>\",:;^&\!$=?\`|\\ ']" +_scp_path_esc="[][(){}<>\",:;^&\!$=?\`|\\ \t']" # Complete remote files with ssh. If the first arg is -d, complete on dirs # only. Returns paths escaped with three backslashes. _scp_remote_files() { - local IFS=$'\t\n' + local IFS=$'\n' # remove backslash escape from the first colon cur=${cur/\\:/:} @@ -291,7 +291,7 @@ _scp_remote_files() # an optional prefix to add to returned completions. _scp_local_files() { - local IFS=$'\t\n' + local IFS=$'\n' local dirsonly=false if [ "$1" = -d ]; then diff --git a/completions/wvdial b/completions/wvdial index 101112ca..3b135f0a 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -3,7 +3,7 @@ have wvdial && _wvdial() { - local cur prev config i IFS=$'\t\n' + local cur prev config i IFS=$'\n' COMPREPLY=() _get_comp_words_by_ref cur prev @@ -23,7 +23,7 @@ _wvdial() ;; *) # start with global and personal config files - config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc" + config="/etc/wvdial.conf"$'\n'"$HOME/.wvdialrc" # replace with command line config file if present for (( i=1; i < COMP_CWORD; i++ )); do if [[ "${COMP_WORDS[i]}" == "--config" ]]; then diff --git a/completions/xz b/completions/xz index 46420b01..f947b080 100644 --- a/completions/xz +++ b/completions/xz @@ -52,7 +52,7 @@ _xz() _expand || return 0 - local IFS=$'\t\n' + local IFS=$'\n' COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ $( compgen -d -- "$cur" ) ) } && From 1da64f602a79745edb121767a2c27ce2e3a4288c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 4 Oct 2010 21:29:44 +0300 Subject: [PATCH 62/77] More known hosts IPv6 completion fixes, thanks to Yoshinori KUNIGA. https://bugzilla.redhat.com/show_bug.cgi?id=630658#c4 --- CHANGES | 3 +-- bash_completion | 16 ++++++++-------- test/fixtures/_known_hosts_real/known_hosts | 3 +++ test/unit/_known_hosts_real.exp | 12 ++++++------ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index dd9574b0..d8481e94 100644 --- a/CHANGES +++ b/CHANGES @@ -22,8 +22,7 @@ bash-completion (2.x) * Drop bad kompare filename completion (Alioth: #312708). * Make _filedir and _filedir_xspec complete uppercase versions of their filename extension arguments in addition to exact case matches. - * Fix known hosts completion for IPv6 addresses whose last 16 bits are digits - (Alioth: #312695, RedHat: #630658). + * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658). * Improve mplayer and mencoder completions. * Fixes to completions for filenames containing tabs (RedHat: #629518). diff --git a/bash_completion b/bash_completion index e3ae3089..e88c662d 100644 --- a/bash_completion +++ b/bash_completion @@ -1279,16 +1279,16 @@ _known_hosts_real() awkcur=${awkcur//\./\\\.} curd=$awkcur - if [[ "$awkcur" == [0-9]*.* ]]; then - # Digits followed by a dot - just search for that - awkcur="^$awkcur.*" + if [[ "$awkcur" == [0-9]*[.:]* ]]; then + # Digits followed by a dot or a colon - 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.*\." + # Digits followed by no dot or colon - search for digits followed + # by a dot or a colon + awkcur="^$awkcur.*[.:]" elif [ -z "$awkcur" ]; then - # A blank - search for a dot or an alpha character - awkcur="[a-z.]" + # A blank - search for a dot, a colon, or an alpha character + awkcur="[a-z.:]" else awkcur="^$awkcur" fi diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts index 65019090..f655eaa3 100644 --- a/test/fixtures/_known_hosts_real/known_hosts +++ b/test/fixtures/_known_hosts_real/known_hosts @@ -8,3 +8,6 @@ kyl,100.0.0.2 [blah]:1234 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 +1111:2222:3333:4444:5555:6666:xxxx:abab +11xx:2222:3333:4444:5555:6666:xxxx:abab +::42 diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp index 8869de11..c23a9cef 100644 --- a/test/unit/_known_hosts_real.exp +++ b/test/unit/_known_hosts_real.exp @@ -17,8 +17,8 @@ setup set test "Hosts should be put in COMPREPLY" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42 set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test @@ -29,8 +29,8 @@ sync_after_int set test "Hosts should have username prefix and colon suffix" set hosts [get_hosts] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42 set hosts [lsort -ascii $hosts] set expected {} foreach host $hosts { @@ -103,8 +103,8 @@ set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE" assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE=" set hosts [get_hosts_avahi] # Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config - # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts -lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 + # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts +lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42 # Call _known_hosts set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY} assert_bash_list $hosts $cmd $test From e8d84b300471944e6413bd9f6312dd57ee27b922 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Tue, 5 Oct 2010 21:39:58 +0200 Subject: [PATCH 63/77] Bugfix __reassemble_comp_words_by_ref a b:c | (with |=cursor) did not return `b:c' as `prev' on bash-4.1 (Alioth #312740) --- bash_completion | 2 +- test/unit/_get_comp_words_by_ref.exp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index e88c662d..a34015c3 100644 --- a/bash_completion +++ b/bash_completion @@ -308,7 +308,7 @@ __reassemble_comp_words_by_ref() { ref="$2[$j]" eval $2[$j]=\${!ref}\${COMP_WORDS[i]} # Indicate new cword - [[ $i == $COMP_CWORD && ${COMP_WORDS[i]} ]] && eval $3=$j + [[ $i == $COMP_CWORD ]] && eval $3=$j done else # No, list of word completions separators hasn't changed; diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp index c88ad6f6..cb3f4dad 100644 --- a/test/unit/_get_comp_words_by_ref.exp +++ b/test/unit/_get_comp_words_by_ref.exp @@ -202,6 +202,21 @@ assert_bash_list {"c: b"} $cmd $test sync_after_int +set test {a b:c | with WORDBREAKS -= :}; # | = cursor position +if {[lindex $::BASH_VERSINFO 0] <= 3} { + set cmd {COMP_WORDS=(a b:c ''); COMP_CWORD=2} +} else { + set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4} +} +append cmd {; COMP_LINE='a b:c '; COMP_POINT=6} +assert_bash_exec $cmd $test +set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"} +assert_bash_list {" b:c"} $cmd $test + + +sync_after_int + + set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3} assert_bash_exec $cmd From 4e8bc5086539f6a6407dc08c3af4d50d2e294b39 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Tue, 5 Oct 2010 21:46:01 +0200 Subject: [PATCH 64/77] Updated CHANGES --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index d8481e94..17c9100f 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,7 @@ bash-completion (2.x) * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) * Speed up `compopt' availability detection * Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646) + * Fix __reassemble_comp_words_by_ref (Alioth #312740) [ Anton Khirnov ] * Improve mplayer and mencoder completions. From 77b78b372371b0093ad93840cb28f2efe94ef5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 5 Oct 2010 23:40:13 +0300 Subject: [PATCH 65/77] Add sysbench completion. --- CHANGES | 2 +- completions/Makefile.am | 1 + completions/sysbench | 175 ++++++++++++++++++++++++++++++ test/completion/sysbench.exp | 1 + test/lib/completions/sysbench.exp | 20 ++++ 5 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 completions/sysbench create mode 100644 test/completion/sysbench.exp create mode 100644 test/lib/completions/sysbench.exp diff --git a/CHANGES b/CHANGES index 17c9100f..d2269f41 100644 --- a/CHANGES +++ b/CHANGES @@ -9,7 +9,7 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, filefrag, - iftop, lrzip, POSIX sh, tune2fs, xmodmap, and xrdb completions. + iftop, lrzip, POSIX sh, sysbench, tune2fs, xmodmap, and xrdb completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/Makefile.am b/completions/Makefile.am index f335b5d0..5c904295 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -143,6 +143,7 @@ bashcomp_DATA = abook \ sshfs \ strace \ svk \ + sysbench \ sysctl \ sysv-rc \ tar \ diff --git a/completions/sysbench b/completions/sysbench new file mode 100644 index 00000000..06acdc40 --- /dev/null +++ b/completions/sysbench @@ -0,0 +1,175 @@ +# bash completion for sysbench + +# We set -o nospace and turn it off in quite a few place for bash < 4 +# reasons; assuming bash >= 4 we could instead not turn it on +# initially but only in the few cases where it's actually needed. + +have sysbench && +_sysbench() +{ + COMPREPLY=() + local cur prev words cword split=false + _get_comp_words_by_ref -n = cur prev words cword + + # long options need the "=" (whitespace split doesn't work), but we split + # internally to make processing easier + _split_longopt && split=true + + case $prev in + --num-threads|--max-requests|--max-time|--thread-stack-size| \ + --help|--version|help|version) + return 0 + ;; + --init-rng|--debug|--validate) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return 0 + ;; + --test) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \ + -- "$cur" ) ) + return 0 + ;; + --cpu-max-prime) + return 0 + ;; + --file-test-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ + -- "$cur" ) ) + return 0 + ;; + --file-io-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \ + -- "$cur" ) ) + return 0 + ;; + --file-extra-flags) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) ) + return 0 + ;; + --file-fsync-all|--file-fsync-end) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return 0 + ;; + --file-fsync-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) ) + return 0 + ;; + --memory-scope) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) ) + return 0 + ;; + --memory-hugetlb) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return 0 + ;; + --memory-oper) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) ) + return 0 + ;; + --memory-access-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) ) + return 0 + ;; + --oltp-test-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) ) + return 0 + ;; + --oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return 0 + ;; + --oltp-nontrx-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'select update_key update_nokey insert + delete' -- "$cur" ) ) + return 0 + ;; + --oltp-dist-type) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) ) + return 0 + ;; + --db-driver) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null | + sed -e '/^.*database drivers:/,/^$/!d' \ + -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) ) + return 0 + ;; + --db-ps-mode) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) ) + return 0 + ;; + --mysql-socket) + compopt +o nospace &>/dev/null + _filedir sock + return 0 + ;; + --mysql-table-engine) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster + federated' -- "$cur" ) ) + return 0 + ;; + --mysql-engine-trx) + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) ) + return 0 + ;; + --*) + $split && return 0 + ;; + esac + + # find out which test we're running + local i test + for (( i=1 ; $i < ${#words[@]}-1 ; i++ )); do + if [[ ${words[i]} == --test* ]]; then + test=${words[i]#*=} + break + fi + done + + local opts="--num-threads= --max-requests= --max-time= --thread-stack-size= + --init-rng= --debug= --validate= --help --version" + + if [[ $test ]]; then + local help=( $( _parse_help $1 "--test=$test help" ) ) + opts="$opts ${help[@]/%/=} prepare run cleanup help version" + else + opts="$opts --test=" + fi + + if [[ "$cur" == -* || ! $test ]]; then + COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \ + compopt +o nospace &>/dev/null + else + compopt +o nospace &>/dev/null + COMPREPLY=( $( compgen -W "prepare run cleanup help version" \ + -- "$cur" ) ) + fi +} && +complete -F _sysbench -o nospace sysbench + +# 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/test/completion/sysbench.exp b/test/completion/sysbench.exp new file mode 100644 index 00000000..68da0a7a --- /dev/null +++ b/test/completion/sysbench.exp @@ -0,0 +1 @@ +assert_source_completions sysbench diff --git a/test/lib/completions/sysbench.exp b/test/lib/completions/sysbench.exp new file mode 100644 index 00000000..2a0fe339 --- /dev/null +++ b/test/lib/completions/sysbench.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "sysbench " + + +sync_after_int + + +teardown From 267fb3205df377393959240b47d11a9b4670dfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 5 Oct 2010 23:55:30 +0300 Subject: [PATCH 66/77] Drop unused cword. --- completions/sysbench | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/completions/sysbench b/completions/sysbench index 06acdc40..7781791e 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -8,8 +8,8 @@ have sysbench && _sysbench() { COMPREPLY=() - local cur prev words cword split=false - _get_comp_words_by_ref -n = cur prev words cword + local cur prev words split=false + _get_comp_words_by_ref -n = cur prev words # long options need the "=" (whitespace split doesn't work), but we split # internally to make processing easier From 27dab7e198dbc5d7fe20766dc0e01174d7b8f946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 5 Oct 2010 23:59:09 +0300 Subject: [PATCH 67/77] Allow setting option for creating output to parse in _parse_help(). Required in just added sysbench completion. --- bash_completion | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash_completion b/bash_completion index a34015c3..1ba2d071 100644 --- a/bash_completion +++ b/bash_completion @@ -706,12 +706,12 @@ _split_longopt() return 1 } -# This function tries to parse the output of $command --help +# This function tries to parse the help output of the given command. +# @param $1 command +# @param $2 command options (default: --help) # _parse_help() { - local cmd - cmd=$1 - $cmd --help 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \ + $1 ${2:---help} 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \ awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g" } From f0cc5fc2a8642c0acc925c31a0fd81e05f68f62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 7 Oct 2010 18:03:59 +0300 Subject: [PATCH 68/77] Add ether-wake completion. --- CHANGES | 5 +++-- completions/net-tools | 26 ++++++++++++++++++++++++++ test/completion/ether-wake.exp | 1 + test/lib/completions/ether-wake.exp | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 test/completion/ether-wake.exp create mode 100644 test/lib/completions/ether-wake.exp diff --git a/CHANGES b/CHANGES index d2269f41..a127231d 100644 --- a/CHANGES +++ b/CHANGES @@ -8,8 +8,9 @@ bash-completion (2.x) [ Ville Skyttä ] * Activate hping2 completion also for hping and hping3. - * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, filefrag, - iftop, lrzip, POSIX sh, sysbench, tune2fs, xmodmap, and xrdb completions. + * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake, + filefrag, iftop, lrzip, POSIX sh, sysbench, tune2fs, xmodmap, and xrdb + completions. * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. diff --git a/completions/net-tools b/completions/net-tools index 5b86a64a..e7de2b04 100644 --- a/completions/net-tools +++ b/completions/net-tools @@ -96,6 +96,32 @@ _route() } && complete -F _route route +have ether-wake && +_ether_wake() +{ + COMPREPLY=() + local cur prev + _get_comp_words_by_ref -n : cur prev + + case $prev in + -i) + _available_interfaces + return 0 + ;; + -p) + return 0 + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '-b -D -i -p -V' -- "$cur" ) ) + return 0 + fi + + _mac_addresses +} && +complete -F _ether_wake ether-wake + # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/test/completion/ether-wake.exp b/test/completion/ether-wake.exp new file mode 100644 index 00000000..602ba271 --- /dev/null +++ b/test/completion/ether-wake.exp @@ -0,0 +1 @@ +assert_source_completions ether-wake diff --git a/test/lib/completions/ether-wake.exp b/test/lib/completions/ether-wake.exp new file mode 100644 index 00000000..fe1aa174 --- /dev/null +++ b/test/lib/completions/ether-wake.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ether-wake " + + +sync_after_int + + +teardown From 4cd7c7c87254e8fd39ee4c7fcb423ea3d26c7db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 7 Oct 2010 20:05:55 +0300 Subject: [PATCH 69/77] Treat *.spm as *.src.rpm. Source rpms are sometimes named *.spm, e.g. in SUSE. --- bash_completion | 4 ++-- completions/_mock | 2 +- completions/rpm | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bash_completion b/bash_completion index 1ba2d071..af10c395 100644 --- a/bash_completion +++ b/bash_completion @@ -102,7 +102,7 @@ complete -f -X '!*.fig' xfig complete -f -X '!*.@(mid?(i)|cmf)' playmidi complete -f -X '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity complete -f -X '!*.@(m[eo]d|s[3t]m|xm|it)' modplugplay modplug123 -complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite +complete -f -X '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine complete -f -X '!*.@(zip|z|gz|tgz)' bzme # konqueror not here on purpose, it's more than a web/html browser @@ -113,7 +113,7 @@ 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 '!*.[rs]pm' rpm2cpio 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 diff --git a/completions/_mock b/completions/_mock index f16f116d..40e422ce 100644 --- a/completions/_mock +++ b/completions/_mock @@ -72,7 +72,7 @@ _mock() --sources --verbose --quiet --trace --enable-plugin \ --disable-plugin --print-root-path' -- "$cur" ) ) else - _filedir '?(no)src.rpm' + _filedir '@(?(no)src.r|s)pm' fi } && complete -F _mock -o filenames mock diff --git a/completions/rpm b/completions/rpm index d268cabd..16870dad 100644 --- a/completions/rpm +++ b/completions/rpm @@ -164,7 +164,7 @@ _rpm() --excludepath --ignoresize --oldpackage \ --queryformat --repackage --nosuggests" -- "$cur" ) ) else - _filedir 'rpm' + _filedir '[rs]pm' fi ;; -e|--erase) @@ -201,7 +201,7 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ --httpport --httpproxy --nomanifest" -- "$cur" ) ) else - _filedir 'rpm' + _filedir '[rs]pm' fi else # -q; installed package completion @@ -221,7 +221,7 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \ -- "$cur" ) ) else - _filedir 'rpm' + _filedir '[rs]pm' fi ;; -[Vy]*|--verify) @@ -236,7 +236,7 @@ _rpm() elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then - _filedir 'rpm' + _filedir '[rs]pm' else _rpm_installed_packages "$nodig" "$nosig" fi @@ -257,14 +257,14 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --nodeps --rmsource \ --rmspec --sign --nodirtokens --target" -- "$cur" ) ) else - _filedir '?(no)src.rpm' + _filedir '@(?(no)src.r|s)pm' fi ;; --tarbuild) _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))' ;; --resign|--addsign) - _filedir 'rpm' + _filedir '[rs]pm' ;; --setperms|--setgids) _rpm_installed_packages "$nodig" "$nosig" From a55f76336311a695d84097068e67e30014926ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 7 Oct 2010 20:07:46 +0300 Subject: [PATCH 70/77] Trivial cleanups. --- completions/rpm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/completions/rpm b/completions/rpm index 16870dad..0dbcd048 100644 --- a/completions/rpm +++ b/completions/rpm @@ -247,7 +247,7 @@ _rpm() --clean --rmsource --rmspec --test --sign --buildroot \ --target --nobuild --nodeps --nodirtokens" -- "$cur" ) ) elif [[ ${COMP_WORDS[1]} == -b* ]]; then - _filedir 'spec' + _filedir spec else _filedir '@(t?(ar.)@([gx]z|bz?(2))|tar.@(lzma|Z))' fi @@ -274,13 +274,12 @@ _rpm() COMPREPLY=( $( compgen -W '--clean --rmsource --rmspec' \ -- "$cur" ) ) else - _filedir 'spec' + _filedir spec fi ;; --import|--dbpath|--root) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--import --dbpath --root' \ - -- "$cur" ) ) + COMPREPLY=( $( compgen -W '--import --dbpath --root' -- "$cur" ) ) else _filedir fi From 96b1594e4ef76b48491bb5d6d0f14720fec36c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 7 Oct 2010 20:37:06 +0300 Subject: [PATCH 71/77] Use "compopt -o filenames" if available instead of "compgen -f" hack in _cd(). --- bash_completion | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index af10c395..5c6c850a 100644 --- a/bash_completion +++ b/bash_completion @@ -1370,8 +1370,10 @@ _cd() return 0 fi - # Enable -o filenames option, see Debian bug #272660 - compgen -f /non-existing-dir/ >/dev/null + # Turn on -o filenames; see http://bugs.debian.org/272660#64 for + # info about the compgen hack (bash < 4) + compopt -o filenames 2>/dev/null || \ + compgen -f /non-existing-dir/ >/dev/null # Use standard dir completion if no CDPATH or parameter starts with /, # ./ or ../ From cb6a9a4dfedf7f9a45ae9f6c010b73aae2d33323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 7 Oct 2010 20:39:10 +0300 Subject: [PATCH 72/77] Use "compgen -f" hack from _cd() instead of emulating -o filenames in _filedir(). See http://bugs.debian.org/272660#64 for more info about the hack. --- bash_completion | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/bash_completion b/bash_completion index 5c6c850a..b2b3f1b0 100644 --- a/bash_completion +++ b/bash_completion @@ -643,45 +643,10 @@ _filedir() xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"} toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) if [ ${#toks[@]} -ne 0 ]; then - # If `compopt' is available, set `-o filenames' - type compopt &>/dev/null && compopt -o filenames 2>/dev/null || - # No, `compopt' isn't available; - # Is `-o filenames' set? - [[ ( - ${COMP_WORDS[0]} && - "$(complete -p ${COMP_WORDS[0]} 2>/dev/null)" == \ - *"-o filenames"* - ) ]] || { - # No, `-o filenames' isn't set; - # Emulate `-o filenames' - # NOTE: A side-effect of emulating `-o filenames' is that - # backslash escape characters are visible within the list - # of presented completions, e.g. the completions look - # like: - # - # $ foo a - # a\ b/ a\$b/ - # - # whereas with `-o filenames' active the completions look - # like: - # - # $ ls a - # a b/ a$b/ - # - for ((i=0; i < ${#toks[@]}; i++)); do - # If directory exists, append slash (/) - if [[ ${cur:0:1} != "'" ]]; then - [[ -d ${toks[i]} ]] && toks[i]="${toks[i]}"/ - if [[ ${cur:0:1} == '"' ]]; then - toks[i]=${toks[i]//\\/\\\\} - toks[i]=${toks[i]//\"/\\\"} - toks[i]=${toks[i]//\$/\\\$} - else - toks[i]=$(printf %q ${toks[i]}) - fi - fi - done - } + # Turn on -o filenames; see http://bugs.debian.org/272660#64 for + # info about the compgen hack (bash < 4) + compopt -o filenames 2>/dev/null || \ + compgen -f /non-existing-dir/ >/dev/null fi fi From dff42419986c7400a82384629285c86bd42f5a60 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Sat, 9 Oct 2010 22:12:51 +0200 Subject: [PATCH 73/77] (testsuite) Fix _filedir test for "compgen -f" hack One test was failing on bash-3 --- test/unit/_filedir.exp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp index 59d50854..987df526 100644 --- a/test/unit/_filedir.exp +++ b/test/unit/_filedir.exp @@ -251,12 +251,7 @@ sync_after_int set test "completing f aé should return g when LC_CTYPE=C" # Backup/set LC_CTYPE assert_bash_exec {OLD_CTYPE=$LC_CTYPE; LC_CTYPE=C} -if {[lindex $::BASH_VERSINFO 0] > 3} { - assert_complete_dir g "f aé/" "fixtures/_filedir" -} else { - assert_complete_dir "\b\b\b\b$'a\\\\303\\\\251/g'" "f aé/" \ - "fixtures/_filedir" -} +assert_complete_dir g "f aé/" "fixtures/_filedir" # Restore LC_CTYPE assert_bash_exec {[[ $OLD_CTYPE ]] && LC_CTYPE=$OLD_CTYPE || unset LC_CTYPE} From 95399f638cc95dc262a94d845569a12a6a219a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 11 Oct 2010 00:01:51 +0300 Subject: [PATCH 74/77] Fix false posives for non-option words in _parse_help (Alioth: #312750, Stephen Gildea). --- CHANGES | 3 ++ bash_completion | 2 +- test/unit/_parse_help.exp | 65 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 test/unit/_parse_help.exp diff --git a/CHANGES b/CHANGES index a127231d..de2695a5 100644 --- a/CHANGES +++ b/CHANGES @@ -46,6 +46,9 @@ bash-completion (2.x) * Add *.part (partially downloaded) to mplayer and xine-based player completions (Alioth: #312657). + [ Stephen Gildea ] + * Fix false posives for non-option words in _parse_help (Alioth: #312750). + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) diff --git a/bash_completion b/bash_completion index b2b3f1b0..e411ca6a 100644 --- a/bash_completion +++ b/bash_completion @@ -677,7 +677,7 @@ _split_longopt() # _parse_help() { $1 ${2:---help} 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \ - awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g" + awk '{print $1; if ($2 ~ /^-.*/) { print $2 } }' | sed -e "s:=.*::g" } # This function completes on signal names diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp new file mode 100644 index 00000000..c9ced6f6 --- /dev/null +++ b/test/unit/_parse_help.exp @@ -0,0 +1,65 @@ +# By Stephen Gildea, October 2010. + +proc setup {} { + save_env +} + +proc teardown {} { + assert_env_unmodified { + /declare -f fn/d + } +} + +setup + + +set cmd {fn() { printf '%s\n' ""; }; _parse_help fn} +assert_bash_list "" $cmd "empty" +sync_after_int + +set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_help fn} +assert_bash_list "" $cmd "no dashes" +sync_after_int + +set cmd {fn() { printf '%s\n' "internal-dash"; }; _parse_help fn} +assert_bash_list "" $cmd "internal dash 1" +sync_after_int + +set cmd {fn() { printf '%s\n' "no -leading-dashes"; }; _parse_help fn} +assert_bash_list "" $cmd "no leading dash" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one dash"; }; _parse_help fn} +assert_bash_list "-one" $cmd "one dash" +sync_after_int + +set cmd {fn() { printf '%s\n' " -space dash"; }; _parse_help fn} +assert_bash_list "-space" $cmd "one dash after space" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn} +assert_bash_list "-one\n-two" $cmd "two dashes, space-separated" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn} +assert_bash_list "-one\n-t" $cmd "two dashes, comma-separated" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn} +assert_bash_list "-one" $cmd "internal dash 2" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn} +assert_bash_list "--long-arg" $cmd "value stripped" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn} +assert_bash_list "--long-arg" $cmd "value not seen as option" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn} +assert_bash_list "--long-arg\n--opt2" $cmd "two options with values" +sync_after_int + + +teardown From 52bfcefb3d3870c646273e5d0afa9e392cb37cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 11 Oct 2010 00:14:22 +0300 Subject: [PATCH 75/77] Simplify _parse_help somewhat. --- bash_completion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index e411ca6a..d4244a0b 100644 --- a/bash_completion +++ b/bash_completion @@ -676,8 +676,8 @@ _split_longopt() # @param $2 command options (default: --help) # _parse_help() { - $1 ${2:---help} 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \ - awk '{print $1; if ($2 ~ /^-.*/) { print $2 } }' | sed -e "s:=.*::g" + $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's/,/ /g' | \ + awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|=.*||' } # This function completes on signal names From 96c641630923e8db735316e5a7f4bef8741cadc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 11 Oct 2010 00:39:50 +0300 Subject: [PATCH 76/77] Make _parse_help() work with slash separated options. --- CHANGES | 4 ++-- bash_completion | 2 +- test/unit/_parse_help.exp | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index de2695a5..e95f526e 100644 --- a/CHANGES +++ b/CHANGES @@ -14,7 +14,8 @@ bash-completion (2.x) * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer filename completions. * Add "short" tarball extensions to unxz, unlzma etc completions. - * Improve /etc/init.d/*, ipmitool, jar, povray, and sqlite3 completions. + * Improve /etc/init.d/*, ipmitool, jar, mencoder, mplayer, povray, sqlite3, + and general help parsing completions. * Fix p4 and povray completions (Alioth: #312625). * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Recognize rpm query mode based on the --file, --group, --package, and @@ -24,7 +25,6 @@ bash-completion (2.x) * Make _filedir and _filedir_xspec complete uppercase versions of their filename extension arguments in addition to exact case matches. * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658). - * Improve mplayer and mencoder completions. * Fixes to completions for filenames containing tabs (RedHat: #629518). [ Freddy Vulto ] diff --git a/bash_completion b/bash_completion index d4244a0b..451e4261 100644 --- a/bash_completion +++ b/bash_completion @@ -676,7 +676,7 @@ _split_longopt() # @param $2 command options (default: --help) # _parse_help() { - $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's/,/ /g' | \ + $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \ awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|=.*||' } diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp index c9ced6f6..4beb28d2 100644 --- a/test/unit/_parse_help.exp +++ b/test/unit/_parse_help.exp @@ -61,5 +61,13 @@ set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn} assert_bash_list "--long-arg\n--opt2" $cmd "two options with values" sync_after_int +set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn} +assert_bash_list "-m\n--mirror" $cmd "short + long" +sync_after_int + +set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn} +assert_bash_list "-T\n--upload-file" $cmd "short + long, slash separated" +sync_after_int + teardown From 13e811b1f98aa592ef80cca4b66037426db73b75 Mon Sep 17 00:00:00 2001 From: "Andrey G. Grozin" Date: Wed, 13 Oct 2010 18:44:47 +0300 Subject: [PATCH 77/77] Add *.fb2 to okular filename completions. --- CHANGES | 3 +++ bash_completion | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e95f526e..98d6fb5b 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,9 @@ bash-completion (2.x) [ Stephen Gildea ] * Fix false posives for non-option words in _parse_help (Alioth: #312750). + [ Andrey G. Grozin ] + * Add *.fb2 to okular filename completions. + -- David Paleino Wed, 16 Jun 2010 17:53:22 +0200 bash-completion (1.2) diff --git a/bash_completion b/bash_completion index 451e4261..d74e7b79 100644 --- a/bash_completion +++ b/bash_completion @@ -87,7 +87,7 @@ complete -f -X '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx complete -f -X '!*.pdf' acroread gpdf xpdf complete -f -X '!*.@(?(e)ps|pdf)' kpdf complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|fdf)' evince -complete -f -X '!*.@(okular|@(?(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|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular +complete -f -X '!*.@(okular|@(?(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?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular complete -f -X '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr complete -f -X '!*.texi*' makeinfo texi2html complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi