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