summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/TODO7
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac13
-rw-r--r--shell-completion/Makemodule.am248
-rw-r--r--shell-completion/addpart25
-rw-r--r--shell-completion/blkdiscard25
-rw-r--r--shell-completion/blkid64
-rw-r--r--shell-completion/blockdev44
-rw-r--r--shell-completion/cal15
-rw-r--r--shell-completion/cfdisk35
-rw-r--r--shell-completion/chcpu44
-rw-r--r--shell-completion/chfn16
-rw-r--r--shell-completion/chrt32
-rw-r--r--shell-completion/chsh23
-rw-r--r--shell-completion/col24
-rw-r--r--shell-completion/colcrt20
-rw-r--r--shell-completion/colrm23
-rw-r--r--shell-completion/column34
-rw-r--r--shell-completion/ctrlaltdel11
-rw-r--r--shell-completion/cytune37
-rw-r--r--shell-completion/delpart23
-rw-r--r--shell-completion/dmesg53
-rw-r--r--shell-completion/eject61
-rw-r--r--shell-completion/fallocate24
-rw-r--r--shell-completion/fdformat11
-rw-r--r--shell-completion/fdisk47
-rw-r--r--shell-completion/findmnt121
-rw-r--r--shell-completion/flock42
-rw-r--r--shell-completion/fsck36
-rw-r--r--shell-completion/fsck.cramfs18
-rw-r--r--shell-completion/fsck.minix11
-rw-r--r--shell-completion/fsfreeze18
-rw-r--r--shell-completion/fstrim25
-rw-r--r--shell-completion/getopt34
-rw-r--r--shell-completion/hexdump32
-rw-r--r--shell-completion/hwclock53
-rw-r--r--shell-completion/ionice34
-rw-r--r--shell-completion/ipcrm59
-rw-r--r--shell-completion/ipcs30
-rw-r--r--shell-completion/isosize17
-rw-r--r--shell-completion/last38
-rw-r--r--shell-completion/ldattach54
-rw-r--r--shell-completion/logger43
-rw-r--r--shell-completion/look24
-rw-r--r--shell-completion/losetup64
-rw-r--r--shell-completion/lsblk65
-rw-r--r--shell-completion/lscpu45
-rw-r--r--shell-completion/lslocks43
-rw-r--r--shell-completion/mcookie23
-rw-r--r--shell-completion/mesg16
-rw-r--r--shell-completion/mkfs25
-rw-r--r--shell-completion/mkfs.bfs28
-rw-r--r--shell-completion/mkfs.cramfs40
-rw-r--r--shell-completion/mkfs.minix33
-rw-r--r--shell-completion/mkswap35
-rw-r--r--shell-completion/more22
-rw-r--r--shell-completion/mountpoint24
-rw-r--r--shell-completion/namei17
-rw-r--r--shell-completion/newgrp16
-rw-r--r--shell-completion/nsenter44
-rw-r--r--shell-completion/partx38
-rw-r--r--shell-completion/pg29
-rw-r--r--shell-completion/pivot_root14
-rw-r--r--shell-completion/prlimit60
-rw-r--r--shell-completion/raw17
-rw-r--r--shell-completion/readprofile33
-rw-r--r--shell-completion/rename27
-rw-r--r--shell-completion/renice38
-rw-r--r--shell-completion/resizepart25
-rw-r--r--shell-completion/rev17
-rw-r--r--shell-completion/rtcwake40
-rw-r--r--shell-completion/script36
-rw-r--r--shell-completion/scriptreplay28
-rw-r--r--shell-completion/setarch42
-rw-r--r--shell-completion/setpriv82
-rw-r--r--shell-completion/setsid17
-rw-r--r--shell-completion/setterm113
-rw-r--r--shell-completion/sfdisk79
-rw-r--r--shell-completion/su44
-rw-r--r--shell-completion/swaplabel28
-rw-r--r--shell-completion/swapon48
-rw-r--r--shell-completion/tailf24
-rw-r--r--shell-completion/taskset38
-rw-r--r--shell-completion/tunelp48
-rw-r--r--shell-completion/ul29
-rw-r--r--shell-completion/unshare24
-rw-r--r--shell-completion/utmpdump17
-rw-r--r--shell-completion/uuidd33
-rw-r--r--shell-completion/uuidgen15
-rw-r--r--shell-completion/wall24
-rw-r--r--shell-completion/wdctl60
-rw-r--r--shell-completion/whereis24
-rw-r--r--shell-completion/wipefs32
-rw-r--r--shell-completion/write22
94 files changed, 3435 insertions, 3 deletions
diff --git a/Documentation/TODO b/Documentation/TODO
index b4139d336..9596ccecd 100644
--- a/Documentation/TODO
+++ b/Documentation/TODO
@@ -10,9 +10,10 @@ hwlock
bash completion
---------------
- - file per command in shel-completion/bash/
- - use $(pkg-config --variable=completionsdir bash-completion)/util-linux/
- as a destination install directory
+- Optional argument handling requires user to press backspace to get
+ argument completetion.
+- Comma separated value, e.g., --output 'value1,value2', are not
+ completed for users.
wipefs
------
diff --git a/Makefile.am b/Makefile.am
index 3afcad16d..b963af941 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,8 @@ ul_libfdisk_incdir = $(top_srcdir)/libfdisk/src
pkgconfigdir = $(usrlib_execdir)/pkgconfig
+bashcompletiondir = @bashcompletiondir@
+
dist_noinst_HEADERS =
noinst_PROGRAMS =
noinst_LTLIBRARIES =
@@ -87,6 +89,8 @@ include misc-utils/Makemodule.am
include disk-utils/Makemodule.am
include fdisks/Makemodule.am
+include shell-completion/Makemodule.am
+
include tests/Makemodule.am
#
@@ -158,6 +162,7 @@ checkdecl:
ENABLE_ALL = --enable-static-programs --enable-most-builds
DISTCHECK_CONFIGURE_FLAGS = --disable-use-tty-group \
--disable-silent-rules $(ENABLE_ALL) \
+ --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
diff --git a/configure.ac b/configure.ac
index 92a5a3b12..cd4e826a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1342,6 +1342,18 @@ fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
+AC_ARG_WITH([bashcompletiondir],
+ AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
+ [],
+ [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
+ with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
+ ], [
+ with_bashcompletiondir=${datadir}/bash-completion/completions
+ ])
+])
+AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
+
+
AC_ARG_ENABLE([pg-bell],
AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
[], enable_pg_bell=yes
@@ -1463,6 +1475,7 @@ AC_MSG_RESULT([
suid cflags: ${SUID_CFLAGS}
ldflags: ${LDFLAGS}
suid ldflags: ${SUID_LDFLAGS}
+ Bash completions dir: ${with_bashcompletiondir}
warnings:
diff --git a/shell-completion/Makemodule.am b/shell-completion/Makemodule.am
new file mode 100644
index 000000000..b657604b2
--- /dev/null
+++ b/shell-completion/Makemodule.am
@@ -0,0 +1,248 @@
+dist_bashcompletion_DATA = \
+ shell-completion/blkid \
+ shell-completion/cal \
+ shell-completion/col \
+ shell-completion/colcrt \
+ shell-completion/colrm \
+ shell-completion/column \
+ shell-completion/findmnt \
+ shell-completion/flock \
+ shell-completion/fsck.minix \
+ shell-completion/getopt \
+ shell-completion/hexdump \
+ shell-completion/ipcrm \
+ shell-completion/ipcs \
+ shell-completion/isosize \
+ shell-completion/logger \
+ shell-completion/look \
+ shell-completion/mcookie \
+ shell-completion/mkfs \
+ shell-completion/mkfs.bfs \
+ shell-completion/mkfs.minix \
+ shell-completion/mkswap \
+ shell-completion/namei \
+ shell-completion/prlimit \
+ shell-completion/readprofile \
+ shell-completion/renice \
+ shell-completion/rev \
+ shell-completion/script \
+ shell-completion/scriptreplay \
+ shell-completion/setsid \
+ shell-completion/tailf \
+ shell-completion/wall \
+ shell-completion/whereis \
+ shell-completion/wipefs
+
+# disk-utils...
+if BUILD_CRAMFS
+dist_bashcompletion_DATA += \
+ shell-completion/fsck.cramfs \
+ shell-completion/mkfs.cramfs
+endif
+if BUILD_FSCK
+dist_bashcompletion_DATA += \
+ shell-completion/fsck
+endif
+if BUILD_PARTX
+dist_bashcompletion_DATA += \
+ shell-completion/addpart \
+ shell-completion/delpart \
+ shell-completion/resizepart \
+ shell-completion/partx
+endif
+if BUILD_RAW
+dist_bashcompletion_DATA += \
+ shell-completion/raw
+endif
+if BUILD_SWAPLABEL
+dist_bashcompletion_DATA += \
+ shell-completion/swaplabel
+endif
+if LINUX
+dist_bashcompletion_DATA += \
+ shell-completion/blockdev \
+ shell-completion/fdformat
+endif
+# ...disk-utils
+
+# fdisks...
+if !ARCH_M68K
+dist_bashcompletion_DATA += \
+ shell-completion/fdisk
+if !ARCH_SPARC
+dist_bashcompletion_DATA += \
+ shell-completion/sfdisk
+if BUILD_CFDISK
+dist_bashcompletion_DATA += \
+ shell-completion/cfdisk
+endif
+endif # !ARCH_SPARC
+endif # !ARCH_M68
+# ...fdisks
+
+# login-utils...
+if BUILD_CHFN_CHSH
+dist_bashcompletion_DATA += \
+ shell-completion/chfn \
+ shell-completion/chsh
+endif
+if BUILD_LAST
+dist_bashcompletion_DATA += \
+ shell-completion/last
+endif
+if BUILD_NEWGRP
+dist_bashcompletion_DATA += \
+ shell-completion/newgrp
+endif
+if BUILD_SU
+dist_bashcompletion_DATA += \
+ shell-completion/su
+endif
+if BUILD_UTMPDUMP
+dist_bashcompletion_DATA += \
+ shell-completion/utmpdump
+endif
+# ...login-utils
+
+# misc-utils...
+if BUILD_LIBUUID
+dist_bashcompletion_DATA += \
+ shell-completion/uuidgen
+endif
+if BUILD_UUIDD
+dist_bashcompletion_DATA += \
+ shell-completion/uuidd
+endif
+if BUILD_LSBLK
+dist_bashcompletion_DATA += \
+ shell-completion/lsblk
+endif
+if BUILD_LSLOCKS
+dist_bashcompletion_DATA += \
+ shell-completion/lslocks
+endif
+if BUILD_RENAME
+dist_bashcompletion_DATA += \
+ shell-completion/rename
+endif
+# ...misc-utils
+
+# schedutils...
+if BUILD_SCHEDUTILS
+dist_bashcompletion_DATA += \
+ shell-completion/chrt
+if BUILD_IONICE
+dist_bashcompletion_DATA += \
+ shell-completion/ionice
+endif
+if BUILD_TASKSET
+dist_bashcompletion_DATA += \
+ shell-completion/taskset
+endif
+endif # BUILD_SCHEDUTILS
+# ...schedutils
+
+# sys-utils...
+if BUILD_CHCPU
+dist_bashcompletion_DATA += \
+ shell-completion/chcpu
+endif
+if BUILD_EJECT
+dist_bashcompletion_DATA += \
+ shell-completion/eject
+endif
+if BUILD_FALLOCATE
+dist_bashcompletion_DATA += \
+ shell-completion/fallocate
+endif
+if BUILD_HWCLOCK
+dist_bashcompletion_DATA += \
+ shell-completion/hwclock
+endif
+if BUILD_TUNELP
+dist_bashcompletion_DATA += \
+ shell-completion/tunelp
+endif
+if BUILD_LSCPU
+dist_bashcompletion_DATA += \
+ shell-completion/lscpu
+endif
+if BUILD_LOSETUP
+dist_bashcompletion_DATA += \
+ shell-completion/losetup
+endif
+if BUILD_MOUNTPOINT
+dist_bashcompletion_DATA += \
+ shell-completion/mountpoint
+endif
+if BUILD_NSENTER
+dist_bashcompletion_DATA += \
+ shell-completion/nsenter
+endif
+if BUILD_PIVOT_ROOT
+dist_bashcompletion_DATA += \
+ shell-completion/pivot_root
+endif
+if BUILD_SETPRIV
+dist_bashcompletion_DATA += \
+ shell-completion/setpriv
+endif
+if BUILD_SWAPON
+dist_bashcompletion_DATA += \
+ shell-completion/swapon
+endif
+if BUILD_UNSHARE
+dist_bashcompletion_DATA += \
+ shell-completion/unshare
+endif
+if BUILD_WDCTL
+dist_bashcompletion_DATA += \
+ shell-completion/wdctl
+endif
+if LINUX
+dist_bashcompletion_DATA += \
+ shell-completion/blkdiscard \
+ shell-completion/ctrlaltdel \
+ shell-completion/cytune \
+ shell-completion/dmesg \
+ shell-completion/fsfreeze \
+ shell-completion/fstrim \
+ shell-completion/ldattach \
+ shell-completion/rtcwake \
+ shell-completion/setarch
+endif
+# ...sys-utils
+
+# term-utils...
+if BUILD_MESG
+dist_bashcompletion_DATA += \
+ shell-completion/mesg
+endif
+if BUILD_WALL
+dist_bashcompletion_DATA += \
+ shell-completion/wall
+endif
+if BUILD_WRITE
+dist_bashcompletion_DATA += \
+ shell-completion/write
+endif
+if LINUX
+dist_bashcompletion_DATA += \
+ shell-completion/setterm
+endif
+# ...term-utils
+
+# text-utils...
+if BUILD_MORE
+dist_bashcompletion_DATA += \
+ shell-completion/more
+endif
+if BUILD_PG
+dist_bashcompletion_DATA += \
+ shell-completion/pg
+endif
+if BUILD_UL
+dist_bashcompletion_DATA += \
+ shell-completion/ul
+endif
+# ...text-utils
diff --git a/shell-completion/addpart b/shell-completion/addpart
new file mode 100644
index 000000000..b6f119a75
--- /dev/null
+++ b/shell-completion/addpart
@@ -0,0 +1,25 @@
+_addpart_module()
+{
+ local cur prev
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1)
+ local DEVS=''
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-h --help -V --version $DEVS"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ # FIXME: how to determine next free partition number
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "start" -- $cur) )
+ ;;
+ 4)
+ COMPREPLY=( $(compgen -W "length" -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _addpart_module addpart
diff --git a/shell-completion/blkdiscard b/shell-completion/blkdiscard
new file mode 100644
index 000000000..757480c08
--- /dev/null
+++ b/shell-completion/blkdiscard
@@ -0,0 +1,25 @@
+_blkdiscard_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-o'|'--offset'|'-l'|'--length')
+ COMPREPLY=( $(compgen -W "num" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-o --offset -l --length -s --secure -v --verbose -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _blkdiscard_module blkdiscard
diff --git a/shell-completion/blkid b/shell-completion/blkid
new file mode 100644
index 000000000..14222a44f
--- /dev/null
+++ b/shell-completion/blkid
@@ -0,0 +1,64 @@
+_blkid_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-o')
+ COMPREPLY=( $(compgen -W "value device export full" -- $cur) )
+ return 0
+ ;;
+ '-s')
+ COMPREPLY=( $(compgen -W "tag" -- $cur) )
+ return 0
+ ;;
+ '-t')
+ COMPREPLY=( $(compgen -W "token" -- $cur) )
+ return 0
+ ;;
+ '-L')
+ COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) )
+ return 0
+ ;;
+ '-U')
+ COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) )
+ return 0
+ ;;
+ '-s')
+ COMPREPLY=( $(compgen -W "size" -- $cur) )
+ return 0
+ ;;
+ '-O')
+ COMPREPLY=( $(compgen -W "offset" -- $cur) )
+ return 0
+ ;;
+ '-u')
+ COMPREPLY=( $(compgen -W "filesystem raid crypto other nofilesystem noraid nocrypto noother" -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "$(awk '{print $NF}' /proc/filesystems)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c -d -h -g -o -k -s -t -l -L -U -V -p -i -S -O -u -n"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'part' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _blkid_module blkid
diff --git a/shell-completion/blockdev b/shell-completion/blockdev
new file mode 100644
index 000000000..ce986cb45
--- /dev/null
+++ b/shell-completion/blockdev
@@ -0,0 +1,44 @@
+_blockdev_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-h -V -q
+ --report
+ --getsz
+ --setro
+ --setrw
+ --getro
+ --getdiscardzeroes
+ --getss
+ --getpbsz
+ --getiomin
+ --getioopt
+ --getalignoff
+ --getmaxsect
+ --getbsz
+ --setbsz
+ --getsize64
+ --setra
+ --getra
+ --setfra
+ --getfra
+ --flushbufs
+ --rereadpt
+ $DEVS"
+ case $prev in
+ '--setbsz')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ '--setbsz'|'--setfra')
+ COMPREPLY=( $(compgen -W "sectors" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _blockdev_module blockdev
diff --git a/shell-completion/cal b/shell-completion/cal
new file mode 100644
index 000000000..d50c8bbca
--- /dev/null
+++ b/shell-completion/cal
@@ -0,0 +1,15 @@
+_cal_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-1 --one -3 --three -s --sunday -m --monday -j --julian -y --year -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _cal_module cal
diff --git a/shell-completion/cfdisk b/shell-completion/cfdisk
new file mode 100644
index 000000000..4be5186c4
--- /dev/null
+++ b/shell-completion/cfdisk
@@ -0,0 +1,35 @@
+_cfdisk_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c')
+ COMPREPLY=( $(compgen -W "cylinders" -- $cur) )
+ return 0
+ ;;
+ '-h')
+ COMPREPLY=( $(compgen -W "heads" -- $cur) )
+ return 0
+ ;;
+ '-s')
+ COMPREPLY=( $(compgen -W "sectors" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a -z -c -h -s"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _cfdisk_module cfdisk
diff --git a/shell-completion/chcpu b/shell-completion/chcpu
new file mode 100644
index 000000000..19386e24c
--- /dev/null
+++ b/shell-completion/chcpu
@@ -0,0 +1,44 @@
+_chcpu_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-e'|'--enable')
+ local CPULIST
+ # FIXME: will propose only binding to a cpu.
+ # Maybe this should add comma, and continue?
+ CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline)
+ COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) )
+ return 0
+ ;;
+ '-d'|'--disable')
+ local CPULIST
+ # FIXME: will propose only binding to a cpu.
+ # Maybe this should add comma, and continue?
+ CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
+ COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) )
+ return 0
+ ;;
+ '-c'|'--configure'|'-g'|'--deconfigure')
+ COMPREPLY=( $(compgen -W "cpu-list" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--dispatch')
+ COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-h --help
+ -e --enable
+ -d --disable
+ -c --configure
+ -g --deconfigure
+ -p --dispatch
+ -r --rescan
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _chcpu_module chcpu
diff --git a/shell-completion/chfn b/shell-completion/chfn
new file mode 100644
index 000000000..a8eaee5ae
--- /dev/null
+++ b/shell-completion/chfn
@@ -0,0 +1,16 @@
+_chfn_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-f --full-name -o --office -p --office-phone -h --home-phone -u --help -v --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _chfn_module chfn
diff --git a/shell-completion/chrt b/shell-completion/chrt
new file mode 100644
index 000000000..b85775a4f
--- /dev/null
+++ b/shell-completion/chrt
@@ -0,0 +1,32 @@
+_chrt_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ # FIXME: -p is ambiguous, it takes either pid or priority as an
+ # argument depending on whether user wanted to get or set the
+ # values. Perhaps the command interface should be reconsidered.
+ case $cur in
+ -*)
+ OPTS="-b --batch
+ -f --fifo
+ -i --idle
+ -o --other
+ -r --rr
+ -R --reset-on-fork
+ -a --all-tasks
+ -h --help
+ -m --max
+ -p --pid
+ -v --verbose
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local PIDS
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+}
+complete -F _chrt_module chrt
diff --git a/shell-completion/chsh b/shell-completion/chsh
new file mode 100644
index 000000000..c0a194cf3
--- /dev/null
+++ b/shell-completion/chsh
@@ -0,0 +1,23 @@
+_chsh_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-s'|'--shell')
+ COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-s --shell -l --list-shells -V --version -u --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _chsh_module chsh
diff --git a/shell-completion/col b/shell-completion/col
new file mode 100644
index 000000000..9ad3a6732
--- /dev/null
+++ b/shell-completion/col
@@ -0,0 +1,24 @@
+_col_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-l'|'--lines')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-b --no-backspaces
+ -f --fine
+ -p --pass
+ -h --tabs
+ -x --spaces
+ -l --lines
+ -V --version
+ -H --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _col_module col
diff --git a/shell-completion/colcrt b/shell-completion/colcrt
new file mode 100644
index 000000000..628416e6d
--- /dev/null
+++ b/shell-completion/colcrt
@@ -0,0 +1,20 @@
+_colcrt_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS=" - --no-underlining
+ -2 --half-lines
+ -V --version
+ -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _colcrt_module colcrt
diff --git a/shell-completion/colrm b/shell-completion/colrm
new file mode 100644
index 000000000..aa57c02ab
--- /dev/null
+++ b/shell-completion/colrm
@@ -0,0 +1,23 @@
+_colrm_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $COMP_CWORD in
+ 1)
+ COMPREPLY=( $(compgen -W "startcol" -- $cur) )
+ ;;
+ 2)
+ COMPREPLY=( $(compgen -W "endcol" -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _colrm_module colrm
diff --git a/shell-completion/column b/shell-completion/column
new file mode 100644
index 000000000..94e1a5117
--- /dev/null
+++ b/shell-completion/column
@@ -0,0 +1,34 @@
+_column_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c'|'--columns')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-s'|'--separator'|'-o'|'--output-separator')
+ COMPREPLY=( $(compgen -W "string" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c --columns
+ -t --table
+ -s --separator
+ -o --output-separator
+ -x --fillrows
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _column_module column
diff --git a/shell-completion/ctrlaltdel b/shell-completion/ctrlaltdel
new file mode 100644
index 000000000..e72575223
--- /dev/null
+++ b/shell-completion/ctrlaltdel
@@ -0,0 +1,11 @@
+_ctrlaltdel_module()
+{
+ local cur
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ COMPREPLY=()
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $(compgen -W "hard soft" -- $cur) )
+ fi
+ return 0
+}
+complete -F _ctrlaltdel_module ctrlaltdel
diff --git a/shell-completion/cytune b/shell-completion/cytune
new file mode 100644
index 000000000..9a90d34e2
--- /dev/null
+++ b/shell-completion/cytune
@@ -0,0 +1,37 @@
+_cytune_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-s'|'--set-threshold'|'-S'|'--set-default-threshold'|'-t'|'--set-flush'|'-T'|'--set-default-flush')
+ COMPREPLY=( $(compgen -W "num" -- $cur) )
+ return 0
+ ;;
+ '-i'|'--interval')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-s --set-threshold
+ -g --get-threshold
+ -S --set-default-threshold
+ -t --set-flush
+ -G --get-glush
+ -T --set-default-flush
+ -q --stats
+ -i --interval
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) )
+ return 0
+}
+complete -F _cytune_module cytune
diff --git a/shell-completion/delpart b/shell-completion/delpart
new file mode 100644
index 000000000..e3ee40629
--- /dev/null
+++ b/shell-completion/delpart
@@ -0,0 +1,23 @@
+_delpart_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $COMP_CWORD in
+ 1)
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ OPTS="-h --help -V --version $DEVICES"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _delpart_module delpart
diff --git a/shell-completion/dmesg b/shell-completion/dmesg
new file mode 100644
index 000000000..18ee59fc6
--- /dev/null
+++ b/shell-completion/dmesg
@@ -0,0 +1,53 @@
+_dmesg_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-F'|'--file')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-f'|'--facility')
+ COMPREPLY=( $(compgen -W "kern user mail daemon auth syslog lpr news" -- $cur) )
+ return 0
+ ;;
+ '-l'|'--level'|'-n'|'--console-level')
+ COMPREPLY=( $(compgen -W "emerg alert crit err warn notice info debug" -- $cur) )
+ return 0
+ ;;
+ '-s'|'--buffer-size')
+ COMPREPLY=( $(compgen -W "size" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-C --clear
+ -c --read-clear
+ -D --console-off
+ -d --show-delta
+ -e --reltime
+ -E --console-on
+ -F --file
+ -f --facility
+ -H --human
+ -k --kernel
+ -L --color
+ -l --level
+ -n --console-level
+ -P --nopager
+ -r --raw
+ -S --syslog
+ -s --buffer-size
+ -T --ctime
+ -t --notime
+ -u --userspace
+ -w --follow
+ -x --decode
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _dmesg_module dmesg
diff --git a/shell-completion/eject b/shell-completion/eject
new file mode 100644
index 000000000..b767e8198
--- /dev/null
+++ b/shell-completion/eject
@@ -0,0 +1,61 @@
+_eject_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-a'|'--auto'|'-i'|'--manualeject')
+ COMPREPLY=( $(compgen -W "off on" -- $cur) )
+ return 0
+ ;;
+ '-c'|'--changerslot')
+ # FIXME: there must be way to determine slots
+ COMPREPLY=( $(compgen -W "slot" -- $cur) )
+ return 0
+ ;;
+ '-x'|'--cdspeed')
+ COMPREPLY=( $(compgen -W "$(eject -X)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --auto
+ -c --changerslot
+ -d --default
+ -f --floppy
+ -F --force
+ -i --manualeject
+ -m --no-unmount
+ -M --no-partitions-unmount
+ -n --noop
+ -p --proc
+ -q --tape
+ -r --cdrom
+ -s --scsi
+ -t --trayclose
+ -T --traytoggle
+ -v --verbose
+ -x --cdspeed
+ -X --listspeed
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ DEVS="$(for I in /sys/class/block/*/removable; do
+ if [ $(cat $I) -ne 0 ]; then
+ OLD_IFS=$IFS
+ IFS='/';
+ ARR=($I)
+ echo "/dev/${ARR[4]}"
+ IFS=$OLD_IFS
+ fi
+ done)"
+ COMPREPLY=( $(compgen -W "$DEVS" $cur) )
+ return 0
+}
+complete -F _eject_module eject
diff --git a/shell-completion/fallocate b/shell-completion/fallocate
new file mode 100644
index 000000000..132858caf
--- /dev/null
+++ b/shell-completion/fallocate
@@ -0,0 +1,24 @@
+_fallocate_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-o'|'--offset'|'-l'|'--length')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-n --keep-size -p --punch-hole -o --offset -l --length -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _fallocate_module fallocate
diff --git a/shell-completion/fdformat b/shell-completion/fdformat
new file mode 100644
index 000000000..4ad1c3d05
--- /dev/null
+++ b/shell-completion/fdformat
@@ -0,0 +1,11 @@
+_fdformat_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ DEVS=$(for I in echo /dev/fd*; do if [ -e $I ]; then echo $I; fi; done)
+ OPTS="-n --no-verify -h --help -V --version $DEVS"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _fdformat_module fdformat
diff --git a/shell-completion/fdisk b/shell-completion/fdisk
new file mode 100644
index 000000000..ae94f10c6
--- /dev/null
+++ b/shell-completion/fdisk
@@ -0,0 +1,47 @@
+_fdisk_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-s')
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'part' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+ ;;
+ '-b')
+ COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) )
+ return 0
+ ;;
+ '-c')
+ COMPREPLY=( $(compgen -W "dos nondos" -- $cur) )
+ return 0
+ ;;
+ '-u')
+ COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) )
+ return 0
+ ;;
+ '-C'|'-H'|'-S')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-l -s -b -c -h -u -v -C -H -S"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _fdisk_module fdisk
diff --git a/shell-completion/findmnt b/shell-completion/findmnt
new file mode 100644
index 000000000..c2dfa21b2
--- /dev/null
+++ b/shell-completion/findmnt
@@ -0,0 +1,121 @@
+_findmnt_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--poll')
+ COMPREPLY=( $(compgen -W "=list" -- $cur) )
+ return 0
+ ;;
+ '-w'|'--timeout')
+ COMPREPLY=( $(compgen -W "timeout" -- $cur) )
+ return 0
+ ;;
+ '-d'|'--direction')
+ COMPREPLY=( $(compgen -W "forward backward" -- $cur) )
+ return 0
+ ;;
+ '-F'|'--tab-file')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-N'|'--task')
+ local TID='' I ARR
+ for I in /proc/*/mountinfo; do IFS=/ read -ra ARR <<< "$I"; TID+="${ARR[2]} "; done
+ COMPREPLY=( $(compgen -W "$TID" -- $cur) )
+ return 0
+ ;;
+ '-O'|'--options')
+ local MTAB_3RD I
+ declare -a TMP_ARR
+ declare -A MNT_OPTS
+ while read MTAB_3RD; do
+ IFS=',' read -ra TMP_ARR <<<"$MTAB_3RD"
+ for I in ${TMP_ARR[@]}; do
+ MNT_OPTS[$I]='1'
+ done
+ done < <(findmnt -rno OPTIONS)
+ COMPREPLY=( $(compgen -W "$(echo ${!MNT_OPTS[@]})" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="SOURCE TARGET FSTYPE OPTIONS VFS-OPTIONS
+ FS-OPTIONS LABEL UUID PARTLABEL PARTUUID
+ MAJ\:MIN ACTION OLD-TARGET OLD-OPTIONS
+ SIZE AVAIL USED USE% FSROOT TID ID
+ OPT-FIELDS PROPAGATION FREQ PASSNO"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ '-t'|'--types')
+ local TYPES
+ TYPES="adfs affs autofs cifs coda coherent cramfs
+ debugfs devpts efs ext ext2 ext3 ext4 hfs
+ hfsplus hpfs iso9660 jfs minix msdos
+ ncpfs nfs nfs4 ntfs proc qnx4 ramfs
+ reiserfs romfs squashfs smbfs sysv tmpfs
+ ubifs udf ufs umsdos usbfs vfat xenix xfs
+ xiafs"
+ COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
+ return 0
+ ;;
+ '-S'|'--source')
+ local DEV_MPOINT
+ DEV_MPOINT=$(findmnt -rno SOURCE | grep ^/dev)
+ COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
+ return 0
+ ;;
+ '-T'|'--target')
+ local DEV_MPOINT
+ DEV_MPOINT=$(findmnt -rno TARGET)
+ COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-s --fstab
+ -m --mtab
+ -k --kernel
+ -p --poll
+ -w --timeout
+ -A --all
+ -a --ascii
+ -c --canonicalize
+ -D --df
+ -d --direction
+ -e --evaluate
+ -F --tab-file
+ -f --first-only
+ -i --invert
+ -l --list
+ -N --task
+ -n --noheadings
+ -u --notruncate
+ -O --options
+ -o --output
+ -P --pairs
+ -r --raw
+ -t --types
+ -v --nofsroot
+ -R --submounts
+ -S --source
+ -T --target
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV_MPOINT
+ DEV_MPOINT=$(findmnt -rno TARGET,SOURCE)
+ COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
+ return 0
+}
+complete -F _findmnt_module findmnt
diff --git a/shell-completion/flock b/shell-completion/flock
new file mode 100644
index 000000000..cfa9b660b
--- /dev/null
+++ b/shell-completion/flock
@@ -0,0 +1,42 @@
+_flock_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-w'|'--timeout')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ '-E'|'--conflict-exit-code')
+ COMPREPLY=( $(compgen -W "$(echo {0..255})" -- $cur) )
+ return 0
+ ;;
+ '-c'|'--command')
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-s --shared
+ -x --exclusive
+ -u --unlock
+ -n --nonblock
+ -w --timeout
+ -E --conflict-exit-code
+ -o --close
+ -c --command
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
+ return 0
+}
+complete -F _flock_module flock
diff --git a/shell-completion/fsck b/shell-completion/fsck
new file mode 100644
index 000000000..40b9a13e7
--- /dev/null
+++ b/shell-completion/fsck
@@ -0,0 +1,36 @@
+_fsck_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-b')
+ COMPREPLY=( $(compgen -W "superblock" -- $cur) )
+ return 0
+ ;;
+ '-B')
+ COMPREPLY=( $(compgen -W "blocksize" -- $cur) )
+ return 0
+ ;;
+ '-j')
+ COMPREPLY=( $(compgen -W "external_journal" -- $cur) )
+ return 0
+ ;;
+ '-l'|'-L')
+ COMPREPLY=( $(compgen -W "bad_blocks_file" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-p -n -y -c -f -v -b -B -j -l -L"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _fsck_module fsck
diff --git a/shell-completion/fsck.cramfs b/shell-completion/fsck.cramfs
new file mode 100644
index 000000000..410b084ce
--- /dev/null
+++ b/shell-completion/fsck.cramfs
@@ -0,0 +1,18 @@
+_fsck.cramfs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ OPTS='-v --verbose -x --destination -h --help -V --version file'
+ case $prev in
+ '-x'|'--destination')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -S ' ' -- $cur) )
+ return 0
+}
+complete -F _fsck.cramfs_module fsck.cramfs
diff --git a/shell-completion/fsck.minix b/shell-completion/fsck.minix
new file mode 100644
index 000000000..6239ae4a2
--- /dev/null
+++ b/shell-completion/fsck.minix
@@ -0,0 +1,11 @@
+_fsck.minix_module()
+{
+ local cur OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-l -a -r -v -s -m -f -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]} $DEVS" -- $cur) )
+ return 0
+}
+complete -F _fsck.minix_module fsck.minix
diff --git a/shell-completion/fsfreeze b/shell-completion/fsfreeze
new file mode 100644
index 000000000..7933c1574
--- /dev/null
+++ b/shell-completion/fsfreeze
@@ -0,0 +1,18 @@
+_fsfreeze_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-f --freeze -u --unfreeze -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local MPOINT
+ MPOINT="$(findmnt -t ext2,ext3,ext4,reiserfs,jfs,xfs -o TARGET -n -r)"
+ COMPREPLY=( $(compgen -W "$MPOINT" -- $cur) )
+ return 0
+}
+complete -F _fsfreeze_module fsfreeze
diff --git a/shell-completion/fstrim b/shell-completion/fstrim
new file mode 100644
index 000000000..6587d5721
--- /dev/null
+++ b/shell-completion/fstrim
@@ -0,0 +1,25 @@
+_fstrim_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-o'|'--offset'|'-l'|'--length'|'-m'|'--minimum')
+ COMPREPLY=( $(compgen -W "num" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-o --offset -l --length -m --minimum -v --verbose -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local MPOINTS
+ MPOINTS=$(findmnt -rno SOURCE | grep ^/dev)
+ COMPREPLY=( $(compgen -W "$MPOINTS" -- $cur) )
+ return 0
+}
+complete -F _fstrim_module fstrim
diff --git a/shell-completion/getopt b/shell-completion/getopt
new file mode 100644
index 000000000..ea8c8e2b6
--- /dev/null
+++ b/shell-completion/getopt
@@ -0,0 +1,34 @@
+_getopt_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-l'|'--longoptions')
+ COMPREPLY=( $(compgen -W "longopts" -- $cur) )
+ return 0
+ ;;
+ '-n'|'--name')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--options')
+ COMPREPLY=( $(compgen -W "optstring" -- $cur) )
+ return 0
+ ;;
+ '-s'|'--shell')
+ COMPREPLY=( $(compgen -W "sh bash csh tcsh" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --alternative -h --help -l --longoptions -n --name -o --options -q --quiet -Q --quiet-output -s --shell -T --test -u --unquote -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _getopt_module getopt
diff --git a/shell-completion/hexdump b/shell-completion/hexdump
new file mode 100644
index 000000000..1a6786bb6
--- /dev/null
+++ b/shell-completion/hexdump
@@ -0,0 +1,32 @@
+_hexdump_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-e')
+ COMPREPLY=( $(compgen -W "format" -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "length" -- $cur) )
+ return 0
+ ;;
+ '-s')
+ COMPREPLY=( $(compgen -W "offset" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-b -c -C -d -o -x -e -f -n -s -v -V"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _hexdump_module hexdump
diff --git a/shell-completion/hwclock b/shell-completion/hwclock
new file mode 100644
index 000000000..855e88575
--- /dev/null
+++ b/shell-completion/hwclock
@@ -0,0 +1,53 @@
+_hwclock_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--rtc'|'--adjfile')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '--date')
+ COMPREPLY=( $(compgen -W "date" -- $cur) )
+ return 0
+ ;;
+ '--epoch')
+ COMPREPLY=( $(compgen -W "year" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-h --help
+ -r --show
+ --set
+ -s --hctosys
+ -w --systohc
+ --systz
+ --adjust
+ -c --compare
+ --getepoch
+ --setepoch
+ --predict
+ -V --version
+ -u --utc
+ --localtime
+ -f --rtc
+ --directisa
+ --badyear
+ --date
+ --epoch
+ --noadjfile
+ --adjfile
+ --test
+ -D --debug"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _hwclock_module hwclock
diff --git a/shell-completion/ionice b/shell-completion/ionice
new file mode 100644
index 000000000..218071810
--- /dev/null
+++ b/shell-completion/ionice
@@ -0,0 +1,34 @@
+_ionice_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c'|'--class')
+ COMPREPLY=( $(compgen -W "$(echo {0..3}) none realtime best-effort idle" -- $cur) )
+ return 0
+ ;;
+ '-n'|'--classdata')
+ COMPREPLY=( $(compgen -W "$(echo {0..7})" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--pid')
+ local PIDS
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c --class -n --classdata -p --pid -t --ignore -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _ionice_module ionice
diff --git a/shell-completion/ipcrm b/shell-completion/ipcrm
new file mode 100644
index 000000000..fd85091c3
--- /dev/null
+++ b/shell-completion/ipcrm
@@ -0,0 +1,59 @@
+_ipcrm_module()
+{
+ local cur prev OPTS KEYIDS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-m'|'--shmem-id')
+ KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $2}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ '-M'|'--shmem-key')
+ KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $1}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ '-q'|'--queue-id')
+ KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $2}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ '-Q'|'--queue-key')
+ KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $1}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ '-s'|'--semaphore-id')
+ KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $2}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ '-S'|'--semaphore-key')
+ KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $1}}')"
+ COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ '=')
+ cur=${cur#=}
+ COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS=" -m --shmem-id
+ -M --shmem-key
+ -q --queue-id
+ -Q --queue-key
+ -s --semaphore-id
+ -S --semaphore-key
+ -a= --all=
+ -v --verbose
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _ipcrm_module ipcrm
diff --git a/shell-completion/ipcs b/shell-completion/ipcs
new file mode 100644
index 000000000..51502bb0a
--- /dev/null
+++ b/shell-completion/ipcs
@@ -0,0 +1,30 @@
+_ipcs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-i'|'--id')
+ COMPREPLY=( $(compgen -W "id" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-i --id
+ -h --help
+ -V --version
+ -m --shmems
+ -q --queues
+ -s --semaphores
+ -a --all
+ -t --time
+ -p --pid
+ -c --creator
+ -l --limits
+ -u --summary
+ --human
+ -b --bytes"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _ipcs_module ipcs
diff --git a/shell-completion/isosize b/shell-completion/isosize
new file mode 100644
index 000000000..2b4a49918
--- /dev/null
+++ b/shell-completion/isosize
@@ -0,0 +1,17 @@
+_isosize_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ OPTS='-d --divisor -x --sectors -h --help -V --version'
+ case $prev in
+ '-d'|'--divisor')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _isosize_module isosize
diff --git a/shell-completion/last b/shell-completion/last
new file mode 100644
index 000000000..493051e64
--- /dev/null
+++ b/shell-completion/last
@@ -0,0 +1,38 @@
+_last_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-h')
+ COMPREPLY=( $(compgen -A hostname -- $cur) )
+ return 0
+ ;;
+ '-i')
+ COMPREPLY=( $(compgen -W "ipaddr" -- $cur) )
+ return 0
+ ;;
+ '-t')
+ local TTYS
+ TTYS=$(cd /sys/devices/virtual/tty && echo *)
+ COMPREPLY=( $(compgen -W "$TTYS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-f -h -i -l -t -y"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+}
+complete -F _last_module last
diff --git a/shell-completion/ldattach b/shell-completion/ldattach
new file mode 100644
index 000000000..dc83dfcd3
--- /dev/null
+++ b/shell-completion/ldattach
@@ -0,0 +1,54 @@
+_ldattach_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-s'|'--speed')
+ COMPREPLY=( $(compgen -W "speed" -- $cur) )
+ return 0
+ ;;
+ '-i'|'--iflag')
+ local IFLAGS
+ IFLAGS="BRKINT ICRNL IGNBRK IGNCR IGNPAR IMAXBEL
+ INLCR INPCK ISTRIP IUCLC IUTF8 IXANY
+ IXOFF IXON PARMRK
+ -BRKINT -ICRNL -IGNBRK -IGNCR -IGNPAR -IMAXBEL
+ -INLCR -INPCK -ISTRIP -IUCLC -IUTF8 -IXANY
+ -IXOFF -IXON -PARMRK"
+ COMPREPLY=( $(compgen -W "$IFLAGS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-d --debug
+ -s --speed
+ -7 --sevenbits
+ -8 --eightbits
+ -n --noparity
+ -e --evenparity
+ -o --oddparity
+ -1 --onestopbit
+ -2 --twostopbits
+ -i --iflag
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ /*)
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ esac
+ local LDISC_DEVICE
+ LDISC_DEVICE="6PACK AX25 GIGASET GIGASET_M101 HCI HDLC IRDA M101
+ MOUSE PPP PPS R3964 SLIP STRIP SYNCPPP SYNC_PPP
+ TTY X25 /dev/"
+ COMPREPLY=( $(compgen -W "$LDISC_DEVICE" -- $cur) )
+ return 0
+}
+complete -F _ldattach_module ldattach
diff --git a/shell-completion/logger b/shell-completion/logger
new file mode 100644
index 000000000..f572302cc
--- /dev/null
+++ b/shell-completion/logger
@@ -0,0 +1,43 @@
+_logger_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--file')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-n'|'--server')
+ COMPREPLY=( $(compgen -A hostname -- $cur) )
+ return 0
+ ;;
+ '-P'|'--port')
+ COMPREPLY=( $(compgen -W "$(awk '$1 ~ /^syslog$/ {split($2, a, "/"); print a[1]}' /etc/services)" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--priority')
+ COMPREPLY=( $(compgen -W "$(echo {auth,authpriv,cron,daemon,ftp,lpr,mail,news,security}.{alert,crit,debug,emerg,err,error})" -- $cur) )
+ return 0
+ ;;
+ '-t'|'--tag')
+ COMPREPLY=( $(compgen -W "tag" -- $cur) )
+ return 0
+ ;;
+ '-u'|'--socket')
+ COMPREPLY=( $(compgen -W "$(awk '$NF ~ /^\// {print $NF}' /proc/net/unix)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-d --udp -i --id -f --file -h --help -n --server -P --port -p --priority -s --stderr -t --tag -u --socket -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _logger_module logger
diff --git a/shell-completion/look b/shell-completion/look
new file mode 100644
index 000000000..68cea563b
--- /dev/null
+++ b/shell-completion/look
@@ -0,0 +1,24 @@
+_look_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--terminate')
+ COMPREPLY=( $(compgen -W "char" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --alternative -d --alphanum -f --ignore-case -t --terminate -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _look_module look
diff --git a/shell-completion/losetup b/shell-completion/losetup
new file mode 100644
index 000000000..329bb055e
--- /dev/null
+++ b/shell-completion/losetup
@@ -0,0 +1,64 @@
+_losetup_module()
+{
+ local cur prev OPTS ARG
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-d'|'--detach')
+ ARG="$(losetup --output NAME | awk '{if (1 < NR) {print}}')"
+ COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
+ return 0
+ ;;
+ '-j'|'--associated')
+ ARG="$(losetup --output BACK-FILE | awk '{if (1 < NR) {print}}')"
+ COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
+ return 0
+ ;;
+ '-c'|'--set-capacity')
+ ARG="$(for I in /dev/loop[0-9]*; do if [ -e $I ]; then echo $I; fi; done)"
+ COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--offset'|'--sizelimit')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-O'|'--output')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="NAME AUTOCLEAR BACK-FILE BACK-INO
+ BACK-MAJ:MIN MAJ:MIN OFFSET PARTSCAN RO
+ SIZELIMIT"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all
+ -d --detach
+ -D --detach-all
+ -f --find
+ -c --set-capacity
+ -j --associated
+ -l --list
+ -o --offset
+ -O --output
+ --sizelimit
+ -P --partscan
+ -r --read-only
+ --show
+ -v --verbose
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _losetup_module losetup
diff --git a/shell-completion/lsblk b/shell-completion/lsblk
new file mode 100644
index 000000000..54981992c
--- /dev/null
+++ b/shell-completion/lsblk
@@ -0,0 +1,65 @@
+_lsblk_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-e'|'--exclude'|'-I'|'--include')
+ local MAJOR I J
+ MAJOR=''
+ for I in /sys/dev/block/*; do
+ J=${I##*/}
+ MAJOR="$MAJOR ${J%%:*}"
+ done
+ # FIXME: how to append to a string with compgen?
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$MAJOR" -S ',' -- $cur) )
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ OUTPUT="NAME KNAME MAJ:MIN FSTYPE MOUNTPOINT
+ LABEL UUID PARTLABEL PARTUUID RA RO RM
+ MODEL SIZE STATE OWNER GROUP MODE
+ ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC
+ ROTA SCHED RQ-SIZE TYPE DISC-ALN
+ DISC-GRAN DISC-MAX DISC-ZERO WSAME WWN
+ RAND PKNAME HCTL TRAN REV VENDOR"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all
+ -b --bytes
+ -d --nodeps
+ -D --discard
+ -e --exclude
+ -I --include
+ -f --fs
+ -h --help
+ -i --ascii
+ -m --perms
+ -l --list
+ -n --noheadings
+ -o --output
+ -P --pairs
+ -r --raw
+ -s --inverse
+ -t --topology
+ -S --scsi
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _lsblk_module lsblk
diff --git a/shell-completion/lscpu b/shell-completion/lscpu
new file mode 100644
index 000000000..14926ec90
--- /dev/null
+++ b/shell-completion/lscpu
@@ -0,0 +1,45 @@
+_lscpu_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '--extended'|'=')
+ cur=${cur#=}
+ # FIXME: how to append to a string with compgen?
+ OPTS="CPU,
+ CORE,
+ SOCKET,
+ NODE,
+ BOOK,
+ CACHE,
+ POLARIZATION,
+ ADDRESS,
+ CONFIGURED,
+ ONLINE,"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OPTS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all
+ -b --online
+ -c --offline
+ -e= --extended=
+ -p= --parse=
+ -s --sysroot
+ -x --hex
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _lscpu_module lscpu
diff --git a/shell-completion/lslocks b/shell-completion/lslocks
new file mode 100644
index 000000000..f55c17ecb
--- /dev/null
+++ b/shell-completion/lslocks
@@ -0,0 +1,43 @@
+_lslocks_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--pid')
+ local PIDS
+ # /proc/locks can have 8 to 9 fields, see commit
+ # 55c0d16bab8cc84b72bf11cb2fdd8aa6205ac608
+ PIDS="$(awk '{print $(NF-3)}' /proc/locks)"
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+
+ esac
+ case $cur in
+ -*)
+ OPTS="-p --pid
+ -o --output
+ -n --noheadings
+ -r --raw
+ -u --notruncate
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _lslocks_module lslocks
diff --git a/shell-completion/mcookie b/shell-completion/mcookie
new file mode 100644
index 000000000..1c01a5522
--- /dev/null
+++ b/shell-completion/mcookie
@@ -0,0 +1,23 @@
+_mcookie_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--file')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-f --file -v --verbose -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _mcookie_module mcookie
diff --git a/shell-completion/mesg b/shell-completion/mesg
new file mode 100644
index 000000000..62c98ca29
--- /dev/null
+++ b/shell-completion/mesg
@@ -0,0 +1,16 @@
+_mesg_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-v --verbose -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "y n" -- $cur) )
+ return 0
+}
+complete -F _mesg_module mesg
diff --git a/shell-completion/mkfs b/shell-completion/mkfs
new file mode 100644
index 000000000..19471195e
--- /dev/null
+++ b/shell-completion/mkfs
@@ -0,0 +1,25 @@
+_mkfs_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--type')
+ FSTYPES=$(for I in /sbin/mkfs.* /usr/sbin/mkfs.*; do if [ -e $I ]; then echo ${I##*mkfs.}; fi; done)
+ COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS='-t --type --verbose -h --help -V --version'
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) )
+ return 0
+}
+complete -F _mkfs_module mkfs
diff --git a/shell-completion/mkfs.bfs b/shell-completion/mkfs.bfs
new file mode 100644
index 000000000..7a47a76fb
--- /dev/null
+++ b/shell-completion/mkfs.bfs
@@ -0,0 +1,28 @@
+_bfs_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-N'|'--inodes')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-V'|'--vname'|'-F'|'--fname')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS='-N --inodes --vname --fname -v --verbose -h --help -V --version'
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) )
+ return 0
+}
+complete -F _bfs_module bfs
diff --git a/shell-completion/mkfs.cramfs b/shell-completion/mkfs.cramfs
new file mode 100644
index 000000000..65ee98836
--- /dev/null
+++ b/shell-completion/mkfs.cramfs
@@ -0,0 +1,40 @@
+_mkfs.cramfs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-b')
+ COMPREPLY=( $(compgen -W "blksize" -- $cur) )
+ return 0
+ ;;
+ '-e')
+ COMPREPLY=( $(compgen -W "edition" -- $cur) )
+ return 0
+ ;;
+ '-N')
+ COMPREPLY=( $(compgen -W "big little host" -- $cur) )
+ return 0
+ ;;
+ '-i')
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-h -v -E -b -e -N -i -n -p -s -z"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _mkfs.cramfs_module mkfs.cramfs
diff --git a/shell-completion/mkfs.minix b/shell-completion/mkfs.minix
new file mode 100644
index 000000000..085a0587b
--- /dev/null
+++ b/shell-completion/mkfs.minix
@@ -0,0 +1,33 @@
+_mkfs.minix_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-i')
+ COMPREPLY=( $(compgen -W "inodes" -- $cur) )
+ return 0
+ ;;
+ '-l')
+ COMPREPLY=( $(compgen -W "badblocks-file" -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "14 30" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c -i -l -n -1 -2 -3"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _mkfs.minix_module mkfs.minix
diff --git a/shell-completion/mkswap b/shell-completion/mkswap
new file mode 100644
index 000000000..30d517cad
--- /dev/null
+++ b/shell-completion/mkswap
@@ -0,0 +1,35 @@
+_mkswap_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--pagesize')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ '-L'|'--label')
+ COMPREPLY=( $(compgen -W "label" -- $cur) )
+ return 0
+ ;;
+ '-v'|'--swapversion')
+ COMPREPLY=( $(compgen -W "1" -- $cur) )
+ return 0
+ ;;
+ '-U'|--uuid)
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c --check -f --force -p --pagesize -L --label -v --swapversion -U --uuid -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _mkswap_module mkswap
diff --git a/shell-completion/more b/shell-completion/more
new file mode 100644
index 000000000..f32770d52
--- /dev/null
+++ b/shell-completion/more
@@ -0,0 +1,22 @@
+_more_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-d -f -l -p -c -u -s -number -V"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ +*)
+ OPTS="+number +/string"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _more_module more
diff --git a/shell-completion/mountpoint b/shell-completion/mountpoint
new file mode 100644
index 000000000..e2f1d5686
--- /dev/null
+++ b/shell-completion/mountpoint
@@ -0,0 +1,24 @@
+_mountpoint_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--fixme')
+ COMPREPLY=( $(compgen -W "fixme" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-q --quiet -d --fs-devno -x --devno -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
+ return 0
+}
+complete -F _mountpoint_module mountpoint
diff --git a/shell-completion/namei b/shell-completion/namei
new file mode 100644
index 000000000..c44821c5a
--- /dev/null
+++ b/shell-completion/namei
@@ -0,0 +1,17 @@
+_namei_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-h --help -V --version -x --mountpoints -m --modes -o --owners -l --long -n --nosymlinks -v --vertical"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _namei_module namei
diff --git a/shell-completion/newgrp b/shell-completion/newgrp
new file mode 100644
index 000000000..567c08cfc
--- /dev/null
+++ b/shell-completion/newgrp
@@ -0,0 +1,16 @@
+_newgrp_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -g -- $cur) )
+ return 0
+}
+complete -F _newgrp_module newgrp
diff --git a/shell-completion/nsenter b/shell-completion/nsenter
new file mode 100644
index 000000000..b8296b6df
--- /dev/null
+++ b/shell-completion/nsenter
@@ -0,0 +1,44 @@
+_nsenter_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--target')
+ local PIDS
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ '=')
+ # FIXME: --root and --wd should use get only
+ # directories as compgen output. If $cur is
+ # overwrote the same way as below in case segment
+ # for $prev the command-line will get mangled.
+ cur=${cur#=}
+ ;;
+ -*)
+ OPTS="-t --target
+ -m= --mount=
+ -u= --uts=
+ -i= --ipc=
+ -n= --net=
+ -p= --pid=
+ -U= --user=
+ -r= --root=
+ -w= --wd=
+ -F --no-fork
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _nsenter_module nsenter
diff --git a/shell-completion/partx b/shell-completion/partx
new file mode 100644
index 000000000..db2eded6a
--- /dev/null
+++ b/shell-completion/partx
@@ -0,0 +1,38 @@
+_partx_module()
+{
+ local cur prev OPTS OUTPUT
+ COMPREPLY=()
+ OUTPUT="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME"
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-n'|'--nr')
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ '-t'|'--type')
+ # FIXME: some command should list type libblkid knows.
+ COMPREPLY=( $(compgen -W "aix bsd dos gpt mac minix sgi solaris_x86 sun ultrix unixware" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --add -d --delete -s --show -u --update -b --bytes -g --noheadings -n --nr -o --output -P --pairs -r --raw -t --type -v --verbose -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _partx_module partx
diff --git a/shell-completion/pg b/shell-completion/pg
new file mode 100644
index 000000000..4ae888745
--- /dev/null
+++ b/shell-completion/pg
@@ -0,0 +1,29 @@
+_pg_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p')
+ COMPREPLY=( $(compgen -W "prompt" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-number -c -e -f -n -p -r -s -h -V"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ +*)
+ OPTS="+number +/pattern/"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _pg_module pg
diff --git a/shell-completion/pivot_root b/shell-completion/pivot_root
new file mode 100644
index 000000000..54f173425
--- /dev/null
+++ b/shell-completion/pivot_root
@@ -0,0 +1,14 @@
+_pivot_root_module()
+{
+ local cur
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1|2)
+ compopt -o filenames
+ COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
+ ;;
+ esac
+ return 0
+}
+complete -F _pivot_root_module pivot_root
diff --git a/shell-completion/prlimit b/shell-completion/prlimit
new file mode 100644
index 000000000..bf5ff2f3b
--- /dev/null
+++ b/shell-completion/prlimit
@@ -0,0 +1,60 @@
+_prlimit_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--pid')
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="DESCRIPTION RESOURCE SOFT HARD UNITS"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ '=')
+ cur=${cur#=}
+ # FIXME: is there anything what could be printed
+ # as limit value(s)
+ ;;
+ -*)
+ OPTS="-p --pid
+ -o --output
+ --noheadings
+ --raw
+ --verbose
+ -h --help
+ -V --version
+ -c= --core=
+ -d= --data=
+ -e= --nice=
+ -f= --fsize=
+ -i= --sigpending=
+ -l= --memlock=
+ -m= --rss=
+ -n= --nofile=
+ -q= --msgqueue=
+ -r= --rtprio=
+ -s= --stack=
+ -t= --cpu=
+ -u= --nproc=
+ -v= --as=
+ -x= --locks=
+ -y --rttime"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _prlimit_module prlimit
diff --git a/shell-completion/raw b/shell-completion/raw
new file mode 100644
index 000000000..27f035454
--- /dev/null
+++ b/shell-completion/raw
@@ -0,0 +1,17 @@
+_raw_module()
+{
+ local cur
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ local OPTS
+ OPTS="-q --query -a --all -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "$(for I in /dev/raw/*; do if [ -e $I ]; then echo $I; fi; done)" -- $cur) )
+ return 0
+}
+complete -F _raw_module raw
diff --git a/shell-completion/readprofile b/shell-completion/readprofile
new file mode 100644
index 000000000..c1eb514b4
--- /dev/null
+++ b/shell-completion/readprofile
@@ -0,0 +1,33 @@
+_readprofile_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-m'|'--mapfile'|'-p'|'--profile')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-M'|'--multiplier')
+ COMPREPLY=( $(compgen -W "multiplier" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-m --mapfile
+ -p --profile
+ -M --multiplier
+ -i --info
+ -v --verbose
+ -a --all
+ -b --histbin
+ -s --counters
+ -r --reset
+ -n --no-auto
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _readprofile_module readprofile
diff --git a/shell-completion/rename b/shell-completion/rename
new file mode 100644
index 000000000..0fe4cc64b
--- /dev/null
+++ b/shell-completion/rename
@@ -0,0 +1,27 @@
+_rename_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-v --verbose -s --symlink -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $COMP_CWORD in
+ 1)
+ COMPREPLY=( $(compgen -W "expression" -- $cur) )
+ ;;
+ 2)
+ COMPREPLY=( $(compgen -W "replacement" -- $cur) )
+ ;;
+ *)
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _rename_module rename
diff --git a/shell-completion/renice b/shell-completion/renice
new file mode 100644
index 000000000..aba00d787
--- /dev/null
+++ b/shell-completion/renice
@@ -0,0 +1,38 @@
+_renice_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-g'|'--pgrp')
+ local PGRP
+ PGRP=$(ps -ax -opgrp | sed '1d')
+ COMPREPLY=( $(compgen -W "$PGRP" -- $cur) )
+ return 0
+ ;;
+ '-n'|'--priority')
+ COMPREPLY=( $(compgen -W "$(echo {-20..20})" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--pid')
+ local PIDS
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ '-u'|'--user')
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-g --pgrp
+ -n --priority
+ -p --pid
+ -u --user
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _renice_module renice
diff --git a/shell-completion/resizepart b/shell-completion/resizepart
new file mode 100644
index 000000000..b178b529c
--- /dev/null
+++ b/shell-completion/resizepart
@@ -0,0 +1,25 @@
+_resizepart_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1)
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ OPTS="-h --help -V --version $DEVICES"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) )
+ ;;
+ 3)
+ COMPREPLY="length"
+ ;;
+ esac
+ return 0
+}
+complete -F _resizepart_module resizepart
diff --git a/shell-completion/rev b/shell-completion/rev
new file mode 100644
index 000000000..f891f1910
--- /dev/null
+++ b/shell-completion/rev
@@ -0,0 +1,17 @@
+_rev_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _rev_module rev
diff --git a/shell-completion/rtcwake b/shell-completion/rtcwake
new file mode 100644
index 000000000..1f38df827
--- /dev/null
+++ b/shell-completion/rtcwake
@@ -0,0 +1,40 @@
+_rtcwake_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-d'|'--device')
+ local RTC_DEVS
+ RTC_DEVS=$(cd /sys/class/rtc/ && echo *)
+ COMPREPLY=( $(compgen -W "$RTC_DEVS" -- $cur) )
+ return 0
+ ;;
+ '-m'|'--mode')
+ COMPREPLY=( $(compgen -W "standby mem disk off no on disable show" -- $cur) )
+ return 0
+ ;;
+ '-s'|'--seconds')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ '-t'|'--time')
+ COMPREPLY=( $(compgen -W "time_t" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS="-d --device
+ -n --dry-run
+ -l --local
+ -m --mode
+ -s --seconds
+ -t --time
+ -u --utc
+ -v --verbose
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _rtcwake_module rtcwake
diff --git a/shell-completion/script b/shell-completion/script
new file mode 100644
index 000000000..48f50c3ee
--- /dev/null
+++ b/shell-completion/script
@@ -0,0 +1,36 @@
+_script_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c'|'--command')
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ '=')
+ cur=${cur#=}
+ ;;
+ -*)
+ OPTS="-a --append
+ -c --command
+ -e --return
+ -f --flush
+ --force
+ -q --quiet
+ -t= --timing=
+ -V --version
+ -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _script_module script
diff --git a/shell-completion/scriptreplay b/shell-completion/scriptreplay
new file mode 100644
index 000000000..78e5b23a7
--- /dev/null
+++ b/shell-completion/scriptreplay
@@ -0,0 +1,28 @@
+_scriptreplay_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-d'|'--divisor')
+ COMPREPLY=( $(compgen -W "digit" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-t --timing
+ -s --typescript
+ -d --divisor
+ -V --version
+ -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _scriptreplay_module scriptreplay
diff --git a/shell-completion/setarch b/shell-completion/setarch
new file mode 100644
index 000000000..b84d399b5
--- /dev/null
+++ b/shell-completion/setarch
@@ -0,0 +1,42 @@
+_setarch_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $(compgen -W "linux32 linux64 ppc32 ppc ppc64
+ ppc64pseries ppc64iseries i386
+ i486 i586 i686 athlon x86_64
+ ia64 parisc32 parisc parisc64
+ s390 s390x sparc sparc32bash
+ sparc32 sparc64 mips32 mips
+ mips64 alpha alphaev5 alphaev56
+ alphaev6 alphaev67" -- $cur) )
+ return 0
+ fi
+ case $cur in
+ -*)
+ OPTS="-v, --verbose
+ -R, --addr-no-randomize
+ -F, --fdpic-funcptrs
+ -Z, --mmap-page-zero
+ -L, --addr-compat-layout
+ -X, --read-implies-exec
+ -B, --32bit
+ -I, --short-inode
+ -S, --whole-seconds
+ -T, --sticky-timeouts
+ -3, --3gb
+ --4gb
+ --uname-2.6
+ -h, --help
+ -V, --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _setarch_module setarch
diff --git a/shell-completion/setpriv b/shell-completion/setpriv
new file mode 100644
index 000000000..b05affe72
--- /dev/null
+++ b/shell-completion/setpriv
@@ -0,0 +1,82 @@
+_setpriv_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '--inh-caps'|'--bounding-set')
+ # FIXME: how to append to a string with compgen?
+ local INHERIT
+ INHERIT=$(setpriv --list-caps| awk '{print $1, "-" $1}')
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "all $INHERIT" -S ',' -- $cur) )
+ return 0
+ ;;
+ '--ruid'|'--euid'|'--reuid')
+ local UIDS
+ UIDS=$(getent passwd | awk -F: '{print $3}')
+ COMPREPLY=( $(compgen -W "$UIDS" -- $cur) )
+ return 0
+ ;;
+ '--rgid'|'--egid'|'--regid')
+ local GIDS
+ GIDS=$(getent group | awk -F: '{print $3}')
+ COMPREPLY=( $(compgen -W "$GIDS" -- $cur) )
+ return 0
+ ;;
+ '--groups')
+ # FIXME: how to append to a string with compgen?
+ local GIDS
+ GIDS=$(getent group | awk -F: '{print $3}')
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$GIDS" -S ',' -- $cur) )
+ return 0
+ ;;
+ '--securebits')
+ local SBITS
+ SBITS="noroot noroot_locked no_setuid_fixup no_setuid_fixup_locked keep_caps_locked
+ -noroot -noroot_locked -no_setuid_fixup -no_setuid_fixup_locked -keep_caps_locked"
+ COMPREPLY=( $(compgen -W "$SBITS" -- $cur) )
+ return 0
+ ;;
+ '--selinux-label')
+ # FIXME: how to list selinux labels?
+ COMPREPLY=( $(compgen -W "label" -- $cur) )
+ return 0
+ ;;
+ '--apparmor-profile')
+ # FIXME: how to list apparmor profiles?
+ COMPREPLY=( $(compgen -W "profile" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-d --dump
+ --nnp --no-new-privs
+ --inh-caps
+ --bounding-set
+ --ruid
+ --euid
+ --rgid
+ --egid
+ --reuid
+ --regid
+ --clear-groupsclear
+ --keep-groupskeep
+ --groups
+ --securebits
+ --selinux-label
+ --apparmor-profile
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _setpriv_module setpriv
diff --git a/shell-completion/setsid b/shell-completion/setsid
new file mode 100644
index 000000000..dcefc2f05
--- /dev/null
+++ b/shell-completion/setsid
@@ -0,0 +1,17 @@
+_setsid_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-c --ctty -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _setsid_module setsid
diff --git a/shell-completion/setterm b/shell-completion/setterm
new file mode 100644
index 000000000..33d2e56f6
--- /dev/null
+++ b/shell-completion/setterm
@@ -0,0 +1,113 @@
+_setterm_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-term')
+ local TERM_LIST I
+ TERM_LIST=''
+ for I in /usr/share/terminfo/?/*; do
+ TERM_LIST+="${I##*/} "
+ done
+ COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) )
+ return 0
+ ;;
+ '-foreground'|'-background'|'-ulcolor'|'-hbcolor')
+ COMPREPLY=( $(compgen -W "default black blue cyan green magenta red white yellow" -- $cur) )
+ return 0
+ ;;
+ '-cursor'|'-repeat'|'-appcursorkeys'|'-linewrap'|'-inversescreen'|'-bold'|'-half-bright'|'-blink'|'-reverse'|'-underline'|'-msg')
+ COMPREPLY=( $(compgen -W "off on" -- $cur) )
+ return 0
+ ;;
+ '-clear')
+ COMPREPLY=( $(compgen -W "all rest" -- $cur) )
+ return 0
+ ;;
+ '-tabs'|'-clrtabs')
+ COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) )
+ return 0
+ ;;
+ '-regtabs')
+ COMPREPLY=( $(compgen -W "$(echo {1..160})" -- $cur) )
+ return 0
+ ;;
+ '-blank')
+ COMPREPLY=( $(compgen -W "$(echo {0..60}) force poke" -- $cur) )
+ return 0
+ ;;
+ '-dump'|'-append')
+ local NUM_CONS
+ NUM_CONS=(/sys/class/tty/*)
+ COMPREPLY=( $(compgen -W "$(echo {1..${#NUM_CONS[*]}})" -- $cur) )
+ return 0
+ ;;
+ '-file')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-msglevel')
+ COMPREPLY=( $(compgen -W "$(echo {1..8})" -- $cur) )
+ return 0
+ ;;
+ '-powersave')
+ COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) )
+ return 0
+ ;;
+ '-powerdown')
+ COMPREPLY=( $(compgen -W "$(echo {0..60})" -- $cur) )
+ return 0
+ ;;
+ '-blength')
+ COMPREPLY=( $(compgen -W "0-2000" -- $cur) )
+ return 0
+ ;;
+ '-bfreq')
+ COMPREPLY=( $(compgen -W "freqnumber" -- $cur) )
+ return 0
+ ;;
+ esac
+ OPTS=" -term
+ -reset
+ -initialize
+ -cursor
+ -repeat
+ -appcursorkeys
+ -linewrap
+ -default
+ -foreground
+ -background
+ -ulcolor
+ -hbcolor
+ -ulcolor
+ -hbcolor
+ -inversescreen
+ -bold
+ -half-bright
+ -blink
+ -reverse
+ -underline
+ -store
+ -clear
+ -tabs
+ -clrtabs
+ -regtabs
+ -blank
+ -dump
+ -append
+ -file
+ -msg
+ -msglevel
+ -powersave
+ -powerdown
+ -blength
+ -bfreq
+ -version
+ -help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _setterm_module setterm
diff --git a/shell-completion/sfdisk b/shell-completion/sfdisk
new file mode 100644
index 000000000..5498b0e90
--- /dev/null
+++ b/shell-completion/sfdisk
@@ -0,0 +1,79 @@
+_sfdisk_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-u'|'--unit')
+ COMPREPLY=( $(compgen -W "S C B M" -- $cur) )
+ return 0
+ ;;
+ '-n'|'-C'|'--cylinders'|'-H'|'--heads'|'-S'|'--sectors')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-O'|'-I')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ '=')
+ cur=${cur#=}
+ ;;
+ -*)
+ OPTS="-s --show-size
+ -c --id
+ --change-id
+ --print-id
+ -l --list
+ -d --dump
+ -i --increment
+ -u --unit
+ -1 --one-only
+ -T --list-types
+ -D --DOS
+ -E --DOS-extended
+ -R --re-read
+ -N
+ -n
+ -O
+ -I
+ -V --verify
+ -v --version
+ -h --help
+ -f --force
+ --no-reread
+ -q --quiet
+ -L --Linux
+ -g --show-geometry
+ -G --show-pt-geometry
+ -A= --activate=
+ -U= --unhide=
+ -x --show-extended
+ --leave-last
+ --IBM
+ --in-order
+ --not-in-order
+ --inside-outer
+ --not-inside-outer
+ --nested
+ --chained
+ --onesector
+ -C --cylinders
+ -H --heads
+ -S --sectors"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _sfdisk_module sfdisk
diff --git a/shell-completion/su b/shell-completion/su
new file mode 100644
index 000000000..c72f6a10b
--- /dev/null
+++ b/shell-completion/su
@@ -0,0 +1,44 @@
+_su_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-'|'-u'|'--user')
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+ ;;
+ '-g'|'--group'|'-G'|'--supp-group')
+ COMPREPLY=( $(compgen -g -- $cur) )
+ return 0
+ ;;
+ '-s'|'--shell')
+ COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" -
+ -u --user
+ -m -p --preserve-environment
+ -g --group
+ -G --supp-group
+ -l --login
+ -c --command
+ --session-command
+ -f --fast
+ -s --shell
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _su_module su
+complete -F _su_module runuser
diff --git a/shell-completion/swaplabel b/shell-completion/swaplabel
new file mode 100644
index 000000000..c857d1592
--- /dev/null
+++ b/shell-completion/swaplabel
@@ -0,0 +1,28 @@
+_swaplabel_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-L'|'--label')
+ COMPREPLY=( $(compgen -W "label" -- $cur) )
+ return 0
+ ;;
+ '-U'|'--uuid')
+ COMPREPLY=( $(compgen -W '$(uuidgen)' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-L --label -U --uuid -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _swaplabel_module swaplabel
diff --git a/shell-completion/swapon b/shell-completion/swapon
new file mode 100644
index 000000000..83e7e241f
--- /dev/null
+++ b/shell-completion/swapon
@@ -0,0 +1,48 @@
+_swapon_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--priority')
+ # Priority range is -1 to 32767. Perhaps these
+ # few are enough.
+ COMPREPLY=( $(compgen -W "$(echo {-1..9} 32767)" -- $cur) )
+ return 0
+ ;;
+ '--show')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="NAME TYPE SIZE USED PRIO"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all
+ -d --discard
+ -e --ifexists
+ -f --fixpgsz
+ -p --priority
+ -s --summary
+ --show
+ --noheadings
+ --raw
+ --bytes
+ -v --verbose
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ # FIXME: compgen will split SPEC= from '=' point. The append
+ # comma separated value problem is very similar.
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _swapon_module swapon
diff --git a/shell-completion/tailf b/shell-completion/tailf
new file mode 100644
index 000000000..29c5bed0a
--- /dev/null
+++ b/shell-completion/tailf
@@ -0,0 +1,24 @@
+_tailf_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-n'|'--lines')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-n --lines -number -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _tailf_module tailf
diff --git a/shell-completion/taskset b/shell-completion/taskset
new file mode 100644
index 000000000..5311316a2
--- /dev/null
+++ b/shell-completion/taskset
@@ -0,0 +1,38 @@
+_taskset_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-c'|'--cpu-list')
+ local CPULIST
+ # FIXME: will propose only binding to a cpu.
+ # Maybe this should add comma, and continue?
+ CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
+ COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) )
+ return 0
+ ;;
+ '-p'|'--pid')
+ local PIDS
+ # FIXME: the pid argument is ambiguous. When
+ # setting an affinity the optarg has to be cpu
+ # mask. The following is good only for getting
+ # affinity.
+ PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
+ COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all-tasks -p --pid -c --cpu-list -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _taskset_module taskset
diff --git a/shell-completion/tunelp b/shell-completion/tunelp
new file mode 100644
index 000000000..0f048429f
--- /dev/null
+++ b/shell-completion/tunelp
@@ -0,0 +1,48 @@
+_tunelp_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-i'|'--irq'|'-c'|'--chars')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-t'|'--time')
+ COMPREPLY=( $(compgen -W "milliseconds" -- $cur) )
+ return 0
+ ;;
+ '-w'|'--wait')
+ COMPREPLY=( $(compgen -W "microseconds" -- $cur) )
+ return 0
+ ;;
+ '-a'|'--abort'|'-o'|'--check-status'|'-C'|'--careful'|'-T'|'--trust-irq'|'-q'|'--print-irq')
+ COMPREPLY=( $(compgen -W "off on" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-i --irq
+ -t --time
+ -c --chars
+ -w --wait
+ -a --abort
+ -o --check-status
+ -C --careful
+ -s --status
+ -T --trust-irq
+ -r --reset
+ -q --print-irq
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) )
+ return 0
+}
+complete -F _tunelp_module tunelp
diff --git a/shell-completion/ul b/shell-completion/ul
new file mode 100644
index 000000000..07d073135
--- /dev/null
+++ b/shell-completion/ul
@@ -0,0 +1,29 @@
+_ul_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--terminal')
+ local TERM_LIST I
+ TERM_LIST=''
+ for I in /usr/share/terminfo/?/*; do
+ TERM_LIST+="${I##*/} "
+ done
+ COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-t --terminal -i --indicated -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _ul_module ul
diff --git a/shell-completion/unshare b/shell-completion/unshare
new file mode 100644
index 000000000..295d02f90
--- /dev/null
+++ b/shell-completion/unshare
@@ -0,0 +1,24 @@
+_unshare_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-m --mount
+ -u --uts
+ -i --ipc
+ -n --net
+ -p --pid
+ -U --user
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o bashdefault
+ COMPREPLY=( $(compgen -c -- $cur) )
+ return 0
+}
+complete -F _unshare_module unshare
diff --git a/shell-completion/utmpdump b/shell-completion/utmpdump
new file mode 100644
index 000000000..e306ef836
--- /dev/null
+++ b/shell-completion/utmpdump
@@ -0,0 +1,17 @@
+_utmpdump_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-f --follow -r --reverse -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _utmpdump_module utmpdump
diff --git a/shell-completion/uuidd b/shell-completion/uuidd
new file mode 100644
index 000000000..23c1a4906
--- /dev/null
+++ b/shell-completion/uuidd
@@ -0,0 +1,33 @@
+_uuidd_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--pid'|'-s'|'--socket')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-T'|'--timeout')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -W "timeout" -- $cur) )
+ return 0
+ ;;
+ '-n'|'--uuids')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-p --pid -s --socket -T --timeout -k --kill -r --random -t --time -n --uuids -P --no-pid -F --no-fork -S --socket-activation -d --debug -q --quiet -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _uuidd_module uuidd
diff --git a/shell-completion/uuidgen b/shell-completion/uuidgen
new file mode 100644
index 000000000..d9edde9b0
--- /dev/null
+++ b/shell-completion/uuidgen
@@ -0,0 +1,15 @@
+_uuidgen_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ OPTS="-r --random -t --time -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _uuidgen_module uuidgen
diff --git a/shell-completion/wall b/shell-completion/wall
new file mode 100644
index 000000000..d3cbbd56a
--- /dev/null
+++ b/shell-completion/wall
@@ -0,0 +1,24 @@
+_wall_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--timeout')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-n --nobanner -t --timeout -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _wall_module wall
diff --git a/shell-completion/wdctl b/shell-completion/wdctl
new file mode 100644
index 000000000..42889acad
--- /dev/null
+++ b/shell-completion/wdctl
@@ -0,0 +1,60 @@
+_wdctl_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-f'|'--flags')
+ local FLAGS
+ FLAGS="ALARMONLY
+ CARDRESET
+ EXTERN1
+ EXTERN2
+ FANFAULT
+ KEEPALIVEPING
+ MAGICCLOSE
+ OVERHEAT
+ POWEROVER
+ POWERUNDER
+ PRETIMEOUT
+ SETTIMEOUT"
+ COMPREPLY=( $(compgen -W "$FLAGS" -- $cur) )
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ local OUTPUT
+ OUTPUT="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ '-s'|'--settimeout')
+ COMPREPLY=( $(compgen -W "seconds" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-f --flags
+ -F --noflags
+ -I --noident
+ -n --noheadings
+ -O --oneline
+ -o --output
+ -r --raw
+ -T --notimeouts
+ -s --settimeout
+ -x --flags-only
+ -h --help
+ -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
+ return 0
+}
+complete -F _wdctl_module wdctl
diff --git a/shell-completion/whereis b/shell-completion/whereis
new file mode 100644
index 000000000..96e4117a9
--- /dev/null
+++ b/shell-completion/whereis
@@ -0,0 +1,24 @@
+_whereis_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-B'|'-M'|'-S')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-b -B -m -M -s -S -f -u -l"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "file" -- $cur) )
+ return 0
+}
+complete -F _whereis_module whereis
diff --git a/shell-completion/wipefs b/shell-completion/wipefs
new file mode 100644
index 000000000..db9426e2a
--- /dev/null
+++ b/shell-completion/wipefs
@@ -0,0 +1,32 @@
+_wipefs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-o'|'--offset')
+ COMPREPLY=( $(compgen -W "offset" -- $cur) )
+ return 0
+ ;;
+ '-t'|'--types')
+ local TYPES
+ TYPES="$(blkid -k)"
+ COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
+ return 0
+ ;;
+
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --all -f --force -h --help -n --no-actn -o --offset -p --parsable -q --quiet -t --types -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _wipefs_module wipefs
diff --git a/shell-completion/write b/shell-completion/write
new file mode 100644
index 000000000..d41159b2d
--- /dev/null
+++ b/shell-completion/write
@@ -0,0 +1,22 @@
+_write_module()
+{
+ local cur
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1)
+ COMPREPLY=( $(compgen -u -- $cur) )
+ return 0
+ ;;
+ 2)
+ local I TERMS=''
+ for I in /sys/class/tty/*; do
+ TERMS+="/dev${I##/sys/class/tty} "
+ done
+ COMPREPLY=( $(compgen -W "$TERMS" -- $cur) )
+ return 0
+ ;;
+ esac
+ return 0
+}
+complete -F _write_module write