diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
commit | 8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 (patch) | |
tree | a9b2e7baeca1be40eb734371e3c8b11b02294497 /bash-completion | |
parent | Initial commit. (diff) | |
download | util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.tar.xz util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.zip |
Adding upstream version 2.33.1.upstream/2.33.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bash-completion')
104 files changed, 5140 insertions, 0 deletions
diff --git a/bash-completion/Makemodule.am b/bash-completion/Makemodule.am new file mode 100644 index 0000000..61f298a --- /dev/null +++ b/bash-completion/Makemodule.am @@ -0,0 +1,321 @@ +if BUILD_BASH_COMPLETION + +if BUILD_BLKID +dist_bashcompletion_DATA += bash-completion/blkid +endif +if BUILD_CAL +dist_bashcompletion_DATA += bash-completion/cal +endif +if BUILD_COL +dist_bashcompletion_DATA += bash-completion/col +endif +if BUILD_COLCRT +dist_bashcompletion_DATA += bash-completion/colcrt +endif +if BUILD_COLRM +dist_bashcompletion_DATA += bash-completion/colrm +endif +if BUILD_COLUMN +dist_bashcompletion_DATA += bash-completion/column +endif +if BUILD_FINCORE +dist_bashcompletion_DATA += bash-completion/fincore +endif +if BUILD_FINDFS +dist_bashcompletion_DATA += bash-completion/findfs +endif +if BUILD_FINDMNT +dist_bashcompletion_DATA += bash-completion/findmnt +endif +if BUILD_FLOCK +dist_bashcompletion_DATA += bash-completion/flock +endif +if BUILD_GETOPT +dist_bashcompletion_DATA += bash-completion/getopt +endif +if BUILD_HEXDUMP +dist_bashcompletion_DATA += bash-completion/hexdump +endif +if BUILD_IPCMK +dist_bashcompletion_DATA += bash-completion/ipcmk +endif +if BUILD_IPCRM +dist_bashcompletion_DATA += bash-completion/ipcrm +endif +if BUILD_IPCS +dist_bashcompletion_DATA += bash-completion/ipcs +endif +if BUILD_ISOSIZE +dist_bashcompletion_DATA += bash-completion/isosize +endif +if BUILD_LOGGER +dist_bashcompletion_DATA += bash-completion/logger +endif +if BUILD_LOOK +dist_bashcompletion_DATA += bash-completion/look +endif +if BUILD_LSIPC +dist_bashcompletion_DATA += bash-completion/lsipc +endif +if BUILD_LSNS +dist_bashcompletion_DATA += bash-completion/lsns +endif +if BUILD_MCOOKIE +dist_bashcompletion_DATA += bash-completion/mcookie +endif +if BUILD_MKFS +dist_bashcompletion_DATA += bash-completion/mkfs +endif +if BUILD_MKSWAP +dist_bashcompletion_DATA += bash-completion/mkswap +endif +if BUILD_NAMEI +dist_bashcompletion_DATA += bash-completion/namei +endif +if BUILD_PRLIMIT +dist_bashcompletion_DATA += bash-completion/prlimit +endif +if BUILD_READPROFILE +dist_bashcompletion_DATA += bash-completion/readprofile +endif +if BUILD_RENICE +dist_bashcompletion_DATA += bash-completion/renice +endif +if BUILD_REV +dist_bashcompletion_DATA += bash-completion/rev +endif +if BUILD_SCRIPT +dist_bashcompletion_DATA += bash-completion/script +endif +if BUILD_SCRIPTREPLAY +dist_bashcompletion_DATA += bash-completion/scriptreplay +endif +if BUILD_SETSID +dist_bashcompletion_DATA += bash-completion/setsid +endif +if BUILD_WHEREIS +dist_bashcompletion_DATA += bash-completion/whereis +endif +if BUILD_WIPEFS +dist_bashcompletion_DATA += bash-completion/wipefs +endif +if BUILD_FSCK +dist_bashcompletion_DATA += bash-completion/fsck +endif + +if BUILD_BFS +dist_bashcompletion_DATA += bash-completion/mkfs.bfs +endif + +if BUILD_MINIX +dist_bashcompletion_DATA += \ + bash-completion/fsck.minix \ + bash-completion/mkfs.minix +endif + +if BUILD_CRAMFS +dist_bashcompletion_DATA += \ + bash-completion/fsck.cramfs \ + bash-completion/mkfs.cramfs +endif +if BUILD_PARTX +dist_bashcompletion_DATA += \ + bash-completion/addpart \ + bash-completion/delpart \ + bash-completion/resizepart \ + bash-completion/partx +endif +if BUILD_RAW +dist_bashcompletion_DATA += bash-completion/raw +endif +if BUILD_SWAPLABEL +dist_bashcompletion_DATA += bash-completion/swaplabel +endif +if BUILD_FDFORMAT +dist_bashcompletion_DATA += bash-completion/fdformat +endif +if BUILD_BLOCKDEV +dist_bashcompletion_DATA += bash-completion/blockdev +endif + +if BUILD_FDISK +dist_bashcompletion_DATA += bash-completion/fdisk +endif +if BUILD_SFDISK +dist_bashcompletion_DATA += bash-completion/sfdisk +endif +if BUILD_CFDISK +dist_bashcompletion_DATA += bash-completion/cfdisk +endif + +if BUILD_CHFN_CHSH +dist_bashcompletion_DATA += \ + bash-completion/chfn \ + bash-completion/chsh +endif +if BUILD_LAST +dist_bashcompletion_DATA += bash-completion/last +endif +if BUILD_LSLOGINS +dist_bashcompletion_DATA += bash-completion/lslogins +endif +if BUILD_NEWGRP +dist_bashcompletion_DATA += bash-completion/newgrp +endif + +if BUILD_SU +dist_bashcompletion_DATA += bash-completion/su +endif + +if BUILD_RUNUSER +install-data-hook-bashcomp-runuser:: +if BUILD_SU + ln -sf su $(DESTDIR)$(bashcompletiondir)/runuser +else + cp $(top_srcdir)/bash-completion/su $(DESTDIR)$(bashcompletiondir)/runuser +endif +INSTALL_DATA_HOOKS += install-data-hook-bashcomp-runuser +endif + +if BUILD_UTMPDUMP +dist_bashcompletion_DATA += bash-completion/utmpdump +endif +if BUILD_LIBUUID +dist_bashcompletion_DATA += bash-completion/uuidgen +endif +if BUILD_UUIDPARSE +dist_bashcompletion_DATA += bash-completion/uuidparse +endif +if BUILD_UUIDD +dist_bashcompletion_DATA += bash-completion/uuidd +endif +if BUILD_LSBLK +dist_bashcompletion_DATA += bash-completion/lsblk +endif +if BUILD_LSLOCKS +dist_bashcompletion_DATA += bash-completion/lslocks +endif +if BUILD_RENAME +dist_bashcompletion_DATA += bash-completion/rename +endif +if BUILD_CHRT +dist_bashcompletion_DATA += bash-completion/chrt +endif +if BUILD_IONICE +dist_bashcompletion_DATA += bash-completion/ionice +endif +if BUILD_TASKSET +dist_bashcompletion_DATA += bash-completion/taskset +endif + +if BUILD_CHCPU +dist_bashcompletion_DATA += bash-completion/chcpu +endif +if BUILD_CHMEM +dist_bashcompletion_DATA += bash-completion/chmem +endif +if BUILD_EJECT +dist_bashcompletion_DATA += bash-completion/eject +endif +if BUILD_FALLOCATE +dist_bashcompletion_DATA += bash-completion/fallocate +endif +if BUILD_HWCLOCK +dist_bashcompletion_DATA += bash-completion/hwclock +endif +if BUILD_TUNELP +dist_bashcompletion_DATA += bash-completion/tunelp +endif +if BUILD_LSCPU +dist_bashcompletion_DATA += bash-completion/lscpu +endif +if BUILD_LSMEM +dist_bashcompletion_DATA += bash-completion/lsmem +endif +if BUILD_LOSETUP +dist_bashcompletion_DATA += bash-completion/losetup +endif +if BUILD_MOUNT +dist_bashcompletion_DATA += bash-completion/mount +dist_bashcompletion_DATA += bash-completion/umount +endif +if BUILD_MOUNTPOINT +dist_bashcompletion_DATA += bash-completion/mountpoint +endif +if BUILD_NSENTER +dist_bashcompletion_DATA += bash-completion/nsenter +endif +if BUILD_PIVOT_ROOT +dist_bashcompletion_DATA += bash-completion/pivot_root +endif +if BUILD_SETPRIV +dist_bashcompletion_DATA += bash-completion/setpriv +endif +if BUILD_SWAPON +dist_bashcompletion_DATA += bash-completion/swapon +dist_bashcompletion_DATA += bash-completion/swapoff +endif +if BUILD_UNSHARE +dist_bashcompletion_DATA += bash-completion/unshare +endif +if BUILD_WDCTL +dist_bashcompletion_DATA += bash-completion/wdctl +endif +if BUILD_BLKDISCARD +dist_bashcompletion_DATA += bash-completion/blkdiscard +endif +if BUILD_BLKZONE +dist_bashcompletion_DATA += bash-completion/blkzone +endif +if BUILD_CTRLALTDEL +dist_bashcompletion_DATA += bash-completion/ctrlaltdel +endif +if BUILD_DMESG +dist_bashcompletion_DATA += bash-completion/dmesg +endif +if BUILD_FSFREEZE +dist_bashcompletion_DATA += bash-completion/fsfreeze +endif +if BUILD_FSTRIM +dist_bashcompletion_DATA += bash-completion/fstrim +endif +if BUILD_LDATTACH +dist_bashcompletion_DATA += bash-completion/ldattach +endif +if BUILD_RFKILL +dist_bashcompletion_DATA += bash-completion/rfkill +endif +if BUILD_RTCWAKE +dist_bashcompletion_DATA += bash-completion/rtcwake +endif +if BUILD_SETARCH +dist_bashcompletion_DATA += bash-completion/setarch +endif +if BUILD_ZRAMCTL +dist_bashcompletion_DATA += bash-completion/zramctl +endif + +if BUILD_MESG +dist_bashcompletion_DATA += bash-completion/mesg +endif +if BUILD_WALL +dist_bashcompletion_DATA += bash-completion/wall +endif +if BUILD_WRITE +dist_bashcompletion_DATA += bash-completion/write +endif +if BUILD_SETTERM +dist_bashcompletion_DATA += bash-completion/setterm +endif + +if BUILD_MORE +dist_bashcompletion_DATA += bash-completion/more +endif +if BUILD_PG +dist_bashcompletion_DATA += bash-completion/pg +endif +if BUILD_UL +dist_bashcompletion_DATA += bash-completion/ul +endif + +endif # BUILD_BASH_COMPLETION diff --git a/bash-completion/addpart b/bash-completion/addpart new file mode 100644 index 0000000..3179639 --- /dev/null +++ b/bash-completion/addpart @@ -0,0 +1,23 @@ +_addpart_module() +{ + local cur + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + case $COMP_CWORD in + 1) + OPTS="--help --version $(lsblk -pnro name)" + 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/bash-completion/blkdiscard b/bash-completion/blkdiscard new file mode 100644 index 0000000..64a5c34 --- /dev/null +++ b/bash-completion/blkdiscard @@ -0,0 +1,35 @@ +_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'|'-p'|'--step') + COMPREPLY=( $(compgen -W "num" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --offset + --length + --step + --secure + --zeroout + --verbose + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _blkdiscard_module blkdiscard diff --git a/bash-completion/blkid b/bash-completion/blkid new file mode 100644 index 0000000..57b34c3 --- /dev/null +++ b/bash-completion/blkid @@ -0,0 +1,98 @@ +_blkid_module() +{ + local cur prev OPTS OUTPUT_ALL + OUTPUT_ALL='' + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-c'|'--cache-file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-o'|'--output') + COMPREPLY=( $(compgen -W "value device export full" -- $cur) ) + return 0 + ;; + '-s'|'--match-tag') + COMPREPLY=( $(compgen -W "tag" -- $cur) ) + return 0 + ;; + '-t'|'--match-token') + COMPREPLY=( $(compgen -W "TYPE= LABEL= UUID=" -- $cur) ) + return 0 + ;; + '-L'|'--label') + COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) ) + return 0 + ;; + '-U'|'--uuid') + COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) ) + return 0 + ;; + '-S'|'--size') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-O'|'--offset') + COMPREPLY=( $(compgen -W "offset" -- $cur) ) + return 0 + ;; + '-u'|'--usages') + OUTPUT_ALL={,no}{filesystem,raid,crypto,other} + ;; + '-n'|'--match-types') + OUTPUT_ALL=" + $(awk '{print $NF}' /proc/filesystems) + $(\ls /lib/modules/$(uname -r)/kernel/fs) + " + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + if [ -n "$OUTPUT_ALL" ]; then + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) + return 0 + fi + case $cur in + -*) + OPTS=" + --cache-file + --no-encoding + --garbage-collect + --output + --list-filesystems + --match-tag + --match-token + --list-one + --label + --uuid + --probe + --info + --size + --offset + --usages + --match-types + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _blkid_module blkid diff --git a/bash-completion/blkzone b/bash-completion/blkzone new file mode 100755 index 0000000..a50684d --- /dev/null +++ b/bash-completion/blkzone @@ -0,0 +1,52 @@ +_blkzone_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 "sector" -- $cur) ) + return 0 + ;; + '-l'|'--length') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-c'|'--count') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + case $prev in + 'report'|'reset') + OPTS="--verbose --offset --length --count" + ;; + *) + OPTS="--help --version" + ;; + esac + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + *) + case $prev in + 'report'|'reset') + ;; + *) + OPTS="report reset" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + ;; + esac + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _blkzone_module blkzone diff --git a/bash-completion/blockdev b/bash-completion/blockdev new file mode 100644 index 0000000..e7aca26 --- /dev/null +++ b/bash-completion/blockdev @@ -0,0 +1,44 @@ +_blockdev_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + DEVS="$(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 + ;; + '--setra'|'--setfra') + COMPREPLY=( $(compgen -W "sectors" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _blockdev_module blockdev diff --git a/bash-completion/cal b/bash-completion/cal new file mode 100644 index 0000000..e627bdb --- /dev/null +++ b/bash-completion/cal @@ -0,0 +1,29 @@ +_cal_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + case $cur in + -*) + OPTS=" --one + --three + --months + --sunday + --span + --monday + --julian + --year + --twelve + --week + --color=auto + --color=always + --color=never + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _cal_module cal diff --git a/bash-completion/cfdisk b/bash-completion/cfdisk new file mode 100644 index 0000000..8921fa3 --- /dev/null +++ b/bash-completion/cfdisk @@ -0,0 +1,29 @@ +_cfdisk_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-L'|'--color') + COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) + return 0 + ;; + '-V'|'--version'|'h'|'--help') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --color + --zero + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _cfdisk_module cfdisk diff --git a/bash-completion/chcpu b/bash-completion/chcpu new file mode 100644 index 0000000..0d96c25 --- /dev/null +++ b/bash-completion/chcpu @@ -0,0 +1,59 @@ +_chcpu_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-e'|'--enable') + local prefix realcur CPULIST_ALL CPULIST + realcur="${cur##*,}" + prefix="${cur%$realcur}" + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then + CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) + return 0 + ;; + '-d'|'--disable') + local prefix realcur CPULIST_ALL CPULIST + realcur="${cur##*,}" + prefix="${cur%$realcur}" + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then + CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) + return 0 + ;; + '-c'|'--configure'|'-g'|'--deconfigure') + COMPREPLY=( $(compgen -W "cpu-list" -- $cur) ) + return 0 + ;; + '-p'|'--dispatch') + COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--help + --enable + --disable + --configure + --deconfigure + --dispatch + --rescan + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _chcpu_module chcpu diff --git a/bash-completion/chfn b/bash-completion/chfn new file mode 100644 index 0000000..1ca0f72 --- /dev/null +++ b/bash-completion/chfn @@ -0,0 +1,22 @@ +_chfn_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-u'|'--help'|'-v'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--full-name --office --office-phone --home-phone --help --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -u -- $cur) ) + return 0 +} +complete -F _chfn_module chfn diff --git a/bash-completion/chmem b/bash-completion/chmem new file mode 100644 index 0000000..3e3af87 --- /dev/null +++ b/bash-completion/chmem @@ -0,0 +1,30 @@ +_chmem_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --enable + --disable + --blocks + --verbose + --zone + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "size range blockrange" -- $cur) ) + return 0 +} +complete -F _chmem_module chmem diff --git a/bash-completion/chrt b/bash-completion/chrt new file mode 100644 index 0000000..ce0b915 --- /dev/null +++ b/bash-completion/chrt @@ -0,0 +1,52 @@ +_chrt_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + '-T'|'--sched-runtime'|'-P'|'--sched-period'|'-D'|'--sched-deadline') + COMPREPLY=( $(compgen -W "nanoseconds" -- $cur) ) + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --all-tasks + --batch + --deadline + --fifo + --help + --idle + --max + --other + --pid + --reset-on-fork + --rr + --sched-deadline + --sched-period + --sched-runtime + --verbose + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local i + for i in ${COMP_WORDS[*]}; do + case $i in + '-p'|'--pid') + COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) + return 0 + ;; + esac + done + COMPREPLY=( $(compgen -c -- $cur) ) + return 0 +} +complete -F _chrt_module chrt diff --git a/bash-completion/chsh b/bash-completion/chsh new file mode 100644 index 0000000..fbf8add --- /dev/null +++ b/bash-completion/chsh @@ -0,0 +1,26 @@ +_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 "$($1 -l)" -- $cur) ) + return 0 + ;; + '-u'|'--help'|'-v'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--shell --list-shells --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -u -- $cur) ) + return 0 +} +complete -F _chsh_module chsh diff --git a/bash-completion/col b/bash-completion/col new file mode 100644 index 0000000..cea57b5 --- /dev/null +++ b/bash-completion/col @@ -0,0 +1,27 @@ +_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 + ;; + '-H'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--no-backspaces + --fine + --pass + --tabs + --spaces + --lines + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _col_module col diff --git a/bash-completion/colcrt b/bash-completion/colcrt new file mode 100644 index 0000000..c66d7e6 --- /dev/null +++ b/bash-completion/colcrt @@ -0,0 +1,27 @@ +_colcrt_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --no-underlining + --half-lines + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _colcrt_module colcrt diff --git a/bash-completion/colrm b/bash-completion/colrm new file mode 100644 index 0000000..622dbaa --- /dev/null +++ b/bash-completion/colrm @@ -0,0 +1,29 @@ +_colrm_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--version --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/bash-completion/column b/bash-completion/column new file mode 100644 index 0000000..c5a998b --- /dev/null +++ b/bash-completion/column @@ -0,0 +1,62 @@ +_column_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-c'|'--output-width') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-s'|'--separator'|'-o'|'--output-separator'|'-n'|'--table-name'|'-O') + COMPREPLY=( $(compgen -W "string" -- $cur) ) + return 0 + ;; + '-O'|'--table-order'|'-N'|'--table-columns'|'-E'|'--table-noextreme'|'-H'|'--table-hide'|'-R'|'--table-right'|'-T'|'--table-truncate'|'-W'|'--table-wrap') + COMPREPLY=( $(compgen -W "string" -- $cur) ) + return 0 + ;; + '-r'|'--tree'|'-i'|'--tree-id'|'-p'|'--tree-parent') + COMPREPLY=( $(compgen -W "string" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--columns + --table + --table-name + --table-order + --table-columns + --table-noextreme + --table-noheadings + --table-header-repeat + --table-hide + --table-right + --table-truncate + --table-wrap + --table-empty-lines + --json + --tree + --tree-id + --tree-parent + --output-width + --separator + --output-separator + --fillrows + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _column_module column diff --git a/bash-completion/ctrlaltdel b/bash-completion/ctrlaltdel new file mode 100644 index 0000000..bc8a943 --- /dev/null +++ b/bash-completion/ctrlaltdel @@ -0,0 +1,17 @@ +_ctrlaltdel_module() +{ + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $(compgen -W "hard soft" -- $cur) ) + fi + return 0 +} +complete -F _ctrlaltdel_module ctrlaltdel diff --git a/bash-completion/delpart b/bash-completion/delpart new file mode 100644 index 0000000..d5a92ef --- /dev/null +++ b/bash-completion/delpart @@ -0,0 +1,24 @@ +_delpart_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $COMP_CWORD in + 1) + OPTS="--help --version $(lsblk -pnro name)" + 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/bash-completion/dmesg b/bash-completion/dmesg new file mode 100644 index 0000000..5073e5b --- /dev/null +++ b/bash-completion/dmesg @@ -0,0 +1,63 @@ + +_dmesg_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-F'|'--file') + local IFS=$'\n' + 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 + ;; + '--time-format') + COMPREPLY=( $(compgen -W "delta reltime ctime notime iso" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--clear + --read-clear + --console-off + --show-delta + --reltime + --console-on + --file + --facility + --human + --kernel + --color + --level + --console-level + --nopager + --raw + --syslog + --buffer-size + --ctime + --notime + --time-format + --userspace + --follow + --decode + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _dmesg_module dmesg diff --git a/bash-completion/eject b/bash-completion/eject new file mode 100644 index 0000000..327ef1b --- /dev/null +++ b/bash-completion/eject @@ -0,0 +1,64 @@ +_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 --listspeed 2>/dev/null)" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--auto + --changerslot + --default + --floppy + --force + --manualeject + --no-unmount + --no-partitions-unmount + --noop + --proc + --tape + --cdrom + --scsi + --trayclose + --traytoggle + --verbose + --cdspeed + --listspeed + --help + --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/bash-completion/fallocate b/bash-completion/fallocate new file mode 100644 index 0000000..670874c --- /dev/null +++ b/bash-completion/fallocate @@ -0,0 +1,41 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --collapse-range + --dig-holes + --insert-range + --length + --keep-size + --offset + --punch-hole + --zero-range + --posix + --verbose + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _fallocate_module fallocate diff --git a/bash-completion/fdformat b/bash-completion/fdformat new file mode 100644 index 0000000..09cb0a2 --- /dev/null +++ b/bash-completion/fdformat @@ -0,0 +1,29 @@ +_fdformat_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--from'|'-t'|'--to'|'-r'|'--repair') + COMPREPLY=( $(compgen -W "track_num" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + DEVS=$(for I in echo /dev/fd*; do if [ -e $I ]; then echo $I; fi; done) + OPTS=" + --from + --to + --repair + --no-verify + --help + --version + $DEVS + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _fdformat_module fdformat diff --git a/bash-completion/fdisk b/bash-completion/fdisk new file mode 100644 index 0000000..855de14 --- /dev/null +++ b/bash-completion/fdisk @@ -0,0 +1,97 @@ +_fdisk_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-s'|'--getsz') + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 + ;; + '-b'|'--sector-size') + COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) ) + return 0 + ;; + '-c'|'--compatibility') + COMPREPLY=( $(compgen -W "dos nondos" -- $cur) ) + return 0 + ;; + '-L'|'--color') + COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) + return 0 + ;; + '--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL=" + Attrs + Boot + Bsize + Cpg + Cylinders + Device + End + End-C/H/S + Flags + Fsize + Id + Name + Sectors + Size + Slice + Start + Start-C/H/S + Type + Type-UUID + UUID + " + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) + return 0 + ;; + '-u'|'--units') + COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) ) + return 0 + ;; + '-C'|'--cylinders'|'-H'|'--heads'|'-S'|'--sectors') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-v'|'--version'|'-V'|'--list') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--sector-size + --protect-boot + --compatibility + --color + --list + --output + --type + --units + --getsz + --bytes + --wipe + --wipe-partitions + --cylinders + --heads + --sectors + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _fdisk_module fdisk diff --git a/bash-completion/fincore b/bash-completion/fincore new file mode 100644 index 0000000..3639763 --- /dev/null +++ b/bash-completion/fincore @@ -0,0 +1,46 @@ +_fincore_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL='PAGES SIZE FILE RES' + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --json + --bytes + --noheadings + --output + --raw + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) + return 0 +} +complete -F _fincore_module fincore diff --git a/bash-completion/findfs b/bash-completion/findfs new file mode 100644 index 0000000..5297b86 --- /dev/null +++ b/bash-completion/findfs @@ -0,0 +1,34 @@ +_findfs_module() +{ + local cur prev OPTS findable + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + for i in $(lsblk -rpno label); do + findable+=" LABEL=$i" + done + for i in $(lsblk -rpno uuid); do + findable+=" UUID=$i" + done + for i in $(lsblk -rpno partlabel); do + findable+=" PARTLABEL=$i" + done + for i in $(lsblk -rpno partuuid); do + findable+=" PARTUUID=$i" + done + COMPREPLY=( $(compgen -W "$findable" -- $cur) ) + return 0 +} +complete -F _findfs_module findfs diff --git a/bash-completion/findmnt b/bash-completion/findmnt new file mode 100644 index 0000000..7270d36 --- /dev/null +++ b/bash-completion/findmnt @@ -0,0 +1,144 @@ +_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') + local IFS=$'\n' + 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 < <($1 -rno OPTIONS) + COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + + OUTPUT_ALL="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" + + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-t'|'--types') + local TYPES + TYPES="adfs affs autofs cifs coda coherent cramfs + debugfs devpts efs 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" + COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) + return 0 + ;; + '-S'|'--source') + local DEV_MPOINT + DEV_MPOINT=$($1 -rno SOURCE | grep ^/dev) + COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) + return 0 + ;; + '-T'|'--target') + local DEV_MPOINT + DEV_MPOINT=$($1 -rno TARGET) + COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) + return 0 + ;; + '-M'|'--mountpoint') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--fstab + --mtab + --kernel + --poll + --timeout + --all + --ascii + --canonicalize + --df + --direction + --evaluate + --tab-file + --first-only + --invert + --json + --list + --task + --noheadings + --notruncate + --options + --output + --output-all + --pairs + --raw + --types + --nofsroot + --submounts + --source + --target + --mountpoint + --help + --tree + --real + --pseudo + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local DEV_MPOINT + DEV_MPOINT=$($1 -rno TARGET,SOURCE) + COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) + return 0 +} +complete -F _findmnt_module findmnt diff --git a/bash-completion/flock b/bash-completion/flock new file mode 100644 index 0000000..cb68245 --- /dev/null +++ b/bash-completion/flock @@ -0,0 +1,47 @@ +_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 "{0..255}" -- $cur) ) + return 0 + ;; + '-c'|'--command') + compopt -o bashdefault + COMPREPLY=( $(compgen -c -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--shared + --exclusive + --unlock + --nonblock + --timeout + --conflict-exit-code + --close + --command + --no-fork + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) + return 0 +} +complete -F _flock_module flock diff --git a/bash-completion/fsck b/bash-completion/fsck new file mode 100644 index 0000000..e5b4f53 --- /dev/null +++ b/bash-completion/fsck @@ -0,0 +1,39 @@ +_fsck_module() +{ + local cur prev OPTS + 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 + ;; + '-?') + 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 + COMPREPLY=( $(compgen -W "$(find -L /dev/ -path /dev/fd -prune \ + -o -type b -print 2>/dev/null)" -- $cur) ) + return 0 +} +complete -F _fsck_module fsck diff --git a/bash-completion/fsck.cramfs b/bash-completion/fsck.cramfs new file mode 100644 index 0000000..d17d2fe --- /dev/null +++ b/bash-completion/fsck.cramfs @@ -0,0 +1,33 @@ +_fsck.cramfs_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-b'|'--blocksize') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '--extract') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + COMPREPLY=( $(compgen -W "--verbose --blocksize --extract --help --version" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _fsck.cramfs_module fsck.cramfs diff --git a/bash-completion/fsck.minix b/bash-completion/fsck.minix new file mode 100644 index 0000000..ac4571e --- /dev/null +++ b/bash-completion/fsck.minix @@ -0,0 +1,16 @@ +_fsck.minix_module() +{ + local cur OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + case $cur in + -*) + OPTS="--list --auto --repair --verbose --super --uncleared --force --help --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _fsck.minix_module fsck.minix diff --git a/bash-completion/fsfreeze b/bash-completion/fsfreeze new file mode 100644 index 0000000..05bd68e --- /dev/null +++ b/bash-completion/fsfreeze @@ -0,0 +1,24 @@ +_fsfreeze_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--freeze --unfreeze --help --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/bash-completion/fstrim b/bash-completion/fstrim new file mode 100644 index 0000000..d5c1481 --- /dev/null +++ b/bash-completion/fstrim @@ -0,0 +1,36 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--all + --fstab + --offset + --length + --minimum + --verbose + --dry-run + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local MPOINTS + MPOINTS=$(findmnt -rno SOURCE,TARGET | awk '/^\/dev/{print $2}') + COMPREPLY=( $(compgen -W "$MPOINTS" -- $cur) ) + return 0 +} +complete -F _fstrim_module fstrim diff --git a/bash-completion/getopt b/bash-completion/getopt new file mode 100644 index 0000000..5e3fca6 --- /dev/null +++ b/bash-completion/getopt @@ -0,0 +1,37 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--alternative --help --longoptions --name --options --quiet --quiet-output --shell --test --unquoted --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _getopt_module getopt diff --git a/bash-completion/hexdump b/bash-completion/hexdump new file mode 100644 index 0000000..80b1ab6 --- /dev/null +++ b/bash-completion/hexdump @@ -0,0 +1,53 @@ +_hexdump_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-L'|'--color') + COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) + return 0 + ;; + '-e'|'--format') + COMPREPLY=( $(compgen -W "format" -- $cur) ) + return 0 + ;; + '-n'|'--length') + COMPREPLY=( $(compgen -W "length" -- $cur) ) + return 0 + ;; + '-s'|'--skip') + COMPREPLY=( $(compgen -W "offset" -- $cur) ) + return 0 + ;; + '-V'|'--version'|'-h'|'--help') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --one-byte-octal + --one-byte-char + --canonical + --two-bytes-decimal + --two-bytes-octal + --two-bytes-hex + --color= + --format + --format-file + --length + --skip + --no-squeezing + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _hexdump_module hexdump diff --git a/bash-completion/hwclock b/bash-completion/hwclock new file mode 100644 index 0000000..faf29af --- /dev/null +++ b/bash-completion/hwclock @@ -0,0 +1,58 @@ +_hwclock_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--rtc'|'--adjfile') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '--date'|'--delay') + COMPREPLY=( $(compgen -W "time" -- $cur) ) + return 0 + ;; + '--epoch') + COMPREPLY=( $(compgen -W "year" -- $cur) ) + return 0 + ;; + '-h'|'-?'|'--help'|'-v'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--help + --show + --get + --set + --hctosys + --systohc + --systz + --adjust + --getepoch + --setepoch + --predict + --version + --utc + --localtime + --rtc + --directisa + --date + --delay + --epoch + --update-drift + --noadjfile + --adjfile + --test + --debug" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _hwclock_module hwclock diff --git a/bash-completion/ionice b/bash-completion/ionice new file mode 100644 index 0000000..9608727 --- /dev/null +++ b/bash-completion/ionice @@ -0,0 +1,50 @@ +_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 "{0..3} none realtime best-effort idle" -- $cur) ) + return 0 + ;; + '-n'|'--classdata') + COMPREPLY=( $(compgen -W "{0..7}" -- $cur) ) + return 0 + ;; + '-P'|'--pgid') + local PGID + PGID="$(awk '{print $5}' /proc/*/stat 2>/dev/null | sort -u)" + COMPREPLY=( $(compgen -W "$PGID" -- $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'|'--uid') + local UIDS + UIDS="$(stat --format='%u' /proc/[0-9]* | sort -u)" + COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--class --classdata --pid --pgid --ignore --uid --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _ionice_module ionice diff --git a/bash-completion/ipcmk b/bash-completion/ipcmk new file mode 100644 index 0000000..696266c --- /dev/null +++ b/bash-completion/ipcmk @@ -0,0 +1,27 @@ +_ipcmk_module() +{ + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-M'|'--shmem') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-S'|'--semaphore') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-p'|'--mode') + COMPREPLY=( $(compgen -W "mode" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "--shmem --semaphore --queue --mode --help --version" -- $cur) ) + return 0 +} +complete -F _ipcmk_module ipcmk diff --git a/bash-completion/ipcrm b/bash-completion/ipcrm new file mode 100644 index 0000000..1ed03f9 --- /dev/null +++ b/bash-completion/ipcrm @@ -0,0 +1,62 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + '=') + cur=${cur#=} + COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) ) + return 0 + ;; + esac + OPTS=" --shmem-id + --shmem-key + --queue-id + --queue-key + --semaphore-id + --semaphore-key + --all= + --verbose + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _ipcrm_module ipcrm diff --git a/bash-completion/ipcs b/bash-completion/ipcs new file mode 100644 index 0000000..ce93e4d --- /dev/null +++ b/bash-completion/ipcs @@ -0,0 +1,33 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--id + --help + --version + --shmems + --queues + --semaphores + --all + --time + --pid + --creator + --limits + --summary + --human + --bytes" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _ipcs_module ipcs diff --git a/bash-completion/isosize b/bash-completion/isosize new file mode 100644 index 0000000..fec2f8b --- /dev/null +++ b/bash-completion/isosize @@ -0,0 +1,27 @@ +_isosize_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 "number" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + COMPREPLY=( $(compgen -W "--divisor --sectors --help --version" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _isosize_module isosize diff --git a/bash-completion/last b/bash-completion/last new file mode 100644 index 0000000..fcd8021 --- /dev/null +++ b/bash-completion/last @@ -0,0 +1,53 @@ +_last_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-n'|'--limit') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-s'|'--since'|'-t'|'--until'|'-p'|'--present') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '--time-format') + COMPREPLY=( $(compgen -W "notime short full iso" -- $cur) ) + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --hostlast + --dns + --file + --fulltimes + --ip + --limit + --nohostname + --since + --until + --present + --fullnames + --system + --time-format + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -u -- $cur) ) + return 0 +} +complete -F _last_module last diff --git a/bash-completion/ldattach b/bash-completion/ldattach new file mode 100644 index 0000000..02b4b5b --- /dev/null +++ b/bash-completion/ldattach @@ -0,0 +1,68 @@ +_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 + ;; + '-c'|'--intro-command') + COMPREPLY=( $(compgen -W "string" -- $cur) ) + return 0 + ;; + '-p'|'--pause') + COMPREPLY=( $(compgen -W "seconds" -- $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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--debug + --speed + --intro-command + --pause + --sevenbits + --eightbits + --noparity + --evenparity + --oddparity + --onestopbit + --twostopbits + --iflag + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + /*) + local IFS=$'\n' + 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/bash-completion/logger b/bash-completion/logger new file mode 100644 index 0000000..7fb9565 --- /dev/null +++ b/bash-completion/logger @@ -0,0 +1,78 @@ +_logger_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--file'|'--journald') + local IFS=$'\n' + 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 "{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 + ;; + '--socket-errors') + COMPREPLY=( $(compgen -W "on off auto" -- $cur) ) + return 0 + ;; + '--msgid') + COMPREPLY=( $(compgen -W "msgid" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --file + --help + --id + --journald + --msgid + --no-act + --octet-count + --port + --prio-prefix + --priority + --rfc3164 + --rfc5424 + --server + --size + --skip-empty + --socket + --socket-errors + --stderr + --tag + --tcp + --udp + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _logger_module logger diff --git a/bash-completion/look b/bash-completion/look new file mode 100644 index 0000000..feafe23 --- /dev/null +++ b/bash-completion/look @@ -0,0 +1,35 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--alternative --alphanum --ignore-case --terminate --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + case $COMP_CWORD in + 1) + COMPREPLY=( $(compgen -W "$(look "$cur")" -- $cur) ) + ;; + 2) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + ;; + esac + return 0 +} +complete -F _look_module look diff --git a/bash-completion/losetup b/bash-completion/losetup new file mode 100644 index 0000000..d207265 --- /dev/null +++ b/bash-completion/losetup @@ -0,0 +1,79 @@ +_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="$($1 --output NAME | awk '{if (1 < NR) {print}}')" + COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) + return 0 + ;; + '-j'|'--associated') + ARG="$($1 --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') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="NAME AUTOCLEAR BACK-FILE BACK-INO + BACK-MAJ:MIN MAJ:MIN OFFSET PARTSCAN RO + SIZELIMIT DIO" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--all + --detach + --detach-all + --find + --set-capacity + --associated + --nooverlap + --offset + --sizelimit + --partscan + --read-only + --show + --verbose + --json + --list + --noheadings + --output + --output-all + --raw + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _losetup_module losetup diff --git a/bash-completion/lsblk b/bash-completion/lsblk new file mode 100644 index 0000000..bd86f9f --- /dev/null +++ b/bash-completion/lsblk @@ -0,0 +1,89 @@ +_lsblk_module() +{ + local cur prev OPTS LSBLK_COLS_ALL + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + LSBLK_COLS_ALL=" + NAME KNAME MAJ:MIN FSTYPE MOUNTPOINT LABEL UUID PARTTYPE + PARTLABEL PARTUUID PARTFLAGS RA RO RM HOTPLUG MODEL SERIAL 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 SUBSYSTEMS REV VENDOR + " + + case $prev in + '-e'|'--exclude'|'-I'|'--include') + local realcur prefix MAJOR_ALL MAJOR I J + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for I in /sys/dev/block/*; do + J=${I##*/} + MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}" + done + for WORD in ${MAJOR_ALL:-""}; do + if ! [[ $prefix == *"$WORD"* ]]; then + MAJOR="$WORD ${MAJOR:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur LSBLK_COLS + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $LSBLK_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + LSBLK_COLS="$WORD ${LSBLK_COLS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$LSBLK_COLS" -S ',' -- $realcur) ) + return 0 + ;; + '-x'|'--sort') + compopt -o nospace + COMPREPLY=( $(compgen -W "$LSBLK_COLS_ALL" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--all + --bytes + --nodeps + --discard + --exclude + --fs + --help + --include + --json + --ascii + --list + --perms + --noheadings + --output + --output-all + --paths + --pairs + --raw + --inverse + --topology + --scsi + --sort + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$($1 -pnro name)" -- $cur) ) + return 0 +} +complete -F _lsblk_module lsblk diff --git a/bash-completion/lscpu b/bash-completion/lscpu new file mode 100644 index 0000000..4d3582f --- /dev/null +++ b/bash-completion/lscpu @@ -0,0 +1,52 @@ +_lscpu_module() +{ + local cur OPTS_ALL + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '--extended='|'=') + local prefix realcur OPTS + cur=${cur#=} + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OPTS_ALL="CPU CORE SOCKET NODE + BOOK DRAWER CACHE POLARIZATION ADDRESS + CONFIGURED ONLINE MAXMHZ MINMHZ" + for WORD in $OPTS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OPTS="$WORD ${OPTS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OPTS" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS_ALL="--all + --online + --offline + --json + --extended= + --parse= + --sysroot + --hex + --physical + --output-all + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _lscpu_module lscpu diff --git a/bash-completion/lsipc b/bash-completion/lsipc new file mode 100644 index 0000000..a40fe42 --- /dev/null +++ b/bash-completion/lsipc @@ -0,0 +1,71 @@ +_lsipc_module() +{ + local cur prev OPTS ARG + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-i'|'--id') + COMPREPLY=( $(compgen -W "id" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + '--time-format') + COMPREPLY=( $(compgen -W "short full iso" -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL=" + KEY ID OWNER PERMS CUID CUSER CGID + CGROUP UID USER GID GROUP CTIME + + SIZE NATTCH STATUS ATTACH DETACH + COMMAND CPID LPID + + USEDBYTES MSGS SEND RECV LSPID LRPID + + NSEMS OTIME + + RESOURCE DESCRIPTION LIMIT USED USE% + " + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + esac + OPTS=" + --shmems + --queues + --semaphores + --global + --id + --noheadings + --notruncate + --time-format + --bytes + --creator + --export + --json + --newline + --list + --output + --numeric-perms + --raw + --time + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _lsipc_module lsipc diff --git a/bash-completion/lslocks b/bash-completion/lslocks new file mode 100644 index 0000000..fbe75ff --- /dev/null +++ b/bash-completion/lslocks @@ -0,0 +1,50 @@ +_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') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS=" + --json + --noinaccessible + --noheadings + --output + --output-all + --pid + --raw + --notruncate + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + +} +complete -F _lslocks_module lslocks diff --git a/bash-completion/lslogins b/bash-completion/lslogins new file mode 100755 index 0000000..8651fe9 --- /dev/null +++ b/bash-completion/lslogins @@ -0,0 +1,77 @@ +_lslogins_module() +{ + local cur prev OPTS LSLOGINS_COLS_ALL + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + LSLOGINS_COLS_ALL=" + USER UID GECOS HOMEDIR SHELL NOLOGIN PWD-LOCK PWD-EMPTY + PWD-DENY GROUP GID SUPP-GROUPS SUPP-GIDS LAST-LOGIN LAST-TTY + LAST-HOSTNAME FAILED-LOGIN FAILED-TTY HUSHED PWD-WARN + PWD-CHANGE PWD-MIN PWD-MAX PWD-EXPIR CONTEXT PROC + " + case $prev in + '-g'|'--groups') + COMPREPLY=( $(compgen -W "$(getent group | awk -F: '{print $1}')" -- $cur) ) + return 0 + ;; + '-l'|'--logins') + COMPREPLY=( $(compgen -W "$(getent passwd | awk -F: '{print $1}')" -- $cur) ) + return 0 + ;; + '--time-format') + COMPREPLY=( $(compgen -W "short full iso" -- $cur) ) + return 0 + ;; + '--wtmp-file'|'--btmp-file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur LSLOGINS_COLS + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $LSLOGINS_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$LSLOGINS_COLS" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + COMPREPLY=( $(compgen -W " + --acc-expiration + --colon-separate + --export + --failed + --supp-groups + --groups + --last + --logins + --newline + --noheadings + --notruncate + --output + --output-all + --pwd + --raw + --system-accs + --time-format + --user-accs + --context + --print0 + --wtmp-file + --btmp-file + --help + --version + " -- $cur) ) + return 0 +} +complete -F _lslogins_module lslogins diff --git a/bash-completion/lsmem b/bash-completion/lsmem new file mode 100644 index 0000000..7d6e842 --- /dev/null +++ b/bash-completion/lsmem @@ -0,0 +1,53 @@ +_lsmem_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES' + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) + return 0 + ;; + '-s'|'--sysroot') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 + ;; + '--summary') + COMPREPLY=( $(compgen -W "never always only" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS=" + --json + --pairs + --all + --bytes + --noheadings + --output + --output-all + --raw + --sysroot + --summary + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _lsmem_module lsmem diff --git a/bash-completion/lsns b/bash-completion/lsns new file mode 100644 index 0000000..8964606 --- /dev/null +++ b/bash-completion/lsns @@ -0,0 +1,57 @@ +_lsns_module() +{ + local cur prev OPTS LSNS_COLS_ALL + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + LSNS_COLS_ALL=" + NS TYPE PATH NPROCS PID PPID COMMAND UID USER + " + case $prev in + '-o'|'--output') + local prefix realcur LSNS_COLS + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $LSNS_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + LSNS_COLS="$WORD ${LSNS_COLS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$LSNS_COLS" -S ',' -- $realcur) ) + return 0 + ;; + '-p'|'--task') + COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) ) + return 0 + ;; + '-t'|'--type') + COMPREPLY=( $(compgen -W "mnt net ipc user pid uts cgroup" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + COMPREPLY=( $(compgen -W " + --json + --list + --noheadings + --output + --output-all + --task + --raw + --notruncate + --type + --help + --version + " -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "mnt net pid uts ipc user" -- $cur ) ) + return 0 +} +complete -F _lsns_module lsns diff --git a/bash-completion/mcookie b/bash-completion/mcookie new file mode 100644 index 0000000..041582f --- /dev/null +++ b/bash-completion/mcookie @@ -0,0 +1,31 @@ +_mcookie_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-m'|'--max-size') + COMPREPLY=( $(compgen -W "bytes" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--file --max-size --verbose --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _mcookie_module mcookie diff --git a/bash-completion/mesg b/bash-completion/mesg new file mode 100644 index 0000000..1f80bab --- /dev/null +++ b/bash-completion/mesg @@ -0,0 +1,22 @@ +_mesg_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--verbose --version --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/bash-completion/mkfs b/bash-completion/mkfs new file mode 100644 index 0000000..a278747 --- /dev/null +++ b/bash-completion/mkfs @@ -0,0 +1,27 @@ +_mkfs_module() +{ + local cur prev OPTS + 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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS='--type --verbose --help --version' + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name) /path/to/file" -- $cur) ) + return 0 +} +complete -F _mkfs_module mkfs diff --git a/bash-completion/mkfs.bfs b/bash-completion/mkfs.bfs new file mode 100644 index 0000000..75458bb --- /dev/null +++ b/bash-completion/mkfs.bfs @@ -0,0 +1,30 @@ +_mkfs.bfs_module() +{ + local cur prev OPTS + 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 + ;; + '-h'|'--help'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS='--inodes --vname --fname --verbose --help --version' + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name) /path/to/file" -- $cur) ) + return 0 +} +complete -F _mkfs.bfs_module mkfs.bfs diff --git a/bash-completion/mkfs.cramfs b/bash-completion/mkfs.cramfs new file mode 100644 index 0000000..af74e12 --- /dev/null +++ b/bash-completion/mkfs.cramfs @@ -0,0 +1,44 @@ +_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 + ;; + '-h'|'-V') + 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 + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _mkfs.cramfs_module mkfs.cramfs diff --git a/bash-completion/mkfs.minix b/bash-completion/mkfs.minix new file mode 100644 index 0000000..e725fd6 --- /dev/null +++ b/bash-completion/mkfs.minix @@ -0,0 +1,32 @@ +_mkfs.minix_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-i'|'--inodes') + COMPREPLY=( $(compgen -W "inodes" -- $cur) ) + return 0 + ;; + '-l'|'--badblocks') + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-n'|'--namelength') + COMPREPLY=( $(compgen -W "14 30 60" -- $cur) ) + return 0 + ;; + esac + case $cur in + -*) + OPTS="--namelength --inodes --check --badblocks --help --version -1 -2 -3" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _mkfs.minix_module mkfs.minix diff --git a/bash-completion/mkswap b/bash-completion/mkswap new file mode 100644 index 0000000..6ccc214 --- /dev/null +++ b/bash-completion/mkswap @@ -0,0 +1,40 @@ +_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') + COMPREPLY=( $(compgen -W "$(uuidgen -r)" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--check --force --pagesize --label --swapversion --uuid --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _mkswap_module mkswap diff --git a/bash-completion/more b/bash-completion/more new file mode 100644 index 0000000..809cea2 --- /dev/null +++ b/bash-completion/more @@ -0,0 +1,30 @@ +_more_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-V') + return 0 + ;; + esac + 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 + + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _more_module more diff --git a/bash-completion/mount b/bash-completion/mount new file mode 100644 index 0000000..832947f --- /dev/null +++ b/bash-completion/mount @@ -0,0 +1,101 @@ +_mount_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-t'|'--types') + local prefix realcur TYPES + TYPES=" + $(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}') + $(awk '{print $NF, "no" $NF}' /proc/filesystems) + " + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $TYPES; do + if ! [[ $prefix == *"$WORD"* ]]; then + TYPE_COLS="$WORD ${TYPE_COLS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$TYPE_COLS" -S ',' -- $realcur) ) + return 0 + ;; + '-L'|'--label') + local LABELS + LABELS="$(lsblk -o LABEL -nr)" + COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) + return 0 + ;; + '-U'|'--uuid') + local UUIDS + UUIDS="$(lsblk -o UUID -nr)" + COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) + return 0 + ;; + '-N'|'--namespace') + local NAMESPACE + NAMESPACE="$(lsns --type mnt --output PATH --noheadings)" + COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) ) + return 0 + ;; + '--options-mode') + COMPREPLY=( $(compgen -W "ignore append prepend replace" -- $cur) ) + return 0 + ;; + '--options-source') + COMPREPLY=( $(compgen -W "fstab mtab disable" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --all + --no-canonicalize + --fake + --fork + --fstab + --help + --internal-only + --show-labels + --no-mtab + --options + --options-mode + --options-source + --options-source-force + --test-opts + --read-only + --types + --source + --target + --verbose + --version + --read-write + --namespace + --label + --uuid + --bind + --move + --rbind + --make-shared + --make-slave + --make-private + --make-unbindable + --make-rshared + --make-rslave + --make-rprivate + --make-runbindable" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _mount_module mount diff --git a/bash-completion/mountpoint b/bash-completion/mountpoint new file mode 100644 index 0000000..f14327c --- /dev/null +++ b/bash-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 + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--quiet --fs-devno --devno --help --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) + return 0 +} +complete -F _mountpoint_module mountpoint diff --git a/bash-completion/namei b/bash-completion/namei new file mode 100644 index 0000000..6402735 --- /dev/null +++ b/bash-completion/namei @@ -0,0 +1,24 @@ +_namei_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--help --version --mountpoints --modes --owners --long --nosymlinks --vertical" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _namei_module namei diff --git a/bash-completion/newgrp b/bash-completion/newgrp new file mode 100644 index 0000000..1e39c0f --- /dev/null +++ b/bash-completion/newgrp @@ -0,0 +1,22 @@ +_newgrp_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -g -- $cur) ) + return 0 +} +complete -F _newgrp_module newgrp diff --git a/bash-completion/nsenter b/bash-completion/nsenter new file mode 100644 index 0000000..ad56f06 --- /dev/null +++ b/bash-completion/nsenter @@ -0,0 +1,63 @@ +_nsenter_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-S'|'--uid') + COMPREPLY=( $(compgen -W "uid" -- $cur) ) + return 0 + ;; + '-G'|'--gid') + COMPREPLY=( $(compgen -W "gid" -- $cur) ) + return 0 + ;; + '-t'|'--target') + local PIDS + PIDS=$(cd /proc && echo [0-9]*) + COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + 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=" + --all + --target + --mount= + --uts= + --ipc= + --net= + --pid= + --cgroup= + --user= + --setuid + --setgid + --preserve-credentials + --root= + --wd= + --no-fork + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _nsenter_module nsenter diff --git a/bash-completion/partx b/bash-completion/partx new file mode 100644 index 0000000..028146b --- /dev/null +++ b/bash-completion/partx @@ -0,0 +1,65 @@ +_partx_module() +{ + local cur prev OPTS OUTPUT_ALL + COMPREPLY=() + OUTPUT_ALL="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') + local realcur prefix OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-S'|'--sector-size') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-t'|'--type') + COMPREPLY=( $(compgen -W "$(partx --list-types)" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --add + --delete + --update + --show + --bytes + --noheadings + --nr + --output + --output-all + --pairs + --raw + --sector-size + --type + --list-types + --verbose + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _partx_module partx diff --git a/bash-completion/pg b/bash-completion/pg new file mode 100644 index 0000000..8fce130 --- /dev/null +++ b/bash-completion/pg @@ -0,0 +1,33 @@ +_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 + ;; + '-h'|'-V') + 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 + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _pg_module pg diff --git a/bash-completion/pivot_root b/bash-completion/pivot_root new file mode 100644 index 0000000..95df4b4 --- /dev/null +++ b/bash-completion/pivot_root @@ -0,0 +1,21 @@ +_pivot_root_module() +{ + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $COMP_CWORD in + 1|2) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + ;; + esac + return 0 +} +complete -F _pivot_root_module pivot_root diff --git a/bash-completion/prlimit b/bash-completion/prlimit new file mode 100644 index 0000000..fc60c64 --- /dev/null +++ b/bash-completion/prlimit @@ -0,0 +1,69 @@ +_prlimit_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-p'|'--pid') + PIDS=$(cd /proc && echo [0-9]*) + COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + '=') + cur=${cur#=} + # FIXME: is there anything what could be printed + # as limit value(s) + ;; + -*) + OPTS="--pid + --output + --noheadings + --raw + --verbose + --help + --version + --core= + --data= + --nice= + --fsize= + --sigpending= + --memlock= + --rss= + --nofile= + --msgqueue= + --rtprio= + --stack= + --cpu= + --nproc= + --as= + --locks= + --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/bash-completion/raw b/bash-completion/raw new file mode 100644 index 0000000..20c3261 --- /dev/null +++ b/bash-completion/raw @@ -0,0 +1,23 @@ +_raw_module() +{ + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + local OPTS + OPTS="--query --all --help --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/bash-completion/readprofile b/bash-completion/readprofile new file mode 100644 index 0000000..bd265a6 --- /dev/null +++ b/bash-completion/readprofile @@ -0,0 +1,37 @@ +_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') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-M'|'--multiplier') + COMPREPLY=( $(compgen -W "multiplier" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--mapfile + --profile + --multiplier + --info + --verbose + --all + --histbin + --counters + --reset + --no-auto + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _readprofile_module readprofile diff --git a/bash-completion/rename b/bash-completion/rename new file mode 100644 index 0000000..9fc1cec --- /dev/null +++ b/bash-completion/rename @@ -0,0 +1,34 @@ +_rename_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--verbose --symlink --help --version --no-act --no-override --interactive" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + case $COMP_CWORD in + 1) + COMPREPLY=( $(compgen -W "expression" -- $cur) ) + ;; + 2) + COMPREPLY=( $(compgen -W "replacement" -- $cur) ) + ;; + *) + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + ;; + esac + return 0 +} +complete -F _rename_module rename diff --git a/bash-completion/renice b/bash-completion/renice new file mode 100644 index 0000000..2495f37 --- /dev/null +++ b/bash-completion/renice @@ -0,0 +1,41 @@ +_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 "{-20..20}" -- $cur) ) + return 0 + ;; + '-p'|'--pid') + local PIDS + PIDS=$(cd /proc && echo [0-9]*) + COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) + return 0 + ;; + '-u'|'--user') + COMPREPLY=( $(compgen -u -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS="--pgrp + --priority + --pid + --user + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _renice_module renice diff --git a/bash-completion/resizepart b/bash-completion/resizepart new file mode 100644 index 0000000..7e38503 --- /dev/null +++ b/bash-completion/resizepart @@ -0,0 +1,27 @@ +_resizepart_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $COMP_CWORD in + 1) + OPTS="--help --version $(lsblk -pnro name)" + 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/bash-completion/rev b/bash-completion/rev new file mode 100644 index 0000000..e5397d5 --- /dev/null +++ b/bash-completion/rev @@ -0,0 +1,24 @@ +_rev_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _rev_module rev diff --git a/bash-completion/rfkill b/bash-completion/rfkill new file mode 100644 index 0000000..4643666 --- /dev/null +++ b/bash-completion/rfkill @@ -0,0 +1,48 @@ +_rfkill_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + 'list'|'block'|'unblock') + local targets + targets="$(rfkill --output=id,type --noheadings list)" + COMPREPLY=( $(compgen -W "all $targets" -- $cur) ) + return 0; + ;; + '-o'|'--output') + local prefix realcur OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in "DEVICE TYPE ID SOFT HARD"; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS=" + event + list + block + unblock + --json + --noheadings + --output + --output-all + --raw + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + +} +complete -F _rfkill_module rfkill diff --git a/bash-completion/rtcwake b/bash-completion/rtcwake new file mode 100644 index 0000000..cdee2f3 --- /dev/null +++ b/bash-completion/rtcwake @@ -0,0 +1,59 @@ +_rtcwake_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-A'|'--adjfile') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-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 "$(rtcwake --list-modes)" -- $cur) ) + return 0 + ;; + '-s'|'--seconds') + COMPREPLY=( $(compgen -W "seconds" -- $cur) ) + return 0 + ;; + '-t'|'--time') + COMPREPLY=( $(compgen -W "time_t" -- $cur) ) + return 0 + ;; + '--date') + COMPREPLY=( $(compgen -W "YYYYMMDDhhmmss" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS=" + --auto + --adjfile + --date + --device + --dry-run + --local + --list-modes + --mode + --seconds + --time + --utc + --verbose + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 +} +complete -F _rtcwake_module rtcwake diff --git a/bash-completion/script b/bash-completion/script new file mode 100644 index 0000000..ef8afc6 --- /dev/null +++ b/bash-completion/script @@ -0,0 +1,45 @@ +_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 + ;; + '-o'|'--output-limit') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + '=') + cur=${cur#=} + ;; + -*) + OPTS="--append + --command + --return + --flush + --force + --quiet + --output-limit + --timing= + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _script_module script diff --git a/bash-completion/scriptreplay b/bash-completion/scriptreplay new file mode 100644 index 0000000..9e1a790 --- /dev/null +++ b/bash-completion/scriptreplay @@ -0,0 +1,33 @@ +_scriptreplay_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-d'|'--divisor'|'-m'|'--maxdelay') + COMPREPLY=( $(compgen -W "digit" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--timing + --typescript + --divisor + --maxdelay + --version + --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _scriptreplay_module scriptreplay diff --git a/bash-completion/setarch b/bash-completion/setarch new file mode 100644 index 0000000..4496e97 --- /dev/null +++ b/bash-completion/setarch @@ -0,0 +1,44 @@ +_setarch_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $(compgen -W "$($1 --list)" -- $cur) ) + return 0 + fi + case $cur in + -*) + OPTS=" + --32bit + --fdpic-funcptrs + --short-inode + --addr-compat-layout + --addr-no-randomize + --whole-seconds + --sticky-timeouts + --read-implies-exec + --mmap-page-zero + --3gb + --4gb + --uname-2.6 + --verbose + --list + --help + --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/bash-completion/setpriv b/bash-completion/setpriv new file mode 100644 index 0000000..41bab23 --- /dev/null +++ b/bash-completion/setpriv @@ -0,0 +1,125 @@ +_setpriv_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '--ambient-caps'|'--inh-caps'|'--bounding-set') + local prefix realcur INHERIT_ALL INHERIT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + INHERIT_ALL=$($1 --list-caps| awk '{print $1, "-" $1}') + for WORD in $INHERIT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + INHERIT="$WORD ${INHERIT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$INHERIT" -S ',' -- $realcur) ) + return 0 + ;; + '--ruid'|'--euid'|'--reuid') + local UIDS + UIDS=$(getent passwd | awk -F: '{print $1}') + COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) + return 0 + ;; + '--rgid'|'--egid'|'--regid') + local GIDS + GIDS=$(getent group | awk -F: '{print $1}') + COMPREPLY=( $(compgen -W "$GIDS" -- $cur) ) + return 0 + ;; + '--groups') + local prefix realcur GIDS_ALL GIDS + realcur="${cur##*,}" + prefix="${cur%$realcur}" + GIDS_ALL=$(getent group | awk -F: '{print $3}') + for WORD in $GIDS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + GIDS="$WORD ${GIDS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$GIDS" -S ',' -- $realcur) ) + return 0 + ;; + '--securebits') + local prefix realcur SBITS_ALL SBITS WORD + realcur="${cur##*,}" + prefix="${cur%$realcur}" + SBITS_ALL=" + {+,-}keep_caps_locked + {+,-}noroot + {+,-}noroot_locked + {+,-}no_setuid_fixup + {+,-}no_setuid_fixup_locked + " + for WORD in $SBITS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + SBITS="$WORD ${SBITS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) ) + return 0 + ;; + '--pdeathsig') + local i signals + for i in $(kill -l); do + case $i in + SIG*) + signals+="$i " + ;; + esac + done + COMPREPLY=( $(compgen -W "keep clear $signals" -- $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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--dump + --no-new-privs + --ambient-caps + --inh-caps + --bounding-set + --ruid + --euid + --rgid + --egid + --reuid + --regid + --clear-groupsclear + --keep-groupskeep + --groups + --securebits + --pdeathsig + --reset-env + --selinux-label + --apparmor-profile + --help + --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/bash-completion/setsid b/bash-completion/setsid new file mode 100644 index 0000000..955ec27 --- /dev/null +++ b/bash-completion/setsid @@ -0,0 +1,23 @@ +_setsid_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--ctty --wait --help --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/bash-completion/setterm b/bash-completion/setterm new file mode 100644 index 0000000..25213df --- /dev/null +++ b/bash-completion/setterm @@ -0,0 +1,127 @@ +_setterm_module() +{ + local bright 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') + COMPREPLY=( $(compgen -W "black blue cyan default green magenta red white yellow" -- $cur) ) + return 0 + ;; + '--ulcolor'|'--hbcolor'|'bright') + if [ $prev != 'bright' ]; then + bright='bright black grey' + else + bright='' + fi + COMPREPLY=( $(compgen -W "$bright 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 "{1..160}" -- $cur) ) + return 0 + ;; + '--blank') + COMPREPLY=( $(compgen -W "{0..60} force poke" -- $cur) ) + return 0 + ;; + '--dump'|'--append') + local NUM_CONS + NUM_CONS=(/dev/vcsa?*) + COMPREPLY=( $(compgen -W "{1..${#NUM_CONS[*]}}" -- $cur) ) + return 0 + ;; + '--file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '--msglevel') + COMPREPLY=( $(compgen -W "{0..8}" -- $cur) ) + return 0 + ;; + '--powersave') + COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) ) + return 0 + ;; + '--powerdown') + COMPREPLY=( $(compgen -W "{0..60}" -- $cur) ) + return 0 + ;; + '--blength') + COMPREPLY=( $(compgen -W "0-2000" -- $cur) ) + return 0 + ;; + '--bfreq') + COMPREPLY=( $(compgen -W "freqnumber" -- $cur) ) + return 0 + ;; + '--help'|'--version') + return 0 + ;; + esac + OPTS=" --term + --reset + --resize + --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/bash-completion/sfdisk b/bash-completion/sfdisk new file mode 100644 index 0000000..9401f89 --- /dev/null +++ b/bash-completion/sfdisk @@ -0,0 +1,96 @@ +_sfdisk_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-d'|'--dump'|'-J'|'--json'|'-l'|'--list'|'-F'|'--list-free'|'-r'|'--reorder'|'-s'|'--show-size'|'-V'|'--verify'|'-A'|'--activate'|'--delete') + COMPREPLY=( $(compgen -W "$(lsblk -dpnro name)" -- $cur) ) + return 0 + ;; + '-N'|'--partno') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '--color'|'-w'|'--wipe'|'-W'|'--wipe-partitions') + COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL=" + Attrs Boot Bsize Cpg Cylinders Device End + End-C/H/S Flags Fsize Id Name Sectors Size + Slice Start Start-C/H/S Type Type-UUID UUID + " + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) + return 0 + ;; + '-O'|'--backup-file') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-v'|'--version') + return 0 + ;; + esac + case $cur in + '=') + cur=${cur#=} + ;; + -*) + OPTS=" + --activate + --dump + --json + --show-geometry + --list + --list-free + --reorder + --show-size + --list-types + --verify + --delete + --part-label + --part-type + --part-uuid + --part-attrs + --append + --backup + --bytes + --move-data + --force + --color + --partno + --no-act + --no-reread + --no-tell-kernel + --backup-file + --output + --quiet + --wipe + --wipe-partitions + --label + --label-nested + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _sfdisk_module sfdisk diff --git a/bash-completion/su b/bash-completion/su new file mode 100644 index 0000000..3095050 --- /dev/null +++ b/bash-completion/su @@ -0,0 +1,48 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --user + --preserve-environment + --whitelist-environment + --group + --supp-group + --login + --command + --session-command + --fast + --shell + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _su_module su +complete -F _su_module runuser diff --git a/bash-completion/swaplabel b/bash-completion/swaplabel new file mode 100644 index 0000000..08aa9cd --- /dev/null +++ b/bash-completion/swaplabel @@ -0,0 +1,32 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--label --uuid --help --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _swaplabel_module swaplabel diff --git a/bash-completion/swapoff b/bash-completion/swapoff new file mode 100644 index 0000000..40dcf05 --- /dev/null +++ b/bash-completion/swapoff @@ -0,0 +1,38 @@ +_swapoff_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-a'|'--all') + return 0 + ;; + '-U'|'UUID=') + COMPREPLY=( $(compgen -W "$(swapon --show=UUID --noheading)" -- $cur) ) + return 0 + ;; + '-L'|'LABEL=') + COMPREPLY=( $(compgen -W "$(swapon --show=LABEL --noheading)" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="-L + -U + --all + --verbose + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(swapon --show=NAME --raw --noheading)" -- $cur) ) + return 0 +} +complete -F _swapoff_module swapoff diff --git a/bash-completion/swapon b/bash-completion/swapon new file mode 100644 index 0000000..a6b6f09 --- /dev/null +++ b/bash-completion/swapon @@ -0,0 +1,84 @@ +_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 "{-1..9} 32767" -- $cur) ) + return 0 + ;; + '--show') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="NAME TYPE SIZE USED PRIO UUID LABEL" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-U'|'UUID=') + local UUIDS + UUIDS="$(lsblk -nrp -o FSTYPE,UUID | awk '$1 ~ /swap/ { print $2 }')" + COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) + return 0 + ;; + '-L'|'LABEL=') + local LABELS + LABELS="$(lsblk -nrp -o FSTYPE,LABEL | awk '$1 ~ /swap/ { print $2 }')" + COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) + return 0 + ;; + 'PARTUUID=') + local PARTUUIDS + PARTUUIDS="$(lsblk -nrp -o FSTYPE,PARTUUID | awk '$1 ~ /swap/ { print $2 }')" + COMPREPLY=( $(compgen -W "$PARTUUIDS" -- $cur) ) + return 0 + ;; + 'PARTLABEL=') + local PARTLABELS + PARTLABELS="$(lsblk -nrp -o FSTYPE,PARTLABEL | awk '$1 ~ /swap/ { print $2 }')" + COMPREPLY=( $(compgen -W "$PARTLABELS" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--all + --discard + --ifexists + --fixpgsz + --priority + --summary + --show + --output-all + --noheadings + --raw + --bytes + --verbose + -L + -U + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local DEVS + DEVS="$(lsblk -nrp -o FSTYPE,NAME | awk '$1 ~ /swap/ { print $2 }')" + compopt -o nospace + COMPREPLY=( $(compgen -fW "$DEVS LABEL= UUID= PARTLABEL= PARTUUID=" -- $cur) ) + return 0 +} +complete -F _swapon_module swapon diff --git a/bash-completion/taskset b/bash-completion/taskset new file mode 100644 index 0000000..7c9a7bd --- /dev/null +++ b/bash-completion/taskset @@ -0,0 +1,47 @@ +_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 prefix realcur CPULIST_ALL CPULIST + realcur="${cur##*,}" + prefix="${cur%$realcur}" + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then + CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) + 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=$(cd /proc && echo [0-9]*) + COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--all-tasks --pid --cpu-list --help --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/bash-completion/tunelp b/bash-completion/tunelp new file mode 100644 index 0000000..2be3d54 --- /dev/null +++ b/bash-completion/tunelp @@ -0,0 +1,51 @@ +_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'|'-q'|'--print-irq') + COMPREPLY=( $(compgen -W "off on" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--irq + --time + --chars + --wait + --abort + --check-status + --careful + --status + --reset + --print-irq + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) ) + return 0 +} +complete -F _tunelp_module tunelp diff --git a/bash-completion/ul b/bash-completion/ul new file mode 100644 index 0000000..449cbe0 --- /dev/null +++ b/bash-completion/ul @@ -0,0 +1,33 @@ +_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 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--terminal --indicated --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _ul_module ul diff --git a/bash-completion/umount b/bash-completion/umount new file mode 100644 index 0000000..496474a --- /dev/null +++ b/bash-completion/umount @@ -0,0 +1,57 @@ +_umount_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-t'|'--types') + local TYPES + TYPES=" + $(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}') + $(awk '{print $NF, "no" $NF}' /proc/filesystems) + " + COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + '-N'|'--namespace') + local NAMESPACE + NAMESPACE="$(lsns --type mnt --output PATH --noheadings)" + COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) ) + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --all + --all-targets + --no-canonicalize + --detach-loop + --fake + --force + --internal-only + --namespace + --no-mtab + --lazy + --test-opts + --recursive + --read-only + --types + --quiet + --verbose + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + + local oldifs=$IFS + IFS=$'\n' + COMPREPLY=( $( compgen -W '$(findmnt -lno TARGET | sed "s/\([[:blank:]]\)/\\\\\1/g")' -- "$cur" ) ) + IFS=$oldifs +} +complete -F _umount_module umount diff --git a/bash-completion/unshare b/bash-completion/unshare new file mode 100644 index 0000000..3fda4a1 --- /dev/null +++ b/bash-completion/unshare @@ -0,0 +1,45 @@ +_unshare_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '--propagation') + COMPREPLY=( $(compgen -W "slave shared private unchanged" -- $cur) ) + return 0 + ;; + '-s'|'--setgroups') + COMPREPLY=( $(compgen -W "allow deny" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--mount + --uts + --ipc + --net + --pid + --user + --cgroup + --fork + --kill-child + --mount-proc + --map-root-user + --propagation + --setgroups + --help + --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/bash-completion/utmpdump b/bash-completion/utmpdump new file mode 100644 index 0000000..fb636c1 --- /dev/null +++ b/bash-completion/utmpdump @@ -0,0 +1,24 @@ +_utmpdump_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--follow --reverse --output --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _utmpdump_module utmpdump diff --git a/bash-completion/uuidd b/bash-completion/uuidd new file mode 100644 index 0000000..c8f6697 --- /dev/null +++ b/bash-completion/uuidd @@ -0,0 +1,39 @@ +_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') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-T'|'--timeout') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -W "timeout" -- $cur) ) + return 0 + ;; + '-n'|'--uuids') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--pid --socket --timeout --kill --random --time --uuids --no-pid --no-fork --socket-activation --debug --quiet --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _uuidd_module uuidd diff --git a/bash-completion/uuidgen b/bash-completion/uuidgen new file mode 100644 index 0000000..8e64015 --- /dev/null +++ b/bash-completion/uuidgen @@ -0,0 +1,39 @@ +_uuidgen_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-n'|'--namespace') + COMPREPLY=( $(compgen -W "@dns @url @oid @x500 @x.500" -- "$cur") ) + return 0 + ;; + '-N'|'--name') + COMPREPLY=( $(compgen -W "name" -- "$cur") ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --random + --time + --namespace + --name + --md5 + --sha1 + --hex + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _uuidgen_module uuidgen diff --git a/bash-completion/uuidparse b/bash-completion/uuidparse new file mode 100644 index 0000000..a646844 --- /dev/null +++ b/bash-completion/uuidparse @@ -0,0 +1,37 @@ +_uuidparse_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-o'|'--output') + local prefix realcur OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + for WORD in "UUID VARIANT TYPE TIME"; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + OPTS=" + --json + --noheadings + --output + --raw + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + +} +complete -F _uuidparse_module uuidparse diff --git a/bash-completion/wall b/bash-completion/wall new file mode 100644 index 0000000..d2fba9a --- /dev/null +++ b/bash-completion/wall @@ -0,0 +1,32 @@ +_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 + ;; + '-g'|'--group') + COMPREPLY=( $(compgen -A 'group' -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--group --nobanner --timeout --version --help" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +} +complete -F _wall_module wall diff --git a/bash-completion/wdctl b/bash-completion/wdctl new file mode 100644 index 0000000..f1a870e --- /dev/null +++ b/bash-completion/wdctl @@ -0,0 +1,70 @@ +_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') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-s'|'--settimeout') + COMPREPLY=( $(compgen -W "seconds" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS="--flags + --noflags + --noident + --noheadings + --oneline + --output + --raw + --notimeouts + --settimeout + --flags-only + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) ) + return 0 +} +complete -F _wdctl_module wdctl diff --git a/bash-completion/whereis b/bash-completion/whereis new file mode 100644 index 0000000..0dcbac3 --- /dev/null +++ b/bash-completion/whereis @@ -0,0 +1,28 @@ +_whereis_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-B'|'-M'|'-S') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 + ;; + '-h'|'-V') + 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/bash-completion/wipefs b/bash-completion/wipefs new file mode 100644 index 0000000..13568ca --- /dev/null +++ b/bash-completion/wipefs @@ -0,0 +1,60 @@ +_wipefs_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-O'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="UUID LABEL LENGTH TYPE OFFSET USAGE DEVICE" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-o'|'--offset') + COMPREPLY=( $(compgen -W "offset" -- $cur) ) + return 0 + ;; + '-t'|'--types') + local TYPES + TYPES="$(blkid -k)" + COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) + return 0 + ;; + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $cur in + -*) + OPTS=" + --all + --backup + --force + --noheadings + --json + --no-act + --offset + --output + --parsable + --quiet + --types + --help + --version + " + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) + return 0 +} +complete -F _wipefs_module wipefs diff --git a/bash-completion/write b/bash-completion/write new file mode 100644 index 0000000..7b2d2fa --- /dev/null +++ b/bash-completion/write @@ -0,0 +1,24 @@ +_write_module() +{ + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-h'|'--help'|'-V'|'--version') + return 0 + ;; + esac + case $COMP_CWORD in + 1) + COMPREPLY=( $(compgen -W '$(users)' -- $cur) ) + return 0 + ;; + 2) + COMPREPLY=( $(compgen -W "$(w -h $prev | awk '{print $2}')" -- $cur) ) + return 0 + ;; + esac + return 0 +} +complete -F _write_module write diff --git a/bash-completion/zramctl b/bash-completion/zramctl new file mode 100644 index 0000000..5274a56 --- /dev/null +++ b/bash-completion/zramctl @@ -0,0 +1,60 @@ +_zramctl_module() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-a'|'--algorithm') + COMPREPLY=( $(compgen -W "lzo lz4 lz4hc deflate 842" -- $cur) ) + return 0 + ;; + '-o'|'--output') + local prefix realcur OUTPUT_ALL OUTPUT + realcur="${cur##*,}" + prefix="${cur%$realcur}" + OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM + STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED + MIGRATED MOUNTPOINT" + for WORD in $OUTPUT_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + OUTPUT="$WORD ${OUTPUT:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) + return 0 + ;; + '-s'|'--size') + COMPREPLY=( $(compgen -W "size" -- $cur) ) + return 0 + ;; + '-t'|'--streams') + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 + ;; + esac + case $cur in + -*) + OPTS=" --algorithm + --bytes + --find + --noheadings + --output + --output-all + --raw + --reset + --size + --streams + --help + --version" + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) ) + return 0 +} +complete -F _zramctl_module zramctl |