diff options
Diffstat (limited to 'completions')
-rw-r--r-- | completions/Makefile.am | 21 | ||||
-rw-r--r-- | completions/Makefile.in | 77 | ||||
-rw-r--r-- | completions/acpi | 23 | ||||
-rw-r--r-- | completions/apt-get | 4 | ||||
-rw-r--r-- | completions/bzip2 | 4 | ||||
-rw-r--r-- | completions/cppcheck | 6 | ||||
-rw-r--r-- | completions/fbgs | 22 | ||||
-rw-r--r-- | completions/fbi | 2 | ||||
-rw-r--r-- | completions/feh | 18 | ||||
-rw-r--r-- | completions/gzip | 6 | ||||
-rw-r--r-- | completions/hwclock | 23 | ||||
-rw-r--r-- | completions/insmod | 32 | ||||
-rw-r--r-- | completions/make | 6 | ||||
-rw-r--r-- | completions/man | 11 | ||||
-rw-r--r-- | completions/modinfo | 44 | ||||
-rw-r--r-- | completions/modprobe | 86 | ||||
-rw-r--r-- | completions/mount.linux | 15 | ||||
-rw-r--r-- | completions/mplayer | 20 | ||||
-rw-r--r-- | completions/pwd | 22 | ||||
-rw-r--r-- | completions/ri | 6 | ||||
-rw-r--r-- | completions/rmmod | 11 | ||||
-rw-r--r-- | completions/sbopkg | 16 | ||||
-rw-r--r-- | completions/slackpkg | 6 | ||||
-rw-r--r-- | completions/slapt-get | 6 | ||||
-rw-r--r-- | completions/slapt-src | 6 | ||||
-rw-r--r-- | completions/ssh | 8 | ||||
-rw-r--r-- | completions/ssh-add | 23 | ||||
-rw-r--r-- | completions/su | 37 | ||||
-rw-r--r-- | completions/sudo | 51 | ||||
-rw-r--r-- | completions/vmstat | 27 | ||||
-rw-r--r-- | completions/xmllint | 2 |
31 files changed, 531 insertions, 110 deletions
diff --git a/completions/Makefile.am b/completions/Makefile.am index ba3cfb03..0a24d0cd 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -2,6 +2,7 @@ bashcompdir = $(pkgdatadir)/completions bashcomp_DATA = a2x \ abook \ aclocal \ + acpi \ add_members \ alias \ ant \ @@ -118,6 +119,7 @@ bashcomp_DATA = a2x \ hping2 \ htop \ htpasswd \ + hwclock \ iconv \ id \ idn \ @@ -193,6 +195,8 @@ bashcomp_DATA = a2x \ mkinitrd \ mktemp \ mmsitepass \ + modinfo \ + modprobe \ monodevelop \ mount \ mount.linux \ @@ -243,6 +247,7 @@ bashcomp_DATA = a2x \ psql \ puppet \ pwck \ + pwd \ pwdx \ pwgen \ python \ @@ -284,11 +289,14 @@ bashcomp_DATA = a2x \ snownews \ sqlite3 \ ssh \ + ssh-add \ ssh-copy-id \ sshfs \ sshmitm \ sshow \ strace \ + su \ + sudo \ svk \ sync_members \ sysbench \ @@ -315,6 +323,7 @@ bashcomp_DATA = a2x \ usermod \ valgrind \ vipw \ + vmstat \ vncviewer \ vpnc \ watch \ @@ -402,6 +411,7 @@ CLEANFILES = \ ifdown \ ifstatus \ import \ + insmod.static \ javac \ javadoc \ kplayer \ @@ -430,8 +440,6 @@ CLEANFILES = \ mdecrypt \ mencoder \ mkisofs \ - modinfo \ - modprobe \ mogrify \ montage \ mplayer2 \ @@ -498,6 +506,7 @@ CLEANFILES = \ sparc-koji \ spovray \ stream \ + sudoedit \ tightvncviewer \ tracepath6 \ typeset \ @@ -524,7 +533,7 @@ CLEANFILES = \ xvnc4viewer \ ypcat -symlinks: +symlinks: $(targetdir) for file in aclocal-1.11 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) aclocal $(targetdir)/$$file ; \ @@ -635,7 +644,7 @@ symlinks: rm -f $(targetdir)/$$file && \ $(LN_S) info $(targetdir)/$$file ; \ done - for file in modprobe modinfo ; do \ + for file in insmod.static ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) insmod $(targetdir)/$$file ; \ done @@ -770,6 +779,10 @@ symlinks: rm -f $(targetdir)/$$file && \ $(LN_S) ssh $(targetdir)/$$file ; \ done + for file in sudoedit ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sudo $(targetdir)/$$file ; \ + done for file in tracepath6 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) tracepath $(targetdir)/$$file ; \ diff --git a/completions/Makefile.in b/completions/Makefile.in index b7e1bd1f..8c8824e4 100644 --- a/completions/Makefile.in +++ b/completions/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -43,6 +60,11 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -64,6 +86,12 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(bashcompdir)" DATA = $(bashcomp_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -145,6 +173,7 @@ bashcompdir = $(pkgdatadir)/completions bashcomp_DATA = a2x \ abook \ aclocal \ + acpi \ add_members \ alias \ ant \ @@ -261,6 +290,7 @@ bashcomp_DATA = a2x \ hping2 \ htop \ htpasswd \ + hwclock \ iconv \ id \ idn \ @@ -336,6 +366,8 @@ bashcomp_DATA = a2x \ mkinitrd \ mktemp \ mmsitepass \ + modinfo \ + modprobe \ monodevelop \ mount \ mount.linux \ @@ -386,6 +418,7 @@ bashcomp_DATA = a2x \ psql \ puppet \ pwck \ + pwd \ pwdx \ pwgen \ python \ @@ -427,11 +460,14 @@ bashcomp_DATA = a2x \ snownews \ sqlite3 \ ssh \ + ssh-add \ ssh-copy-id \ sshfs \ sshmitm \ sshow \ strace \ + su \ + sudo \ svk \ sync_members \ sysbench \ @@ -458,6 +494,7 @@ bashcomp_DATA = a2x \ usermod \ valgrind \ vipw \ + vmstat \ vncviewer \ vpnc \ watch \ @@ -545,6 +582,7 @@ CLEANFILES = \ ifdown \ ifstatus \ import \ + insmod.static \ javac \ javadoc \ kplayer \ @@ -573,8 +611,6 @@ CLEANFILES = \ mdecrypt \ mencoder \ mkisofs \ - modinfo \ - modprobe \ mogrify \ montage \ mplayer2 \ @@ -641,6 +677,7 @@ CLEANFILES = \ sparc-koji \ spovray \ stream \ + sudoedit \ tightvncviewer \ tracepath6 \ typeset \ @@ -702,8 +739,11 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-bashcompDATA: $(bashcomp_DATA) @$(NORMAL_INSTALL) - test -z "$(bashcompdir)" || $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bashcompdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -717,9 +757,7 @@ uninstall-bashcompDATA: @$(NORMAL_UNINSTALL) @list='$(bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bashcompdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bashcompdir)" && rm -f $$files + dir='$(DESTDIR)$(bashcompdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: @@ -774,10 +812,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -871,7 +914,7 @@ uninstall-am: uninstall-bashcompDATA uninstall-bashcompDATA -symlinks: +symlinks: $(targetdir) for file in aclocal-1.11 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) aclocal $(targetdir)/$$file ; \ @@ -982,7 +1025,7 @@ symlinks: rm -f $(targetdir)/$$file && \ $(LN_S) info $(targetdir)/$$file ; \ done - for file in modprobe modinfo ; do \ + for file in insmod.static ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) insmod $(targetdir)/$$file ; \ done @@ -1117,6 +1160,10 @@ symlinks: rm -f $(targetdir)/$$file && \ $(LN_S) ssh $(targetdir)/$$file ; \ done + for file in sudoedit ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) sudo $(targetdir)/$$file ; \ + done for file in tracepath6 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) tracepath $(targetdir)/$$file ; \ diff --git a/completions/acpi b/completions/acpi new file mode 100644 index 00000000..ccc5b635 --- /dev/null +++ b/completions/acpi @@ -0,0 +1,23 @@ +# acpi(1) completion -*- shell-script -*- + +_acpi() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-v|--version) + return + ;; + -d|--directory) + _filedir -d + return + ;; + esac + + [[ $cur == -* ]] && \ + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _acpi acpi + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/apt-get b/completions/apt-get index a6c902e1..43170c22 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -7,7 +7,7 @@ _apt_get() local special i for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download) ]]; then + if [[ ${words[i]} == @(install|remove|autoremove|purge|source|build-dep|download|changelog) ]]; then special=${words[i]} fi done @@ -65,7 +65,7 @@ _apt_get() else COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \ dist-upgrade install remove purge source build-dep \ - download \ + download changelog \ check clean autoclean autoremove' -- "$cur" ) ) fi diff --git a/completions/bzip2 b/completions/bzip2 index 6e6c68bb..1bc98288 100644 --- a/completions/bzip2 +++ b/completions/bzip2 @@ -9,6 +9,10 @@ _bzip2() -b|-h|--help|-p) return 0 ;; + -n) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) + return 0 + ;; esac if [[ "$cur" == -* ]]; then diff --git a/completions/cppcheck b/completions/cppcheck index d3c7a422..bcf937bb 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -48,6 +48,12 @@ _cppcheck() -- "$cur" ) ) return ;; + -rp|--relative-paths) + if $split; then # -rp without argument is allowed + _filedir -d + return + fi + ;; --xml-version) COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) ) return diff --git a/completions/fbgs b/completions/fbgs index 93dbe392..8058e01a 100644 --- a/completions/fbgs +++ b/completions/fbgs @@ -6,30 +6,40 @@ _fbgs() _init_completion || return case "$prev" in - -f) + -f|--font) local IFS=$'\n' COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) ) return ;; - -m) + -m|--mode) COMPREPLY=( $( compgen -W '$( sed \ -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \ /etc/fb.modes 2> /dev/null )' -- "$cur" ) ) return ;; - -d) + -d|--device) COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) ) return ;; - -t|-g|-p) + -fp|--firstpage|-lp|--lastpage|-r|--resolution|-s|--scroll|-t|\ + --timeout) + # expect integer value + COMPREPLY+=( $( compgen -W '{0..9}' ) ) + compopt -o nospace + return + ;; + -T|--vt|-p|--password|-g|--gamma) # argument required but no completions available return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p - -h -c' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '--bell --help --password -fp --firstpage + -lp --lastpage --color -l -xl -xxl --resolution --autozoom + --{,no}autoup --{,no}autodown --{,no}fitwidth --{,no}verbose + --{,no}random --vt --scroll --timeout --{,no}once --gamma --font + --device --mode' -- "$cur" ) ) [[ $COMPREPLY ]] && return fi diff --git a/completions/fbi b/completions/fbi index 9516247b..5073607a 100644 --- a/completions/fbi +++ b/completions/fbi @@ -47,7 +47,7 @@ _fbi() # FIXME: It is hard to determine correct supported extensions. # fbi can handle any format that imagemagick can plus some others - _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)' + _filedir 'bmp|gif|jp?(e)g|pcd|png|p[pgb]m|tif?(f)|webp|xpm|xwd|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' } && complete -F _fbi fbi # ex: ts=4 sw=4 et filetype=sh diff --git a/completions/feh b/completions/feh index 0f34f94b..5d66bb10 100644 --- a/completions/feh +++ b/completions/feh @@ -10,10 +10,6 @@ _feh() COMPREPLY=( $( compgen -W 'default white black' -- "$cur" ) ) return ;; - --index-dim|--index-name|--index-size) - COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) - return - ;; -f|--filelist|-o|--output|-O|--output-only|-\||--start-at) _filedir return @@ -61,7 +57,7 @@ _feh() return ;; -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\ - -y|--thumb-width|-J|--thumb-redraw) + -y|--thumb-width|-J|--thumb-redraw|--magick-timeout) # expect integer value COMPREPLY+=( $( compgen -W '{0..9}' ) ) compopt -o nospace @@ -76,11 +72,6 @@ _feh() fi return ;; - -0|--reload-button|-1|--pan-button|-2|--zoom-button|-3|--menu-button|\ - -4|--prev-button|-5|--next-button|-8|--rotate-button|-9|--blur-button) - COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) ) - return - ;; -a|--alpha) COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) ) return @@ -99,7 +90,8 @@ _feh() compopt -o nospace return ;; - -L|--customlist|--info|-D|--slideshow-delay|-~|--thumb-title|-^|--title) + -L|--customlist|--index-info|--info|-D|--slideshow-delay|-~|\ + --thumb-title|-^|--title) # argument required but no completions available return ;; @@ -113,7 +105,9 @@ _feh() [[ $COMPREPLY ]] && return fi - _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico' + # FIXME: It is hard to determine correct supported extensions. + # feh can handle any format that imagemagick can plus some others + _filedir 'xpm|tif?(f)|png|p[npgba]m|iff|?(i)lbm|jp?(e)g|jfi?(f)|gif|bmp|arg?(b)|tga|xcf|ani|ico|?(e)ps|pdf|dvi|txt|svg?(z)|cdr|[ot]tf' } && complete -F _feh feh # ex: ts=4 sw=4 et filetype=sh diff --git a/completions/gzip b/completions/gzip index 87219630..35e5f231 100644 --- a/completions/gzip +++ b/completions/gzip @@ -6,7 +6,11 @@ _gzip() _init_completion || return case $prev in - -b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version) + -b|--blocksize|-S|--suffix|-h|--help|-V|--version) + return 0 + ;; + -p|--processes) + COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) ) return 0 ;; esac diff --git a/completions/hwclock b/completions/hwclock new file mode 100644 index 00000000..e9d77aa2 --- /dev/null +++ b/completions/hwclock @@ -0,0 +1,23 @@ +# hwclock(8) completion -*- shell-script -*- + +_hwclock() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -h|--help|-V|--version|--date|--epoch) + return + ;; + -f|--rtc|--adjfile) + _filedir + ;; + esac + + [[ $cur == -* ]] && \ + COMPREPLY=( $( PATH="$PATH:/sbin" + compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) +} && +complete -F _hwclock hwclock + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/insmod b/completions/insmod index 725678e8..545f8bc5 100644 --- a/completions/insmod +++ b/completions/insmod @@ -1,34 +1,18 @@ -# Linux insmod(8), modprobe(8) and modinfo(8) completion -*- shell-script -*- -# This completes on the list of all available modules for the version of the -# kernel currently running. -# +# Linux insmod(8) completion -*- shell-script -*- + _insmod() { local cur prev words cword _init_completion || return - # behave like lsmod for modprobe -r - if [[ ${1##*/} == modprobe && "${words[1]}" == -r ]]; then - _installed_modules "$cur" - return 0 - fi - - # do filename completion if we're giving a path to a module - if [[ "$cur" == @(*/|[.~])* ]]; then + # do filename completion for first argument + if [[ $cword -eq 1 ]]; then _filedir '@(?(k)o?(.gz))' - return 0 + else # do module parameter completion + COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ + -p ${words[1]} 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) fi - - if [[ $cword -gt 1 && "${words[cword-1]}" != -* ]]; then - # do module parameter completion - COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${words[1]} | \ - cut -d: -f1 )" -- "$cur" ) ) - else - _modules $(uname -r) - fi - - return 0 } && -complete -F _insmod insmod modprobe modinfo +complete -F _insmod insmod insmod.static # ex: ts=4 sw=4 et filetype=sh diff --git a/completions/make b/completions/make index 399c4b00..1aec3489 100644 --- a/completions/make +++ b/completions/make @@ -37,6 +37,12 @@ _make() [[ $opts ]] || opts="$( _parse_usage "$1" )" COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace + elif [[ $cur == *=* ]]; then + prev=${cur%%=*} + cur=${cur#*=} + local diropt + [[ ${prev,,} == *dir?(ectory) ]] && diropt=-d + _filedir $diropt else # before we check for makefiles, see if a path was specified # with -C/--directory diff --git a/completions/man b/completions/man index a9de57c4..0c3769d5 100644 --- a/completions/man +++ b/completions/man @@ -8,10 +8,10 @@ _man() local cur prev words cword split _init_completion -s -n : || return - local i sect manpath manext mansect uname + local sect manpath manext mansect - manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))" - mansect="@([0-9lnp]|[0-9][px]|3pm)" + manext="@([0-9lnp]|[0-9][px]|man|3?(gl|pm))?(.@([gx]z|bz2|lzma|Z))" + mansect="@([0-9lnp]|[0-9][px]|3?(gl|pm))" case $prev in -C|--config-file) @@ -56,8 +56,7 @@ _man() return 0 fi - uname=$( uname -s ) - if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then + if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then manpath=$( manpath 2>/dev/null || command man --path ) else manpath=$MANPATH @@ -89,7 +88,7 @@ _man() if [[ "$prev" != $mansect ]]; then # File based completion for the rest, prepending ./ if needed # (man 1.6f needs that for man pages in current dir) - local start=${#COMPREPLY[@]} + local i start=${#COMPREPLY[@]} _filedir $manext for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]} diff --git a/completions/modinfo b/completions/modinfo new file mode 100644 index 00000000..2a359871 --- /dev/null +++ b/completions/modinfo @@ -0,0 +1,44 @@ +# Linux modinfo(8) completion -*- shell-script -*- + +_modinfo() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -F|--field) + COMPREPLY=( $( compgen -W 'alias author depends description + filename firmware license parm srcversion staging vermagic + version' -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) ) + return + ;; + -k) + _kernel_versions + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-V --version -F --field -k -0 --null -a -d + -l -p -n' -- "$cur" ) ) + return + fi + + local i version=$(uname -r) + for (( i=${#words[@]}-1; i>0; i-- )); do + if [[ ${words[i]} == -k ]]; then + version=${words[i+1]} + break + fi + done + + # do filename completion if we're giving a path to a module + if [[ "$cur" == @(*/|[.~])* ]]; then + _filedir '@(?(k)o?(.gz))' + else + _modules $version + fi +} && +complete -F _modinfo modinfo + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/modprobe b/completions/modprobe new file mode 100644 index 00000000..cf35f4b9 --- /dev/null +++ b/completions/modprobe @@ -0,0 +1,86 @@ +# Linux modprobe(8) completion -*- shell-script -*- + +_modprobe() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -C|--config) + _filedir + return + ;; + -d|--dirname|-t|--type) + _filedir -d + return + ;; + -S|--set-version) + _kernel_versions + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -b --use-blacklist -C --config -c + --showconfig --dump-modversions -d --dirname --first-time + --force-vermagic --force-modversion -f --force -i --ignore-install + --ignore-remove -l --list -n --dry-run -q --quiet -R + --resolve-alias -r --remove -S --set-version --show-depends -s + --syslog -t --type -V --version -v --verbose' -- "$cur" ) ) + return + fi + + local i mode=insert module= version=$(uname -r) + for (( i=1; i < $cword; i++ )); do + case "${words[i]}" in + -r|--remove) + mode=remove + ;; + -l|--list) + mode=list + ;; + --dump-modversions) + mode=file + ;; + -S|--set-version) + version=${words[i+1]} # -S is not $prev and not $cur + ;; + -C|--config|-d|--dirname|-t|--type) + ((i++)) # skip option and its argument + ;; + -*) + # skip all other options + ;; + *) + [ -z "$module" ] && module=${words[i]} + ;; + esac + done + + case $mode in + remove) + _installed_modules "$cur" + ;; + list) + # no completion available + ;; + file) + _filedir + ;; + insert) + # do filename completion if we're giving a path to a module + if [[ "$cur" == @(*/|[.~])* ]]; then + _filedir '@(?(k)o?(.gz))' + elif [[ -n "$module" ]]; then + # do module parameter completion + COMPREPLY=( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ + -p "$module" 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) + else + _modules $version + fi + ;; + esac +} && +complete -F _modprobe modprobe + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/mount.linux b/completions/mount.linux index 91594449..20a3d6a0 100644 --- a/completions/mount.linux +++ b/completions/mount.linux @@ -17,9 +17,9 @@ _mount() fi COMPREPLY=( $(compgen -W 'auto adfs affs autofs btrfs cifs coda cramfs debugfs devpts efs ext2 ext3 ext4 fuse hfs hfsplus hpfs - iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc qnx4 - ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs - umsdos usbfs vfat xfs' -- "$cur") ) + iso9660 jffs2 jfs minix msdos ncpfs nfs nfs4 ntfs ntfs-3g proc + qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf + ufs umsdos usbfs vfat xfs' -- "$cur") ) _fstypes $split && COMPREPLY=( ${COMPREPLY[@]/#/$prev,} ) return @@ -91,7 +91,7 @@ _mount() COMPREPLY+=( $(compgen -W 'degraded subvol= subvolid= device= nodatasum nodatacow nobarrier max_inline= alloc_start= thread_pool= compress= compress-force= ssd noacl notreelog - flushoncommit metadata_ratio= space_cache clear_cache + flushoncommit metadata_ratio= {,no}space_cache clear_cache user_subvol_rm_allowed autodefrag inode_cache' -- "$cur") ) ;;& cifs|auto) @@ -99,8 +99,8 @@ _mount() force{u,g}id port= servern= netbiosname= {file,dir}_mode= ip= domain= guest iocharset ro rw {,no}setuids {,no,dyn}perm directio {,no}mapchars {,no}intr hard soft noacl nocase sec= - nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size=' \ - -- "$cur") ) + nobrl sfu {,no}serverino nounix nouser_xattr {r,w}size= + rwpidforward backup{u,g}id' -- "$cur") ) ;;& ext[2-4]|auto) COMPREPLY+=( $(compgen -W '{,no}acl bsddf minixdf check= debug @@ -134,6 +134,9 @@ _mount() mode= unhide block= conv= cruft session= sbsector= iocharset= utf8' -- "$cur") ) ;;& + jffs2|auto) + COMPREPLY+=( $(compgen -W 'compr=' -- "$cur") ) + ;;& jfs|auto) COMPREPLY+=( $(compgen -W 'iocharset= resize= {,no}integrity errors= {,no,usr,grp}quota' -- "$cur") ) diff --git a/completions/mplayer b/completions/mplayer index be852a5a..ba8e3e90 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -11,7 +11,7 @@ _mplayer_options_list() _mplayer() { local cur prev words cword - _init_completion || return + _init_completion -n : || return local cmd=${words[0]} i j k=0 @@ -110,7 +110,7 @@ _mplayer() -vi|-vid|-vivo|-ffactor|-sid|-slang|-spualign|-spuaa|-spugauss| \ -vobsubid|-delay|-bpp|-brightness|-contrast|-dfbopts|-display| \ -fbmode|-geometry|-guiwid|-hue|-icelayer|-screen[wh]|-wid| \ - -monitoraspect|-monitor-dotclock|-monitor-[hv]freq|-panscan| \ + -monitor-dotclock|-monitor-[hv]freq|-panscan| \ -saturation|-xineramascreen|-zrcrop|-zrnorm|-zrquality| \ -zr[xy]doff|-zr[vh]dec|-aspect|-pp|-x|-y|-xy|-z|-stereo| \ -audio-density|-audio-delay|-audio-preload|-endpos|-osdlevel| \ @@ -122,6 +122,11 @@ _mplayer() -subfont-osd-text) return 0 ;; + -monitoraspect) + COMPREPLY=( $( compgen -W '4:3 16:9 16:10' -- "$cur" ) ) + __ltrim_colon_completions "$cur" + return 0 + ;; -lavdopts) COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur" ) ) return 0 @@ -238,6 +243,17 @@ _mplayer() COMPREPLY=( $( compgen -W 'all gui system user' -- "$cur" ) ) return 0 ;; + -*) + # Assume arg is required for everything else except options + # for which -list-options says Type is Flag or Print. + $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null \ + | while read -r i j k; do + if [[ $i == ${prev#-} ]]; then + [[ ${j,,} != @(flag|print) ]] && return 1 + break + fi + done || return 0 + ;; esac case $cur in diff --git a/completions/pwd b/completions/pwd new file mode 100644 index 00000000..8818b49d --- /dev/null +++ b/completions/pwd @@ -0,0 +1,22 @@ +# pwd(1) completion -*- shell-script -*- + +_pwd() +{ + local cur prev words cword + _init_completion || return + + case $prev in + --help|--version) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY ]] || \ + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi +} && +complete -F _pwd pwd + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/ri b/completions/ri index 43f6408a..62a9b709 100644 --- a/completions/ri +++ b/completions/ri @@ -1,7 +1,7 @@ # ri completion for Ruby documentation -*- shell-script -*- # by Ian Macdonald <ian@caliban.org> -ri_get_methods() +_ri_get_methods() { local regex @@ -56,7 +56,7 @@ _ri() method=${cur#*$separator} classes=( $class ) prefix="-P $class$separator" - ri_get_methods + _ri_get_methods return 0 fi @@ -82,7 +82,7 @@ _ri() # we're completing on methods method=$cur - ri_get_methods + _ri_get_methods } && complete -F _ri ri diff --git a/completions/rmmod b/completions/rmmod index 3b266067..20d3bfce 100644 --- a/completions/rmmod +++ b/completions/rmmod @@ -6,6 +6,17 @@ _rmmod() local cur prev words cword _init_completion || return + case $prev in + -h|--help|-V|--version) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + return + fi + _installed_modules "$cur" return 0 } && diff --git a/completions/sbopkg b/completions/sbopkg index 0c812faa..598cb8cf 100644 --- a/completions/sbopkg +++ b/completions/sbopkg @@ -1,4 +1,4 @@ -# bash completion for sbopkg tool -*- shell-script -*- +# bash completion for sbopkg(8) -*- shell-script -*- _sbopkg() { @@ -6,9 +6,8 @@ _sbopkg() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l -o - -P -p -q -R -r -s -u -V -v' -- "$cur" ) ) - return + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + [[ $COMPREPLY ]] && return fi case "$prev" in @@ -45,10 +44,7 @@ _sbopkg() fi done - if [[ ! -r "$config" ]]; then - return - fi - + [[ -r "$config" ]] || return . $config for (( i=1; i<${#words[@]}; i++ )); do @@ -62,10 +58,8 @@ _sbopkg() ;; esac done + [[ -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]] || return - if [[ ! -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]]; then - return - fi COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\ $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ) $( cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur" ) ) diff --git a/completions/slackpkg b/completions/slackpkg index b4223e71..1be2f956 100644 --- a/completions/slackpkg +++ b/completions/slackpkg @@ -1,4 +1,4 @@ -# bash completion for slackpkg tool -*- shell-script -*- +# bash completion for slackpkg(8) -*- shell-script -*- # options list is based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)` _slackpkg() @@ -43,9 +43,7 @@ _slackpkg() local confdir="/etc/slackpkg" local config="$confdir/slackpkg.conf" - if [[ ! -r "$config" ]]; then - return - fi + [[ -r "$config" ]] || return . "$config" local i action diff --git a/completions/slapt-get b/completions/slapt-get index 02f007ec..ff42660a 100644 --- a/completions/slapt-get +++ b/completions/slapt-get @@ -1,4 +1,4 @@ -# slapt-get completion -*- shell-script -*- +# slapt-get(8) completion -*- shell-script -*- _slapt_get() { @@ -48,9 +48,7 @@ _slapt_get() break fi done - if [[ ! -r "$config" ]]; then - return - fi + [[ -r "$config" ]] || return case $t in all) # --show diff --git a/completions/slapt-src b/completions/slapt-src index 6234eaa8..94ddb892 100644 --- a/completions/slapt-src +++ b/completions/slapt-src @@ -1,4 +1,4 @@ -# slapt-src completion -*- shell-script -*- +# slapt-src(8) completion -*- shell-script -*- _slapt_src() { @@ -42,9 +42,7 @@ _slapt_src() break fi done - if [[ ! -r "$config" ]]; then - return - fi + [[ -r "$config" ]] || return if [[ "$cur" == *:* ]]; then local name=${cur%:*} diff --git a/completions/ssh b/completions/ssh index a18ba494..5cd03b97 100644 --- a/completions/ssh +++ b/completions/ssh @@ -266,13 +266,13 @@ _scp_remote_files() if [[ $1 == -d ]]; then # escape problematic characters; remove non-dirs files=$( ssh -o 'Batchmode yes' $userhost \ - command ls -aF1d "$path*" 2>/dev/null | \ + command ls -aF1dL "$path*" 2>/dev/null | \ sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' ) else # escape problematic characters; remove executables, aliases, pipes # and sockets; add space at end of file names files=$( ssh -o 'Batchmode yes' $userhost \ - command ls -aF1d "$path*" 2>/dev/null | \ + command ls -aF1dL "$path*" 2>/dev/null | \ sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' ) fi @@ -294,10 +294,10 @@ _scp_local_files() fi if $dirsonly ; then - COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \ + COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") ) else - COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \ + COMPREPLY+=( $( command ls -aF1dL $cur* 2>/dev/null | \ sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \ -e 's/[^\/]$/& /g' -e "s/^/$1/") ) fi diff --git a/completions/ssh-add b/completions/ssh-add new file mode 100644 index 00000000..1d563688 --- /dev/null +++ b/completions/ssh-add @@ -0,0 +1,23 @@ +# ssh-add(1) completion -*- shell-script -*- + +_ssh_add() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -t|-s|-e) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -? )' -- "$cur" ) ) + return + fi + + _filedir +} && +complete -F _ssh_add ssh-add + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/su b/completions/su new file mode 100644 index 00000000..fccca47b --- /dev/null +++ b/completions/su @@ -0,0 +1,37 @@ +# bash completion for su(1) -*- shell-script -*- + +if [[ $OSTYPE != *linux* ]]; then + complete -u su # default completion + return +fi + +_su() # linux-specific completion +{ + local cur prev words cword split + _init_completion -s || return + + case "$prev" in + -s|--shell) + _shells + return + ;; + -c|--command|--session-command) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $( compgen -d -c -- "$cur" ) ) + return + ;; + esac + + $split && return + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return + fi + + COMPREPLY=( $( compgen -u -- "$cur" ) ) +} && complete -F _su su + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/sudo b/completions/sudo new file mode 100644 index 00000000..b13b7313 --- /dev/null +++ b/completions/sudo @@ -0,0 +1,51 @@ +# bash completion for sudo(8) -*- shell-script -*- + +_sudo() +{ + local cur prev words cword + _init_completion || return + + local i mode=normal + [[ $1 == *sudoedit ]] && mode=edit + + [[ $mode == normal ]] && + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin + local root_command=${COMP_WORDS[i]} + _command_offset $i + return + fi + if [[ ${COMP_WORDS[i]} == -e ]]; then + mode=edit + break + fi + [[ ${COMP_WORDS[i]} == -@(u|U|g|C|p) ]] && ((i++)) + done + + case "$prev" in + -u|-U) + COMPREPLY=( $( compgen -u -- "$cur" ) ) + return + ;; + -g) + COMPREPLY=( $( compgen -g -- "$cur" ) ) + return + ;; + -C|-p) + # argument required but no completions available + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A -b -C -E -e -g -H -h -i -K -k -L -l -ll + -n -P -p -S -s -U -u -V -v' -- "$cur" ) ) + return + fi + if [[ $mode == edit ]]; then + _filedir + fi +} && complete -F _sudo sudo sudoedit + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/vmstat b/completions/vmstat new file mode 100644 index 00000000..1d3ebb32 --- /dev/null +++ b/completions/vmstat @@ -0,0 +1,27 @@ +# vmstat(8) completion -*- shell-script -*- + +_vmstat() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -V|-c|-M|-N|-n|-w|-p) + return + ;; + -S) + [[ $OSTYPE == *linux* ]] && \ + COMPREPLY=( $( compgen -W 'k K m M' -- "$cur" ) ) + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY ]] || \ + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + fi +} && +complete -F _vmstat vmstat + +# ex: ts=4 sw=4 et filetype=sh diff --git a/completions/xmllint b/completions/xmllint index c29c52d8..928a5b67 100644 --- a/completions/xmllint +++ b/completions/xmllint @@ -38,7 +38,7 @@ _xmllint() return 0 fi - _filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp|tld)?(.gz)' + _filedir '@(*ml|htm|svg?(z)|xs[dl]|rng|wsdl|jnlp|tld)?(.gz)' } && complete -F _xmllint xmllint |