EVERYTHING FROM THE OTHER REPO
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
# Debian apt(8) completion -*- shell-script -*-
|
||||
|
||||
_apt()
|
||||
{
|
||||
local sourcesdir="/etc/apt/sources.list.d"
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
local GENERIC_APT_GET_OPTIONS='
|
||||
-d --download-only
|
||||
-y --assume-yes
|
||||
--assume-no
|
||||
-u --show-upgraded
|
||||
-m --ignore-missing
|
||||
-t --target-release
|
||||
--download
|
||||
--fix-missing
|
||||
--ignore-hold
|
||||
--upgrade
|
||||
--only-upgrade
|
||||
--allow-change-held-packages
|
||||
--allow-remove-essential
|
||||
--allow-downgrades
|
||||
--print-uris
|
||||
--trivial-only
|
||||
--remove
|
||||
--arch-only
|
||||
--allow-unauthenticated
|
||||
--allow-insecure-repositories
|
||||
--install-recommends
|
||||
--install-suggests
|
||||
--no-install-recommends
|
||||
--no-install-suggests
|
||||
--fix-policy
|
||||
'
|
||||
|
||||
# see if the user selected a command already
|
||||
local COMMANDS=(
|
||||
"list"
|
||||
"search"
|
||||
"show" "showsrc"
|
||||
"install" "reinstall" "remove" "purge" "autoremove" "autopurge"
|
||||
"update"
|
||||
"upgrade" "full-upgrade" "dist-upgrade"
|
||||
"edit-sources"
|
||||
"help"
|
||||
"source" "build-dep"
|
||||
"clean" "autoclean"
|
||||
"download" "changelog"
|
||||
"moo"
|
||||
"modernize-sources"
|
||||
"depends" "rdepends"
|
||||
"policy")
|
||||
|
||||
local command i
|
||||
for (( i=1; i < ${#words[@]}; i++ )); do
|
||||
if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then
|
||||
command=${words[i]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Complete a -t<SPACE><TAB>
|
||||
case $prev in
|
||||
-t|--target-release)
|
||||
COMPREPLY=( $( compgen -W "$(apt-cache policy | grep -Eo 'a=[^,]*|n=[^,]*' | cut -f2- -d= | sort -u)" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# When the cursor (cword) is before the command word (i), only suggest
|
||||
# options but not package or file names:
|
||||
if [[ $cur == -* || ( -v command && $cword -le $i ) ]]; then
|
||||
case ${command-} in
|
||||
install|reinstall|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove|autopurge)
|
||||
COMPREPLY=( $( compgen -W '--show-progress
|
||||
--fix-broken --purge --verbose-versions --no-list-columns --auto-remove
|
||||
-s --simulate --dry-run
|
||||
--download
|
||||
--fix-missing
|
||||
--fix-policy
|
||||
--ignore-hold
|
||||
--force-yes
|
||||
--trivial-only
|
||||
--reinstall --solver --no-strict-pinning
|
||||
-t --target-release'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
update)
|
||||
COMPREPLY=( $( compgen -W '--list-cleanup
|
||||
--print-uris
|
||||
--allow-insecure-repositories
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
list)
|
||||
COMPREPLY=( $( compgen -W '--installed --upgradable
|
||||
--manual-installed
|
||||
-v --verbose
|
||||
-a --all-versions
|
||||
-t --target-release
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
show)
|
||||
COMPREPLY=( $( compgen -W '-a --all-versions
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
depends|rdepends)
|
||||
COMPREPLY=( $( compgen -W '-i
|
||||
--important
|
||||
--installed
|
||||
--pre-depends
|
||||
--depends
|
||||
--recommends
|
||||
--suggests
|
||||
--replaces
|
||||
--breaks
|
||||
--conflicts
|
||||
--enhances
|
||||
--recurse
|
||||
--implicit' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
search)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-n --names-only
|
||||
-f --full' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
showsrc)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
--only-source' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
source)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-s --simulate --dry-run
|
||||
-b --compile --build
|
||||
-P --build-profiles
|
||||
--diff-only --debian-only
|
||||
--tar-only
|
||||
--dsc-only
|
||||
-t --target-release
|
||||
'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
build-dep)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-a --host-architecture
|
||||
-s --simulate --dry-run
|
||||
-P --build-profiles
|
||||
-t --target-release
|
||||
--purge --solver --no-strict-pinning
|
||||
'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
moo)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
--color
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
clean|autoclean)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-s --simulate --dry-run
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
# specific command arguments
|
||||
if [[ -v command ]]; then
|
||||
case $command in
|
||||
remove|purge|autoremove|autopurge)
|
||||
if [[ -f /etc/debian_version ]]; then
|
||||
# Debian system
|
||||
COMPREPLY=( $( \
|
||||
_xfunc dpkg _comp_dpkg_installed_packages $cur ) )
|
||||
else
|
||||
# assume RPM based
|
||||
_xfunc rpm _rpm_installed_packages
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
show|list|download|changelog|depends|rdepends)
|
||||
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
|
||||
2> /dev/null ) )
|
||||
return 0
|
||||
;;
|
||||
install|reinstall)
|
||||
if [[ "$cur" == .* || "$cur" == /* || "$cur" == ~* ]]; then
|
||||
_filedir "deb"
|
||||
else
|
||||
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
|
||||
2> /dev/null ) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
source|build-dep|showsrc|policy)
|
||||
if [[ "$command" == build-dep && ( "$cur" == .* || "$cur" == /* || "$cur" == ~* ) ]]; then
|
||||
_filedir "dsc"
|
||||
else
|
||||
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
|
||||
2> /dev/null ) $( apt-cache dumpavail | \
|
||||
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
edit-sources)
|
||||
COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \
|
||||
-- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
moo)
|
||||
COMPREPLY=( $( compgen -W 'moo' \
|
||||
-- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# no command yet, show what commands we have
|
||||
COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) )
|
||||
fi
|
||||
|
||||
return 0
|
||||
} &&
|
||||
complete -F _apt apt
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
@@ -0,0 +1,38 @@
|
||||
_blkdiscard_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-o'|'--offset'|'-l'|'--length'|'-p'|'--step')
|
||||
COMPREPLY=( $(compgen -W "num" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--force
|
||||
--offset
|
||||
--length
|
||||
--quiet
|
||||
--step
|
||||
--secure
|
||||
--zeroout
|
||||
--verbose
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _blkdiscard_module blkdiscard
|
||||
@@ -0,0 +1,100 @@
|
||||
_blkid_module()
|
||||
{
|
||||
local cur prev OPTS OUTPUT_ALL
|
||||
OUTPUT_ALL=''
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-c'|'--cache-file')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
COMPREPLY=( $(compgen -W "value device export full json" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--match-tag')
|
||||
COMPREPLY=( $(compgen -W "tag" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--match-token')
|
||||
COMPREPLY=( $(compgen -W "TYPE= LABEL= UUID=" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-L'|'--label')
|
||||
COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-U'|'--uuid')
|
||||
COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--size')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-O'|'--offset')
|
||||
COMPREPLY=( $(compgen -W "offset" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-u'|'--usages')
|
||||
OUTPUT_ALL={,no}{filesystem,raid,crypto,other}
|
||||
;;
|
||||
'-n'|'--match-types')
|
||||
OUTPUT_ALL="
|
||||
$(awk '{print $NF}' /proc/filesystems)
|
||||
$(\ls /lib/modules/$(uname -r)/kernel/fs)
|
||||
"
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
if [ -n "$OUTPUT_ALL" ]; then
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") )
|
||||
return 0
|
||||
fi
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--cache-file
|
||||
--no-encoding
|
||||
--garbage-collect
|
||||
--output
|
||||
--list-filesystems
|
||||
--match-tag
|
||||
--match-token
|
||||
--list-one
|
||||
--label
|
||||
--uuid
|
||||
--probe
|
||||
--info
|
||||
--size
|
||||
--offset
|
||||
--usages
|
||||
--match-types
|
||||
--no-part-details
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _blkid_module blkid
|
||||
@@ -0,0 +1,53 @@
|
||||
_blkzone_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-o'|'--offset')
|
||||
COMPREPLY=( $(compgen -W "sector" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-l'|'--length')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--count')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
case $prev in
|
||||
'report'|'reset')
|
||||
OPTS="--verbose --offset --length --count --force"
|
||||
;;
|
||||
*)
|
||||
OPTS="--help --version"
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
case $prev in
|
||||
'report'|'reset')
|
||||
;;
|
||||
*)
|
||||
OPTS="report reset"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _blkzone_module blkzone
|
||||
@@ -0,0 +1,47 @@
|
||||
_blockdev_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
DEVS="$(lsblk -pnro name)"
|
||||
OPTS="-h -V -q
|
||||
--report
|
||||
--getsz
|
||||
--setro
|
||||
--setrw
|
||||
--getro
|
||||
--getdiscardzeroes
|
||||
--getdiskseq
|
||||
--getzonesz
|
||||
--getss
|
||||
--getpbsz
|
||||
--getiomin
|
||||
--getioopt
|
||||
--getalignoff
|
||||
--getmaxsect
|
||||
--getbsz
|
||||
--setbsz
|
||||
--getsize64
|
||||
--setra
|
||||
--getra
|
||||
--setfra
|
||||
--getfra
|
||||
--flushbufs
|
||||
--rereadpt
|
||||
$DEVS"
|
||||
case $prev in
|
||||
'--setbsz')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--setra'|'--setfra')
|
||||
COMPREPLY=( $(compgen -W "sectors" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _blockdev_module blockdev
|
||||
@@ -0,0 +1,59 @@
|
||||
_chcpu_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-e'|'--enable')
|
||||
local prefix realcur CPULIST_ALL CPULIST
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline)
|
||||
for WORD in $(eval echo $CPULIST_ALL); do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
CPULIST="$WORD ${CPULIST:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-d'|'--disable')
|
||||
local prefix realcur CPULIST_ALL CPULIST
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
|
||||
for WORD in $(eval echo $CPULIST_ALL); do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
CPULIST="$WORD ${CPULIST:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--configure'|'-g'|'--deconfigure')
|
||||
COMPREPLY=( $(compgen -W "cpu-list" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--dispatch')
|
||||
COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--help
|
||||
--enable
|
||||
--disable
|
||||
--configure
|
||||
--deconfigure
|
||||
--dispatch
|
||||
--rescan
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _chcpu_module chcpu
|
||||
@@ -0,0 +1,30 @@
|
||||
_chmem_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--enable
|
||||
--disable
|
||||
--blocks
|
||||
--verbose
|
||||
--zone
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "size range blockrange" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _chmem_module chmem
|
||||
@@ -0,0 +1,52 @@
|
||||
_chrt_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
'-T'|'--sched-runtime'|'-P'|'--sched-period'|'-D'|'--sched-deadline')
|
||||
COMPREPLY=( $(compgen -W "nanoseconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--all-tasks
|
||||
--batch
|
||||
--deadline
|
||||
--fifo
|
||||
--help
|
||||
--idle
|
||||
--max
|
||||
--other
|
||||
--pid
|
||||
--reset-on-fork
|
||||
--rr
|
||||
--sched-deadline
|
||||
--sched-period
|
||||
--sched-runtime
|
||||
--verbose
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local i
|
||||
for i in ${COMP_WORDS[*]}; do
|
||||
case $i in
|
||||
'-p'|'--pid')
|
||||
COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _chrt_module chrt
|
||||
@@ -0,0 +1,11 @@
|
||||
_have debconf-show &&
|
||||
_debconf_show()
|
||||
{
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
COMPREPLY=($( compgen -W '--listowners --listdbs --db=' -- $cur ) \
|
||||
$( apt-cache pkgnames -- $cur ) )
|
||||
}
|
||||
complete -F _debconf_show debconf-show
|
||||
@@ -0,0 +1 @@
|
||||
debconf
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
_dmesg_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-F'|'--file')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-f'|'--facility')
|
||||
COMPREPLY=( $(compgen -W "kern user mail daemon auth syslog lpr news" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-l'|'--level'|'-n'|'--console-level')
|
||||
COMPREPLY=( $(compgen -W "emerg alert crit err warn notice info debug" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--buffer-size')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--time-format')
|
||||
COMPREPLY=( $(compgen -W "delta reltime ctime notime iso" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--clear
|
||||
--read-clear
|
||||
--console-off
|
||||
--show-delta
|
||||
--reltime
|
||||
--console-on
|
||||
--file
|
||||
--facility
|
||||
--human
|
||||
--json
|
||||
--kernel
|
||||
--color
|
||||
--level
|
||||
--console-level
|
||||
--noescape
|
||||
--nopager
|
||||
--raw
|
||||
--syslog
|
||||
--buffer-size
|
||||
--ctime
|
||||
--notime
|
||||
--time-format
|
||||
--userspace
|
||||
--follow
|
||||
--follow-new
|
||||
--decode
|
||||
--since
|
||||
--until
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _dmesg_module dmesg
|
||||
@@ -0,0 +1,41 @@
|
||||
_fallocate_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-o'|'--offset'|'-l'|'--length')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--collapse-range
|
||||
--dig-holes
|
||||
--insert-range
|
||||
--length
|
||||
--keep-size
|
||||
--offset
|
||||
--punch-hole
|
||||
--zero-range
|
||||
--posix
|
||||
--verbose
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _fallocate_module fallocate
|
||||
@@ -0,0 +1,34 @@
|
||||
_findfs_module()
|
||||
{
|
||||
local cur prev OPTS findable
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--version --help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
for i in $(lsblk -rpno label); do
|
||||
findable+=" LABEL=$i"
|
||||
done
|
||||
for i in $(lsblk -rpno uuid); do
|
||||
findable+=" UUID=$i"
|
||||
done
|
||||
for i in $(lsblk -rpno partlabel); do
|
||||
findable+=" PARTLABEL=$i"
|
||||
done
|
||||
for i in $(lsblk -rpno partuuid); do
|
||||
findable+=" PARTUUID=$i"
|
||||
done
|
||||
COMPREPLY=( $(compgen -W "$findable" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _findfs_module findfs
|
||||
@@ -0,0 +1,149 @@
|
||||
_findmnt_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-p'|'--poll')
|
||||
COMPREPLY=( $(compgen -W "=list" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-w'|'--timeout')
|
||||
COMPREPLY=( $(compgen -W "timeout" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-d'|'--direction')
|
||||
COMPREPLY=( $(compgen -W "forward backward" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-F'|'--tab-file')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-N'|'--task')
|
||||
local TID='' I ARR
|
||||
for I in /proc/*/mountinfo; do IFS=/ read -ra ARR <<< "$I"; TID+="${ARR[2]} "; done
|
||||
COMPREPLY=( $(compgen -W "$TID" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-O'|'--options')
|
||||
local MTAB_3RD I
|
||||
declare -a TMP_ARR
|
||||
declare -A MNT_OPTS
|
||||
while read MTAB_3RD; do
|
||||
IFS=',' read -ra TMP_ARR <<<"$MTAB_3RD"
|
||||
for I in ${TMP_ARR[@]}; do
|
||||
MNT_OPTS[$I]='1'
|
||||
done
|
||||
done < <($1 -rno OPTIONS)
|
||||
COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
|
||||
OUTPUT_ALL="SOURCE TARGET FSTYPE OPTIONS VFS-OPTIONS
|
||||
FS-OPTIONS LABEL UUID PARTLABEL PARTUUID
|
||||
MAJ\:MIN ACTION OLD-TARGET OLD-OPTIONS
|
||||
SIZE AVAIL USED USE% FSROOT TID ID
|
||||
OPT-FIELDS PROPAGATION FREQ PASSNO"
|
||||
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--types')
|
||||
local TYPES
|
||||
TYPES="adfs affs autofs cifs coda coherent cramfs
|
||||
debugfs devpts efs ext2 ext3 ext4 hfs
|
||||
hfsplus hpfs iso9660 jfs minix msdos
|
||||
ncpfs nfs nfs4 ntfs proc qnx4 ramfs
|
||||
reiserfs romfs squashfs smbfs sysv tmpfs
|
||||
ubifs udf ufs umsdos usbfs vfat xenix xfs"
|
||||
COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--source')
|
||||
local DEV_MPOINT
|
||||
DEV_MPOINT=$($1 -rno SOURCE | grep ^/dev)
|
||||
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-T'|'--target')
|
||||
local DEV_MPOINT
|
||||
DEV_MPOINT=$($1 -rno TARGET)
|
||||
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-M'|'--mountpoint')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--fstab
|
||||
--mtab
|
||||
--kernel
|
||||
--poll
|
||||
--timeout
|
||||
--all
|
||||
--ascii
|
||||
--canonicalize
|
||||
--df
|
||||
--dfi
|
||||
--direction
|
||||
--evaluate
|
||||
--tab-file
|
||||
--first-only
|
||||
--hyperlink
|
||||
--id
|
||||
--uniq-id
|
||||
--invert
|
||||
--json
|
||||
--list
|
||||
--task
|
||||
--noheadings
|
||||
--notruncate
|
||||
--options
|
||||
--output
|
||||
--output-all
|
||||
--pairs
|
||||
--raw
|
||||
--types
|
||||
--nofsroot
|
||||
--submounts
|
||||
--source
|
||||
--target
|
||||
--mountpoint
|
||||
--help
|
||||
--tree
|
||||
--real
|
||||
--pseudo
|
||||
--list-columns
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local DEV_MPOINT
|
||||
DEV_MPOINT=$($1 -rno TARGET,SOURCE)
|
||||
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _findmnt_module findmnt
|
||||
@@ -0,0 +1,48 @@
|
||||
_flock_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-w'|'--timeout')
|
||||
COMPREPLY=( $(compgen -W "seconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-E'|'--conflict-exit-code')
|
||||
COMPREPLY=( $(compgen -W "{0..255}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--command')
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--shared
|
||||
--exclusive
|
||||
--unlock
|
||||
--nonblock
|
||||
--timeout
|
||||
--conflict-exit-code
|
||||
--close
|
||||
--command
|
||||
--no-fork
|
||||
--fcntl
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _flock_module flock
|
||||
@@ -0,0 +1,39 @@
|
||||
_fsck_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-b')
|
||||
COMPREPLY=( $(compgen -W "superblock" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-B')
|
||||
COMPREPLY=( $(compgen -W "blocksize" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-j')
|
||||
COMPREPLY=( $(compgen -W "external_journal" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-l'|'-L')
|
||||
COMPREPLY=( $(compgen -W "bad_blocks_file" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-?')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="-p -n -y -c -f -v -b -B -j -l -L"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _fsck_module fsck
|
||||
@@ -0,0 +1,24 @@
|
||||
_fsfreeze_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--freeze --unfreeze --help --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local MPOINT
|
||||
MPOINT="$(findmnt -t ext2,ext3,ext4,reiserfs,jfs,xfs -o TARGET -n -r)"
|
||||
COMPREPLY=( $(compgen -W "$MPOINT" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _fsfreeze_module fsfreeze
|
||||
@@ -0,0 +1,39 @@
|
||||
_fstrim_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-o'|'--offset'|'-l'|'--length'|'-m'|'--minimum')
|
||||
COMPREPLY=( $(compgen -W "num" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--all
|
||||
--fstab
|
||||
--listed-in
|
||||
--quiet-unsupported
|
||||
--offset
|
||||
--length
|
||||
--minimum
|
||||
--types
|
||||
--verbose
|
||||
--dry-run
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local MPOINTS
|
||||
MPOINTS=$(findmnt -rno SOURCE,TARGET | awk '/^\/dev/{print $2}')
|
||||
COMPREPLY=( $(compgen -W "$MPOINTS" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _fstrim_module fstrim
|
||||
@@ -0,0 +1,37 @@
|
||||
_getopt_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-l'|'--longoptions')
|
||||
COMPREPLY=( $(compgen -W "longopts" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-n'|'--name')
|
||||
COMPREPLY=( $(compgen -W "name" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--options')
|
||||
COMPREPLY=( $(compgen -W "optstring" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--shell')
|
||||
COMPREPLY=( $(compgen -W "sh bash csh tcsh" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--alternative --help --longoptions --name --options --quiet --quiet-output --shell --test --unquoted --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _getopt_module getopt
|
||||
@@ -0,0 +1,80 @@
|
||||
_hardlink_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-x'|'--exclude')
|
||||
COMPREPLY=( $(compgen -W "regex" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--exclude-subtree')
|
||||
COMPREPLY=( $(compgen -W "regex" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-i'|'--include')
|
||||
COMPREPLY=( $(compgen -W "regex" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--minimum-size')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--maximum-size')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-b'|'--io-size')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-r'|'--cache-size')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-y'|'--method')
|
||||
COMPREPLY=( $(compgen -W "sha256 sha1 crc32c memcmp" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--reflink')
|
||||
COMPREPLY=( $(compgen -W "never always auto" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-H'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--content
|
||||
--respect-dir
|
||||
--respect-name
|
||||
--maximize
|
||||
--minimize
|
||||
--mount
|
||||
--dry-run
|
||||
--ignore-owner
|
||||
--keep-oldest
|
||||
--list-duplicates
|
||||
--ignore-mode
|
||||
--quiet
|
||||
--ignore-time
|
||||
--verbose
|
||||
--respect-xattrs
|
||||
--skip-reflinks
|
||||
--zero
|
||||
--version
|
||||
--help
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -d -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _hardlink_module hardlink
|
||||
@@ -0,0 +1,50 @@
|
||||
_ionice_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-c'|'--class')
|
||||
COMPREPLY=( $(compgen -W "{0..3} none realtime best-effort idle" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-n'|'--classdata')
|
||||
COMPREPLY=( $(compgen -W "{0..7}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-P'|'--pgid')
|
||||
local PGID
|
||||
PGID="$(awk '{print $5}' /proc/*/stat 2>/dev/null | sort -u)"
|
||||
COMPREPLY=( $(compgen -W "$PGID" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--pid')
|
||||
local PIDS
|
||||
PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-u'|'--uid')
|
||||
local UIDS
|
||||
UIDS="$(stat --format='%u' /proc/[0-9]* | sort -u)"
|
||||
COMPREPLY=( $(compgen -W "$UIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--class --classdata --pid --pgid --ignore --uid --version --help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _ionice_module ionice
|
||||
@@ -0,0 +1,38 @@
|
||||
_ipcmk_module()
|
||||
{
|
||||
local cur prev
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-M'|'--shmem')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-m'|'--posix-shmem')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--semaphore')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--posix-semaphore'|'-Q'|'--queue'|'-q'|'--posix-mqueue')
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--mode')
|
||||
COMPREPLY=( $(compgen -W "mode" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-n'|'--name')
|
||||
COMPREPLY=( $(compgen -W "name" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "--shmem --posix-shmem --semaphore --posix-semaphore --queue --posix-mqueue --mode --name --help --version" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _ipcmk_module ipcmk
|
||||
@@ -0,0 +1,80 @@
|
||||
_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="$(lsipc -m --noheadings -o ID)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-M'|'--shmem-key')
|
||||
KEYIDS="$(lsipc -m --noheadings -o KEY)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--posix-shmem')
|
||||
KEYIDS="$(lsipc -M --noheadings -o NAME)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-q'|'--queue-id')
|
||||
KEYIDS="$(lsipc -q --noheadings -o ID)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-Q'|'--queue-key')
|
||||
KEYIDS="$(lsipc -q --noheadings -o KEY)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--posix-mqueue')
|
||||
KEYIDS="$(lsipc -Q --noheadings -o NAME)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--semaphore-id')
|
||||
KEYIDS="$(lsipc -s --noheadings -o ID)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--semaphore-key')
|
||||
KEYIDS="$(lsipc -s --noheadings -o KEY)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--posix-semaphore')
|
||||
KEYIDS="$(lsipc -S --noheadings -o NAME)"
|
||||
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
'=')
|
||||
cur=${cur#=}
|
||||
COMPREPLY=( $(compgen -W "shm pshm msg pmsg sem psem" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS=" --shmem-id
|
||||
--shmem-key
|
||||
--posix-shmem
|
||||
--queue-id
|
||||
--queue-key
|
||||
--posix-mqueue
|
||||
--semaphore-id
|
||||
--semaphore-key
|
||||
--posix-semaphore
|
||||
--all=
|
||||
--verbose
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _ipcrm_module ipcrm
|
||||
@@ -0,0 +1,33 @@
|
||||
_ipcs_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-i'|'--id')
|
||||
COMPREPLY=( $(compgen -W "id" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--id
|
||||
--help
|
||||
--version
|
||||
--shmems
|
||||
--queues
|
||||
--semaphores
|
||||
--all
|
||||
--time
|
||||
--pid
|
||||
--creator
|
||||
--limits
|
||||
--summary
|
||||
--human
|
||||
--bytes"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _ipcs_module ipcs
|
||||
@@ -0,0 +1,27 @@
|
||||
_isosize_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-d'|'--divisor')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $(compgen -W "--divisor --sectors --help --version" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _isosize_module isosize
|
||||
@@ -0,0 +1,68 @@
|
||||
_ldattach_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-s'|'--speed')
|
||||
COMPREPLY=( $(compgen -W "speed" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--intro-command')
|
||||
COMPREPLY=( $(compgen -W "string" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--pause')
|
||||
COMPREPLY=( $(compgen -W "seconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-i'|'--iflag')
|
||||
local IFLAGS
|
||||
IFLAGS="BRKINT ICRNL IGNBRK IGNCR IGNPAR IMAXBEL
|
||||
INLCR INPCK ISTRIP IUCLC IUTF8 IXANY
|
||||
IXOFF IXON PARMRK
|
||||
-BRKINT -ICRNL -IGNBRK -IGNCR -IGNPAR -IMAXBEL
|
||||
-INLCR -INPCK -ISTRIP -IUCLC -IUTF8 -IXANY
|
||||
-IXOFF -IXON -PARMRK"
|
||||
COMPREPLY=( $(compgen -W "$IFLAGS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--debug
|
||||
--speed
|
||||
--intro-command
|
||||
--pause
|
||||
--sevenbits
|
||||
--eightbits
|
||||
--noparity
|
||||
--evenparity
|
||||
--oddparity
|
||||
--onestopbit
|
||||
--twostopbits
|
||||
--iflag
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
/*)
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local LDISC_DEVICE
|
||||
LDISC_DEVICE="6PACK AX25 GIGASET GIGASET_M101 HCI HDLC IRDA M101
|
||||
MOUSE PPP PPS R3964 SLIP STRIP SYNCPPP SYNC_PPP
|
||||
TTY X25 /dev/"
|
||||
COMPREPLY=( $(compgen -W "$LDISC_DEVICE" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _ldattach_module ldattach
|
||||
@@ -0,0 +1,84 @@
|
||||
_logger_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-f'|'--file'|'--journald')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-n'|'--server')
|
||||
COMPREPLY=( $(compgen -A hostname -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-P'|'--port')
|
||||
COMPREPLY=( $(compgen -W "$(awk '$1 ~ /^syslog$/ {split($2, a, "/"); print a[1]}' /etc/services)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--priority')
|
||||
COMPREPLY=( $(compgen -W "{auth,authpriv,cron,daemon,ftp,lpr,mail,news,security}.{alert,crit,debug,emerg,err,error}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--tag')
|
||||
COMPREPLY=( $(compgen -W "tag" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-u'|'--socket')
|
||||
COMPREPLY=( $(compgen -W "$(awk '$NF ~ /^\// {print $NF}' /proc/net/unix)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--socket-errors')
|
||||
COMPREPLY=( $(compgen -W "on off auto" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--msgid')
|
||||
COMPREPLY=( $(compgen -W "msgid" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--sd-id')
|
||||
COMPREPLY=( $(compgen -W "timeQuality origin meta" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--file
|
||||
--help
|
||||
--id
|
||||
--journald
|
||||
--msgid
|
||||
--no-act
|
||||
--octet-count
|
||||
--port
|
||||
--prio-prefix
|
||||
--priority
|
||||
--rfc3164
|
||||
--rfc5424
|
||||
--sd-id
|
||||
--sd-param
|
||||
--server
|
||||
--size
|
||||
--skip-empty
|
||||
--socket
|
||||
--socket-errors
|
||||
--stderr
|
||||
--tag
|
||||
--tcp
|
||||
--udp
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _logger_module logger
|
||||
@@ -0,0 +1,79 @@
|
||||
_losetup_module()
|
||||
{
|
||||
local cur prev OPTS ARG
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-d'|'--detach')
|
||||
ARG="$($1 --output NAME | awk '{if (1 < NR) {print}}')"
|
||||
COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-j'|'--associated')
|
||||
ARG="$($1 --output BACK-FILE | awk '{if (1 < NR) {print}}')"
|
||||
COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--set-capacity')
|
||||
ARG="$(for I in /dev/loop[0-9]*; do if [ -e $I ]; then echo $I; fi; done)"
|
||||
COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--offset'|'--sizelimit')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-O'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="NAME AUTOCLEAR BACK-FILE BACK-INO
|
||||
BACK-MAJ:MIN MAJ:MIN OFFSET PARTSCAN RO
|
||||
SIZELIMIT DIO"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--all
|
||||
--detach
|
||||
--detach-all
|
||||
--find
|
||||
--set-capacity
|
||||
--associated
|
||||
--nooverlap
|
||||
--offset
|
||||
--sizelimit
|
||||
--partscan
|
||||
--read-only
|
||||
--show
|
||||
--verbose
|
||||
--json
|
||||
--list
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--raw
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _losetup_module losetup
|
||||
@@ -0,0 +1,110 @@
|
||||
_lsblk_module()
|
||||
{
|
||||
local cur prev OPTS LSBLK_COLS_ALL
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
LSBLK_COLS_ALL="
|
||||
ALIGNMENT ID-LINK ID DISC-ALN DAX DISC-GRAN DISK-SEQ DISC-MAX
|
||||
DISC-ZERO FSAVAIL FSROOTS FSSIZE FSTYPE FSUSED FSUSE% FSVER
|
||||
GROUP HCTL HOTPLUG KNAME LABEL LOG-SEC MAJ:MIN MAJ MIN MIN-IO
|
||||
MODE MODEL MQ NAME OPT-IO OWNER PARTFLAGS PARTLABEL PARTN
|
||||
PARTTYPE PARTTYPENAME PARTUUID PATH PHY-SEC PKNAME PTTYPE
|
||||
PTUUID RA RAND REV RM RO ROTA RQ-SIZE SCHED SERIAL SIZE START
|
||||
STATE SUBSYSTEMS MOUNTPOINT MOUNTPOINTS TRAN TYPE UUID VENDOR
|
||||
WSAME WWN ZONED ZONE-SZ ZONE-WGRAN ZONE-APP ZONE-NR ZONE-OMAX
|
||||
ZONE-AMAX
|
||||
"
|
||||
case $prev in
|
||||
'-e'|'--exclude'|'-I'|'--include')
|
||||
local realcur prefix MAJOR_ALL MAJOR I J
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for I in /sys/dev/block/*; do
|
||||
J=${I##*/}
|
||||
MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}"
|
||||
done
|
||||
for WORD in ${MAJOR_ALL:-""}; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
MAJOR="$WORD ${MAJOR:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output'|'-E'|'--dedup')
|
||||
local prefix realcur LSBLK_COLS
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $LSBLK_COLS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
LSBLK_COLS="$WORD ${LSBLK_COLS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$LSBLK_COLS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'--properties-by')
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -W "file udev blkid none" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-x'|'--sort')
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -W "$LSBLK_COLS_ALL" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--all
|
||||
--bytes
|
||||
--nodeps
|
||||
--discard
|
||||
--exclude
|
||||
--fs
|
||||
--filter
|
||||
--highlight
|
||||
--hyperlink
|
||||
--ct
|
||||
--ct-filter
|
||||
--help
|
||||
--include
|
||||
--json
|
||||
--ascii
|
||||
--list
|
||||
--dedup
|
||||
--merge
|
||||
--perms
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--paths
|
||||
--pairs
|
||||
--properties-by
|
||||
--raw
|
||||
--inverse
|
||||
--topology
|
||||
--scsi
|
||||
--nvme
|
||||
--virtio
|
||||
--sort
|
||||
--width
|
||||
--list-columns
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$($1 -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _lsblk_module lsblk
|
||||
@@ -0,0 +1,55 @@
|
||||
_lscpu_module()
|
||||
{
|
||||
local cur OPTS_ALL
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'--extended='|'=')
|
||||
local prefix realcur OPTS
|
||||
cur=${cur#=}
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OPTS_ALL="CPU CORE SOCKET NODE
|
||||
BOOK DRAWER CACHE POLARIZATION ADDRESS
|
||||
CONFIGURED ONLINE MAXMHZ MINMHZ"
|
||||
for WORD in $OPTS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OPTS="$WORD ${OPTS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OPTS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS_ALL="--all
|
||||
--online
|
||||
--bytes
|
||||
--caches
|
||||
--offline
|
||||
--json
|
||||
--extended=
|
||||
--parse=
|
||||
--sysroot
|
||||
--hex
|
||||
--physical
|
||||
--output-all
|
||||
--raw
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _lscpu_module lscpu
|
||||
@@ -0,0 +1,80 @@
|
||||
_lsipc_module()
|
||||
{
|
||||
local cur prev OPTS ARG
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-i'|'--id')
|
||||
COMPREPLY=( $(compgen -W "id" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-N'|'--name')
|
||||
COMPREPLY=( $(compgen -W "name" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
'--time-format')
|
||||
COMPREPLY=( $(compgen -W "short full iso" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="
|
||||
KEY ID OWNER PERMS CUID CUSER CGID
|
||||
CGROUP UID USER GID GROUP CTIME
|
||||
|
||||
SIZE NATTCH STATUS ATTACH DETACH
|
||||
COMMAND CPID LPID
|
||||
|
||||
USEDBYTES MSGS SEND RECV LSPID LRPID
|
||||
|
||||
NSEMS OTIME
|
||||
|
||||
RESOURCE DESCRIPTION LIMIT USED USE%
|
||||
"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="
|
||||
--shmems
|
||||
--posix-shmems
|
||||
--queues
|
||||
--posix-mqueues
|
||||
--semaphores
|
||||
--posix-semaphores
|
||||
--global
|
||||
--id
|
||||
--name
|
||||
--noheadings
|
||||
--notruncate
|
||||
--time-format
|
||||
--bytes
|
||||
--creator
|
||||
--export
|
||||
--json
|
||||
--newline
|
||||
--list
|
||||
--output
|
||||
--numeric-perms
|
||||
--raw
|
||||
--time
|
||||
--shell
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _lsipc_module lsipc
|
||||
@@ -0,0 +1,51 @@
|
||||
_lslocks_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-p'|'--pid')
|
||||
local PIDS
|
||||
# /proc/locks can have 8 to 9 fields, see commit
|
||||
# 55c0d16bab8cc84b72bf11cb2fdd8aa6205ac608
|
||||
PIDS="$(awk '{print $(NF-3)}' /proc/locks)"
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--bytes
|
||||
--json
|
||||
--noinaccessible
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--pid
|
||||
--raw
|
||||
--notruncate
|
||||
--list-columns
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
|
||||
}
|
||||
complete -F _lslocks_module lslocks
|
||||
@@ -0,0 +1,78 @@
|
||||
_lslogins_module()
|
||||
{
|
||||
local cur prev OPTS LSLOGINS_COLS_ALL
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
LSLOGINS_COLS_ALL="
|
||||
USER UID GECOS HOMEDIR SHELL NOLOGIN PWD-LOCK PWD-EMPTY
|
||||
PWD-DENY GROUP GID SUPP-GROUPS SUPP-GIDS LAST-LOGIN LAST-TTY
|
||||
LAST-HOSTNAME FAILED-LOGIN FAILED-TTY HUSHED PWD-WARN
|
||||
PWD-CHANGE PWD-MIN PWD-MAX PWD-EXPIR CONTEXT PROC
|
||||
"
|
||||
case $prev in
|
||||
'-g'|'--groups')
|
||||
COMPREPLY=( $(compgen -W "$(getent group | awk -F: '{print $1}')" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-l'|'--logins')
|
||||
COMPREPLY=( $(compgen -W "$(getent passwd | awk -F: '{print $1}')" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--time-format')
|
||||
COMPREPLY=( $(compgen -W "short full iso" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--wtmp-file'|'--btmp-file'|'--lastlog')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur LSLOGINS_COLS
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $LSLOGINS_COLS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$LSLOGINS_COLS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "
|
||||
--acc-expiration
|
||||
--colon-separate
|
||||
--export
|
||||
--failed
|
||||
--supp-groups
|
||||
--groups
|
||||
--last
|
||||
--logins
|
||||
--newline
|
||||
--noheadings
|
||||
--notruncate
|
||||
--output
|
||||
--output-all
|
||||
--pwd
|
||||
--raw
|
||||
--system-accs
|
||||
--time-format
|
||||
--user-accs
|
||||
--context
|
||||
--print0
|
||||
--wtmp-file
|
||||
--btmp-file
|
||||
--lastlog
|
||||
--help
|
||||
--version
|
||||
" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _lslogins_module lslogins
|
||||
@@ -0,0 +1,53 @@
|
||||
_lsmem_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES'
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--sysroot')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
|
||||
return 0
|
||||
;;
|
||||
'--summary')
|
||||
COMPREPLY=( $(compgen -W "never always only" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="
|
||||
--json
|
||||
--pairs
|
||||
--all
|
||||
--bytes
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--raw
|
||||
--sysroot
|
||||
--summary
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _lsmem_module lsmem
|
||||
@@ -0,0 +1,61 @@
|
||||
_lsns_module()
|
||||
{
|
||||
local cur prev OPTS LSNS_COLS_ALL
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
LSNS_COLS_ALL="
|
||||
NS TYPE PATH NPROCS PID PPID COMMAND UID USER
|
||||
"
|
||||
case $prev in
|
||||
'-o'|'--output')
|
||||
local prefix realcur LSNS_COLS
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $LSNS_COLS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
LSNS_COLS="$WORD ${LSNS_COLS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$LSNS_COLS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--task')
|
||||
COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--type')
|
||||
COMPREPLY=( $(compgen -W "mnt net ipc user pid uts cgroup time" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $(compgen -W "
|
||||
--list-columns
|
||||
--filter
|
||||
--json
|
||||
--list
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--persistent
|
||||
--task
|
||||
--raw
|
||||
--notruncate
|
||||
--nowrap
|
||||
--type
|
||||
--tree
|
||||
--help
|
||||
--version
|
||||
" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _lsns_module lsns
|
||||
@@ -0,0 +1,31 @@
|
||||
_mcookie_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-f'|'--file')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-m'|'--max-size')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--file --max-size --verbose --version --help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _mcookie_module mcookie
|
||||
@@ -0,0 +1,28 @@
|
||||
_mkfs_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-t'|'--type')
|
||||
FSTYPES=$(for I in /sbin/mkfs.* /usr/sbin/mkfs.*; do if [ -e $I ]; then echo ${I##*mkfs.}; fi; done)
|
||||
COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS='--type --verbose --help --version'
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _mkfs_module mkfs
|
||||
@@ -0,0 +1,47 @@
|
||||
_mkswap_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-p'|'--pagesize')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-L'|'--label')
|
||||
COMPREPLY=( $(compgen -W "label" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-v'|'--swapversion')
|
||||
COMPREPLY=( $(compgen -W "1" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-U'|'--uuid')
|
||||
COMPREPLY=( $(compgen -W "$(uuidgen -r)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--offset')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--size')
|
||||
COMPREPLY=( $(compgen -W "bytes" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--check --force --pagesize --lock --label --swapversion --uuid --offset --verbose --version --help --size --file"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _mkswap_module mkswap
|
||||
@@ -0,0 +1,45 @@
|
||||
_more_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
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--silent
|
||||
--logical
|
||||
--no-pause
|
||||
--print-over
|
||||
--clean-print
|
||||
--squeeze
|
||||
--plain
|
||||
--lines
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
+*)
|
||||
OPTS="+number +/pattern"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _more_module more
|
||||
@@ -0,0 +1,102 @@
|
||||
_mount_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-t'|'--types')
|
||||
local prefix realcur TYPES
|
||||
TYPES="
|
||||
$(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}')
|
||||
$(awk '{print $NF, "no" $NF}' /proc/filesystems)
|
||||
"
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $TYPES; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
TYPE_COLS="$WORD ${TYPE_COLS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$TYPE_COLS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-L'|'--label')
|
||||
local LABELS
|
||||
LABELS="$(lsblk -o LABEL -nr)"
|
||||
COMPREPLY=( $(compgen -W "$LABELS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-U'|'--uuid')
|
||||
local UUIDS
|
||||
UUIDS="$(lsblk -o UUID -nr)"
|
||||
COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-N'|'--namespace')
|
||||
local NAMESPACE
|
||||
NAMESPACE="$(lsns --type mnt --output PATH --noheadings)"
|
||||
COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--options-mode')
|
||||
COMPREPLY=( $(compgen -W "ignore append prepend replace" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--options-source')
|
||||
COMPREPLY=( $(compgen -W "fstab mtab disable" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS=" --all
|
||||
--no-canonicalize
|
||||
--fake
|
||||
--fork
|
||||
--fstab
|
||||
--help
|
||||
--internal-only
|
||||
--show-labels
|
||||
--no-mtab
|
||||
--options
|
||||
--options-mode
|
||||
--options-source
|
||||
--options-source-force
|
||||
--test-opts
|
||||
--read-only
|
||||
--types
|
||||
--source
|
||||
--target
|
||||
--verbose
|
||||
--version
|
||||
--read-write
|
||||
--namespace
|
||||
--label
|
||||
--uuid
|
||||
--bind
|
||||
--move
|
||||
--rbind
|
||||
--make-shared
|
||||
--make-slave
|
||||
--make-private
|
||||
--make-unbindable
|
||||
--make-rshared
|
||||
--make-rslave
|
||||
--make-rprivate
|
||||
--make-runbindable
|
||||
--mkdir"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _mount_module mount
|
||||
@@ -0,0 +1,24 @@
|
||||
_mountpoint_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--quiet --nofollow --fs-devno --devno --help --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _mountpoint_module mountpoint
|
||||
@@ -0,0 +1,24 @@
|
||||
_namei_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--help --version --mountpoints --modes --owners --long --nosymlinks --vertical"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _namei_module namei
|
||||
@@ -0,0 +1,30 @@
|
||||
_newgrp_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
'-c'|'--command')
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--version --help --command"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
if (( COMP_CWORD == 1 )) || [[ " ${COMP_WORDS[@]}" =~ " "-?-c ]]; then
|
||||
COMPREPLY=( $(compgen -g -- $cur) )
|
||||
else
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -F _newgrp_module newgrp
|
||||
@@ -0,0 +1,70 @@
|
||||
_nsenter_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-S'|'--uid')
|
||||
COMPREPLY=( follow $(compgen -W "uid" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-G'|'--gid')
|
||||
COMPREPLY=( follow $(compgen -W "gid" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--target')
|
||||
local PIDS
|
||||
PIDS=$(cd /proc && echo [0-9]*)
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
'=')
|
||||
# FIXME: --root and --wd should use get only
|
||||
# directories as compgen output. If $cur is
|
||||
# overwrote the same way as below in case segment
|
||||
# for $prev the command-line will get mangled.
|
||||
cur=${cur#=}
|
||||
;;
|
||||
-*)
|
||||
OPTS="
|
||||
--all
|
||||
--target
|
||||
--mount=
|
||||
--uts=
|
||||
--ipc=
|
||||
--net=
|
||||
--net-socket
|
||||
--pid=
|
||||
--cgroup=
|
||||
--user=
|
||||
--user-parent
|
||||
--time=
|
||||
--setuid
|
||||
--setgid
|
||||
--keep-caps
|
||||
--preserve-credentials
|
||||
--root=
|
||||
--wd=
|
||||
--wdns=
|
||||
--env
|
||||
--no-fork
|
||||
--join-cgroup
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _nsenter_module nsenter
|
||||
@@ -0,0 +1,66 @@
|
||||
_partx_module()
|
||||
{
|
||||
local cur prev OPTS OUTPUT_ALL
|
||||
COMPREPLY=()
|
||||
OUTPUT_ALL="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME"
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-n'|'--nr')
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local realcur prefix OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-S'|'--sector-size')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--type')
|
||||
COMPREPLY=( $(compgen -W "$(partx --list-types)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--add
|
||||
--delete
|
||||
--update
|
||||
--show
|
||||
--bytes
|
||||
--noheadings
|
||||
--nr
|
||||
--output
|
||||
--output-all
|
||||
--pairs
|
||||
--raw
|
||||
--sector-size
|
||||
--type
|
||||
--list-types
|
||||
--verbose
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _partx_module partx
|
||||
@@ -0,0 +1,21 @@
|
||||
_pivot_root_module()
|
||||
{
|
||||
local cur prev
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $COMP_CWORD in
|
||||
1|2)
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _pivot_root_module pivot_root
|
||||
@@ -0,0 +1,69 @@
|
||||
_prlimit_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-p'|'--pid')
|
||||
PIDS=$(cd /proc && echo [0-9]*)
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
'=')
|
||||
cur=${cur#=}
|
||||
# FIXME: is there anything what could be printed
|
||||
# as limit value(s)
|
||||
;;
|
||||
-*)
|
||||
OPTS="--pid
|
||||
--output
|
||||
--noheadings
|
||||
--raw
|
||||
--verbose
|
||||
--help
|
||||
--version
|
||||
--core=
|
||||
--data=
|
||||
--nice=
|
||||
--fsize=
|
||||
--sigpending=
|
||||
--memlock=
|
||||
--rss=
|
||||
--nofile=
|
||||
--msgqueue=
|
||||
--rtprio=
|
||||
--stack=
|
||||
--cpu=
|
||||
--nproc=
|
||||
--as=
|
||||
--locks=
|
||||
--rttime="
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _prlimit_module prlimit
|
||||
@@ -0,0 +1,37 @@
|
||||
_readprofile_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-m'|'--mapfile'|'-p'|'--profile')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-M'|'--multiplier')
|
||||
COMPREPLY=( $(compgen -W "multiplier" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--mapfile
|
||||
--profile
|
||||
--multiplier
|
||||
--info
|
||||
--verbose
|
||||
--all
|
||||
--histbin
|
||||
--counters
|
||||
--reset
|
||||
--no-auto
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _readprofile_module readprofile
|
||||
@@ -0,0 +1,34 @@
|
||||
_rename_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--verbose --symlink --help --version --no-act --all --last --no-overwrite --interactive"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $COMP_CWORD in
|
||||
1)
|
||||
COMPREPLY=( $(compgen -W "expression" -- $cur) )
|
||||
;;
|
||||
2)
|
||||
COMPREPLY=( $(compgen -W "replacement" -- $cur) )
|
||||
;;
|
||||
*)
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
complete -F _rename_module rename
|
||||
@@ -0,0 +1,41 @@
|
||||
_renice_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-g'|'--pgrp')
|
||||
local PGRP
|
||||
PGRP=$(ps -ax -opgrp | sed '1d')
|
||||
COMPREPLY=( $(compgen -W "$PGRP" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-n'|'--priority')
|
||||
COMPREPLY=( $(compgen -W "{-20..20}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--pid')
|
||||
local PIDS
|
||||
PIDS=$(cd /proc && echo [0-9]*)
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-u'|'--user')
|
||||
COMPREPLY=( $(compgen -u -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="--pgrp
|
||||
--priority
|
||||
--pid
|
||||
--user
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _renice_module renice
|
||||
@@ -0,0 +1,24 @@
|
||||
_rev_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--version --help --zero"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _rev_module rev
|
||||
@@ -0,0 +1,59 @@
|
||||
_rtcwake_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-A'|'--adjfile')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-d'|'--device')
|
||||
local RTC_DEVS
|
||||
RTC_DEVS=$(cd /sys/class/rtc/ && echo *)
|
||||
COMPREPLY=( $(compgen -W "$RTC_DEVS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-m'|'--mode')
|
||||
COMPREPLY=( $(compgen -W "$(rtcwake --list-modes)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--seconds')
|
||||
COMPREPLY=( $(compgen -W "seconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--time')
|
||||
COMPREPLY=( $(compgen -W "time_t" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--date')
|
||||
COMPREPLY=( $(compgen -W "YYYYMMDDhhmmss" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS="
|
||||
--auto
|
||||
--adjfile
|
||||
--date
|
||||
--device
|
||||
--dry-run
|
||||
--local
|
||||
--list-modes
|
||||
--mode
|
||||
--seconds
|
||||
--time
|
||||
--utc
|
||||
--verbose
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _rtcwake_module rtcwake
|
||||
@@ -0,0 +1 @@
|
||||
su
|
||||
@@ -0,0 +1,59 @@
|
||||
_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
|
||||
;;
|
||||
'-E'|'--echo')
|
||||
COMPREPLY=( $(compgen -W "auto always never" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output-limit')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-m'|'--logging-format')
|
||||
COMPREPLY=( $(compgen -W "classic advanced" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
'=')
|
||||
cur=${cur#=}
|
||||
;;
|
||||
-*)
|
||||
OPTS="--append
|
||||
--command
|
||||
--echo
|
||||
--log-in
|
||||
--log-out
|
||||
--log-io
|
||||
--log-timing
|
||||
--logging-format
|
||||
--return
|
||||
--flush
|
||||
--force
|
||||
--quiet
|
||||
--output-limit
|
||||
--timing=
|
||||
--version
|
||||
--help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _script_module script
|
||||
@@ -0,0 +1,41 @@
|
||||
_scriptlive_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
|
||||
;;
|
||||
'-d'|'--divisor'|'-m'|'--maxdelay')
|
||||
COMPREPLY=( $(compgen -W "digit" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--timing
|
||||
--log-in
|
||||
--log-io
|
||||
--log-timing
|
||||
--command
|
||||
--divisor
|
||||
--maxdelay
|
||||
--version
|
||||
--help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _scriptlive_module scriptlive
|
||||
@@ -0,0 +1,48 @@
|
||||
_scriptreplay_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-c'|'--cr-mode')
|
||||
COMPREPLY=( $(compgen -W "auto never always" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-d'|'--divisor'|'-m'|'--maxdelay')
|
||||
COMPREPLY=( $(compgen -W "digit" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-x'|'--stream')
|
||||
COMPREPLY=( $(compgen -W "out in signal info" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--timing
|
||||
--log-in
|
||||
--log-out
|
||||
--log-io
|
||||
--log-timing
|
||||
--summary
|
||||
--stream
|
||||
--cr-mode
|
||||
--typescript
|
||||
--divisor
|
||||
--maxdelay
|
||||
--version
|
||||
--help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _scriptreplay_module scriptreplay
|
||||
@@ -0,0 +1,44 @@
|
||||
_setarch_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
COMPREPLY=( $(compgen -W "$($1 --list)" -- $cur) )
|
||||
return 0
|
||||
fi
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--32bit
|
||||
--fdpic-funcptrs
|
||||
--short-inode
|
||||
--addr-compat-layout
|
||||
--addr-no-randomize
|
||||
--whole-seconds
|
||||
--sticky-timeouts
|
||||
--read-implies-exec
|
||||
--mmap-page-zero
|
||||
--3gb
|
||||
--4gb
|
||||
--uname-2.6
|
||||
--verbose
|
||||
--list
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _setarch_module setarch
|
||||
@@ -0,0 +1,142 @@
|
||||
_setpriv_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'--ambient-caps'|'--inh-caps'|'--bounding-set')
|
||||
local prefix realcur INHERIT_ALL INHERIT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
INHERIT_ALL=$($1 --list-caps| awk '{print $1, "-" $1}')
|
||||
for WORD in $INHERIT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
INHERIT="$WORD ${INHERIT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$INHERIT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'--ruid'|'--euid'|'--reuid')
|
||||
local UIDS
|
||||
UIDS=$(getent passwd | awk -F: '{print $1}')
|
||||
COMPREPLY=( $(compgen -W "$UIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--rgid'|'--egid'|'--regid')
|
||||
local GIDS
|
||||
GIDS=$(getent group | awk -F: '{print $1}')
|
||||
COMPREPLY=( $(compgen -W "$GIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--groups')
|
||||
local prefix realcur GIDS_ALL GIDS
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
GIDS_ALL=$(getent group | awk -F: '{print $3}')
|
||||
for WORD in $GIDS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
GIDS="$WORD ${GIDS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$GIDS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'--securebits')
|
||||
local prefix realcur SBITS_ALL SBITS WORD
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
SBITS_ALL="
|
||||
{+,-}keep_caps_locked
|
||||
{+,-}noroot
|
||||
{+,-}noroot_locked
|
||||
{+,-}no_setuid_fixup
|
||||
{+,-}no_setuid_fixup_locked
|
||||
"
|
||||
for WORD in $SBITS_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
SBITS="$WORD ${SBITS:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'--pdeathsig')
|
||||
local i signals
|
||||
for i in $(kill -l); do
|
||||
case $i in
|
||||
SIG*)
|
||||
signals+="$i "
|
||||
;;
|
||||
esac
|
||||
done
|
||||
COMPREPLY=( $(compgen -W "keep clear $signals" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--selinux-label')
|
||||
# FIXME: how to list selinux labels?
|
||||
COMPREPLY=( $(compgen -W "label" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--apparmor-profile')
|
||||
# FIXME: how to list apparmor profiles?
|
||||
COMPREPLY=( $(compgen -W "profile" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--landlock-access')
|
||||
# FIXME: how to list landlock accesses?
|
||||
COMPREPLY=( $(compgen -W "access" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--landlock-rule')
|
||||
# FIXME: how to list landlock rules?
|
||||
COMPREPLY=( $(compgen -W "rule" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--seccomp-filter')
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--dump
|
||||
--no-new-privs
|
||||
--ambient-caps
|
||||
--inh-caps
|
||||
--bounding-set
|
||||
--ruid
|
||||
--euid
|
||||
--rgid
|
||||
--egid
|
||||
--reuid
|
||||
--regid
|
||||
--clear-groups
|
||||
--keep-groups
|
||||
--groups
|
||||
--securebits
|
||||
--pdeathsig
|
||||
--reset-env
|
||||
--selinux-label
|
||||
--apparmor-profile
|
||||
--landlock-access
|
||||
--landlock-rule
|
||||
--seccomp-filter
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _setpriv_module setpriv
|
||||
@@ -0,0 +1,23 @@
|
||||
_setsid_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--ctty --wait --help --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _setsid_module setsid
|
||||
@@ -0,0 +1,127 @@
|
||||
_setterm_module()
|
||||
{
|
||||
local bright cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'--term')
|
||||
local TERM_LIST I
|
||||
TERM_LIST=''
|
||||
for I in /usr/share/terminfo/?/*; do
|
||||
TERM_LIST+="${I##*/} "
|
||||
done
|
||||
COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--foreground'|'--background')
|
||||
COMPREPLY=( $(compgen -W "black blue cyan default green magenta red white yellow" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--ulcolor'|'--hbcolor'|'bright')
|
||||
if [ $prev != 'bright' ]; then
|
||||
bright='bright black grey'
|
||||
else
|
||||
bright=''
|
||||
fi
|
||||
COMPREPLY=( $(compgen -W "$bright blue cyan green magenta red white yellow" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--cursor'|'--repeat'|'--appcursorkeys'|'--linewrap'|'--inversescreen'|'--bold'|'--half-bright'|'--blink'|'--reverse'|'--underline'|'--msg')
|
||||
COMPREPLY=( $(compgen -W "off on" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--clear')
|
||||
COMPREPLY=( $(compgen -W "all rest" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--tabs'|'--clrtabs')
|
||||
COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--regtabs')
|
||||
COMPREPLY=( $(compgen -W "{1..160}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--blank')
|
||||
COMPREPLY=( $(compgen -W "{0..60} force poke" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--dump'|'--append')
|
||||
local NUM_CONS
|
||||
NUM_CONS=(/dev/vcsa?*)
|
||||
COMPREPLY=( $(compgen -W "{1..${#NUM_CONS[*]}}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--file')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--msglevel')
|
||||
COMPREPLY=( $(compgen -W "{0..8}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--powersave')
|
||||
COMPREPLY=( $(compgen -W "on vsync hsync powerdown off" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--powerdown')
|
||||
COMPREPLY=( $(compgen -W "{0..60}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--blength')
|
||||
COMPREPLY=( $(compgen -W "0-2000" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--bfreq')
|
||||
COMPREPLY=( $(compgen -W "freqnumber" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--help'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
OPTS=" --term
|
||||
--reset
|
||||
--resize
|
||||
--initialize
|
||||
--cursor
|
||||
--repeat
|
||||
--appcursorkeys
|
||||
--linewrap
|
||||
--default
|
||||
--foreground
|
||||
--background
|
||||
--ulcolor
|
||||
--hbcolor
|
||||
--ulcolor
|
||||
--hbcolor
|
||||
--inversescreen
|
||||
--bold
|
||||
--half-bright
|
||||
--blink
|
||||
--reverse
|
||||
--underline
|
||||
--store
|
||||
--clear
|
||||
--tabs
|
||||
--clrtabs
|
||||
--regtabs
|
||||
--blank
|
||||
--dump
|
||||
--append
|
||||
--file
|
||||
--msg
|
||||
--msglevel
|
||||
--powersave
|
||||
--powerdown
|
||||
--blength
|
||||
--bfreq
|
||||
--version
|
||||
--help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _setterm_module setterm
|
||||
@@ -0,0 +1,74 @@
|
||||
_sqv() {
|
||||
local i cur prev opts cmd
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cmd=""
|
||||
opts=""
|
||||
|
||||
for i in ${COMP_WORDS[@]}
|
||||
do
|
||||
case "${cmd},${i}" in
|
||||
",$1")
|
||||
cmd="sqv"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "${cmd}" in
|
||||
sqv)
|
||||
opts="-n -v -h -V --output --signature-file --message --cleartext --keyring --not-after --not-before --signatures --verbose --policy-as-of --help --version <FILE> [DATA-FILE]"
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
fi
|
||||
case "${prev}" in
|
||||
--output)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--signature-file)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--keyring)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--not-after)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--not-before)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--signatures)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-n)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--policy-as-of)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
|
||||
complete -F _sqv -o nosort -o bashdefault -o default sqv
|
||||
else
|
||||
complete -F _sqv -o bashdefault -o default sqv
|
||||
fi
|
||||
@@ -0,0 +1,54 @@
|
||||
_su_module()
|
||||
{
|
||||
local cur prev OPTS prog
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
prog="${COMP_WORDS[0]}"
|
||||
case $prev in
|
||||
'-'|'-u'|'--user')
|
||||
COMPREPLY=( $(compgen -u -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-g'|'--group'|'-G'|'--supp-group')
|
||||
COMPREPLY=( $(compgen -g -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--shell')
|
||||
COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS=" --preserve-environment
|
||||
--whitelist-environment
|
||||
--group
|
||||
--supp-group
|
||||
--login
|
||||
--command
|
||||
--session-command
|
||||
--fast
|
||||
--shell
|
||||
--pty
|
||||
--no-pty
|
||||
--help
|
||||
--version"
|
||||
if [ "${prog}" = runuser ]; then
|
||||
OPTS=" ${OPTS}
|
||||
--user"
|
||||
fi
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -u -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _su_module su
|
||||
complete -F _su_module runuser
|
||||
@@ -0,0 +1,32 @@
|
||||
_swaplabel_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-L'|'--label')
|
||||
COMPREPLY=( $(compgen -W "label" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-U'|'--uuid')
|
||||
COMPREPLY=( $(compgen -W '$(uuidgen)' -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--label --uuid --help --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _swaplabel_module swaplabel
|
||||
@@ -0,0 +1,38 @@
|
||||
_swapoff_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-a'|'--all')
|
||||
return 0
|
||||
;;
|
||||
'-U'|'UUID=')
|
||||
COMPREPLY=( $(compgen -W "$(swapon --show=UUID --noheading)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-L'|'LABEL=')
|
||||
COMPREPLY=( $(compgen -W "$(swapon --show=LABEL --noheading)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="-L
|
||||
-U
|
||||
--all
|
||||
--verbose
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "$(swapon --show=NAME --raw --noheading)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _swapoff_module swapoff
|
||||
@@ -0,0 +1,85 @@
|
||||
_swapon_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-p'|'--priority')
|
||||
# Priority range is -1 to 32767. Perhaps these
|
||||
# few are enough.
|
||||
COMPREPLY=( $(compgen -W "{-1..9} 32767" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'--show')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="NAME TYPE SIZE USED PRIO UUID LABEL"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-U'|'UUID=')
|
||||
local UUIDS
|
||||
UUIDS="$(lsblk -nrp -o FSTYPE,UUID | awk '$1 ~ /swap/ { print $2 }')"
|
||||
COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-L'|'LABEL=')
|
||||
local LABELS
|
||||
LABELS="$(lsblk -nrp -o FSTYPE,LABEL | awk '$1 ~ /swap/ { print $2 }')"
|
||||
COMPREPLY=( $(compgen -W "$LABELS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'PARTUUID=')
|
||||
local PARTUUIDS
|
||||
PARTUUIDS="$(lsblk -nrp -o FSTYPE,PARTUUID | awk '$1 ~ /swap/ { print $2 }')"
|
||||
COMPREPLY=( $(compgen -W "$PARTUUIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'PARTLABEL=')
|
||||
local PARTLABELS
|
||||
PARTLABELS="$(lsblk -nrp -o FSTYPE,PARTLABEL | awk '$1 ~ /swap/ { print $2 }')"
|
||||
COMPREPLY=( $(compgen -W "$PARTLABELS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--all
|
||||
--discard
|
||||
--ifexists
|
||||
--fixpgsz
|
||||
--fstab
|
||||
--priority
|
||||
--summary
|
||||
--show
|
||||
--output-all
|
||||
--noheadings
|
||||
--raw
|
||||
--bytes
|
||||
--verbose
|
||||
-L
|
||||
-U
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local DEVS
|
||||
DEVS="$(lsblk -nrp -o FSTYPE,NAME | awk '$1 ~ /swap/ { print $2 }')"
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -fW "$DEVS LABEL= UUID= PARTLABEL= PARTUUID=" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _swapon_module swapon
|
||||
@@ -0,0 +1,47 @@
|
||||
_taskset_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-c'|'--cpu-list')
|
||||
local prefix realcur CPULIST_ALL CPULIST
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
|
||||
for WORD in $(eval echo $CPULIST_ALL); do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
CPULIST="$WORD ${CPULIST:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-p'|'--pid')
|
||||
local PIDS
|
||||
# FIXME: the pid argument is ambiguous. When
|
||||
# setting an affinity the optarg has to be cpu
|
||||
# mask. The following is good only for getting
|
||||
# affinity.
|
||||
PIDS=$(cd /proc && echo [0-9]*)
|
||||
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--all-tasks --pid --cpu-list --help --version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _taskset_module taskset
|
||||
@@ -0,0 +1,39 @@
|
||||
_uclampset_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--all-tasks
|
||||
--help
|
||||
--pid
|
||||
--system
|
||||
--reset-on-fork
|
||||
--verbose
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local i
|
||||
for i in ${COMP_WORDS[*]}; do
|
||||
case $i in
|
||||
'-p'|'--pid')
|
||||
COMPREPLY=( $(compgen -W "$(cd /proc && echo [0-9]*)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _uclampset_module uclampset
|
||||
@@ -0,0 +1,89 @@
|
||||
_umount_points_list()
|
||||
{
|
||||
# List of characters to escape shamelessly stolen from "scp" completion
|
||||
local escape_chars='[][(){}<>\",:;^&!$=?`|\\'\'' \t\f\n\r\v]'
|
||||
|
||||
findmnt -lno TARGET | awk '
|
||||
|
||||
function literal_ere(s) {
|
||||
gsub(/[][^$.*?+{}\\()|]/, "\\\\&", s)
|
||||
return s
|
||||
}
|
||||
|
||||
{
|
||||
home_ere = literal_ere(ENVIRON["HOME"])
|
||||
print home_ere
|
||||
if ($0 ~ "^"home_ere) {
|
||||
homeless = $0
|
||||
sub("^"home_ere, "~", homeless)
|
||||
gsub("'"$escape_chars"'", "\\\\&", homeless)
|
||||
print homeless " "
|
||||
}
|
||||
pwd_ere = literal_ere(ENVIRON["PWD"])
|
||||
if ($0 ~ "^"pwd_ere) {
|
||||
reldir = $0
|
||||
sub("^"pwd_ere"/?", "", reldir)
|
||||
gsub("'"$escape_chars"'", "\\\\&", reldir)
|
||||
print "./" reldir " "
|
||||
print reldir " "
|
||||
}
|
||||
gsub("'"$escape_chars"'", "\\\\&")
|
||||
print $0 " "
|
||||
}'
|
||||
}
|
||||
|
||||
_umount_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-t'|'--types')
|
||||
local TYPES
|
||||
TYPES="
|
||||
$(\ls /lib/modules/$(uname -r)/kernel/fs | awk '{print $1, "no" $1}')
|
||||
$(awk '{print $NF, "no" $NF}' /proc/filesystems)
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
'-N'|'--namespace')
|
||||
local NAMESPACE
|
||||
NAMESPACE="$(lsns --type mnt --output PATH --noheadings)"
|
||||
COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS=" --all
|
||||
--all-targets
|
||||
--no-canonicalize
|
||||
--detach-loop
|
||||
--fake
|
||||
--force
|
||||
--internal-only
|
||||
--namespace
|
||||
--no-mtab
|
||||
--lazy
|
||||
--test-opts
|
||||
--recursive
|
||||
--read-only
|
||||
--types
|
||||
--quiet
|
||||
--verbose
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=( $( compgen -W '$( _umount_points_list )' -- "$cur" ) )
|
||||
}
|
||||
complete -F _umount_module -o nospace umount
|
||||
@@ -0,0 +1,54 @@
|
||||
_unshare_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'--propagation')
|
||||
COMPREPLY=( $(compgen -W "slave shared private unchanged" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--setgroups')
|
||||
COMPREPLY=( $(compgen -W "allow deny" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--mount
|
||||
--uts
|
||||
--ipc
|
||||
--net
|
||||
--pid
|
||||
--user
|
||||
--cgroup
|
||||
--time
|
||||
--fork
|
||||
--kill-child
|
||||
--keep-caps
|
||||
--mount-proc
|
||||
--map-current-user
|
||||
--map-root-user
|
||||
--propagation
|
||||
--setgroups
|
||||
--help
|
||||
--version
|
||||
--root
|
||||
--wd
|
||||
--monotonic
|
||||
--boottime
|
||||
--setuid
|
||||
--setgid"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _unshare_module unshare
|
||||
@@ -0,0 +1,32 @@
|
||||
_wall_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-t'|'--timeout')
|
||||
COMPREPLY=( $(compgen -W "seconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-g'|'--group')
|
||||
COMPREPLY=( $(compgen -A 'group' -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--group --nobanner --timeout --version --help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _wall_module wall
|
||||
@@ -0,0 +1,70 @@
|
||||
_wdctl_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-f'|'--flags')
|
||||
local FLAGS
|
||||
FLAGS="ALARMONLY
|
||||
CARDRESET
|
||||
EXTERN1
|
||||
EXTERN2
|
||||
FANFAULT
|
||||
KEEPALIVEPING
|
||||
MAGICCLOSE
|
||||
OVERHEAT
|
||||
POWEROVER
|
||||
POWERUNDER
|
||||
PRETIMEOUT
|
||||
SETTIMEOUT"
|
||||
COMPREPLY=( $(compgen -W "$FLAGS" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--settimeout')
|
||||
COMPREPLY=( $(compgen -W "seconds" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--flags
|
||||
--noflags
|
||||
--noident
|
||||
--noheadings
|
||||
--oneline
|
||||
--output
|
||||
--raw
|
||||
--notimeouts
|
||||
--settimeout
|
||||
--flags-only
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _wdctl_module wdctl
|
||||
@@ -0,0 +1,28 @@
|
||||
_whereis_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-B'|'-M'|'-S')
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'-V')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="-b -B -m -M -s -S -f -u -l -g"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -c -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _whereis_module whereis
|
||||
@@ -0,0 +1,66 @@
|
||||
_wipefs_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-b'|'--backup')
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
|
||||
return 0
|
||||
;;
|
||||
'-O'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="UUID LABEL LENGTH TYPE OFFSET USAGE DEVICE"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--offset')
|
||||
COMPREPLY=( $(compgen -W "offset" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--types')
|
||||
local TYPES
|
||||
TYPES="$(blkid -k)"
|
||||
COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="
|
||||
--all
|
||||
--backup
|
||||
--force
|
||||
--noheadings
|
||||
--json
|
||||
--lock
|
||||
--no-act
|
||||
--offset
|
||||
--output
|
||||
--parsable
|
||||
--quiet
|
||||
--types
|
||||
--help
|
||||
--version
|
||||
"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
compopt -o bashdefault -o default
|
||||
COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _wipefs_module wipefs
|
||||
@@ -0,0 +1,61 @@
|
||||
_zramctl_module()
|
||||
{
|
||||
local cur prev OPTS
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
case $prev in
|
||||
'-a'|'--algorithm')
|
||||
COMPREPLY=( $(compgen -W "lzo lz4 lz4hc deflate 842" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-o'|'--output')
|
||||
local prefix realcur OUTPUT_ALL OUTPUT
|
||||
realcur="${cur##*,}"
|
||||
prefix="${cur%$realcur}"
|
||||
OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM
|
||||
STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED
|
||||
MIGRATED MOUNTPOINT"
|
||||
for WORD in $OUTPUT_ALL; do
|
||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
||||
fi
|
||||
done
|
||||
compopt -o nospace
|
||||
COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--size')
|
||||
COMPREPLY=( $(compgen -W "size" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-t'|'--streams')
|
||||
COMPREPLY=( $(compgen -W "number" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS=" --algorithm
|
||||
--algorithm-params
|
||||
--bytes
|
||||
--find
|
||||
--noheadings
|
||||
--output
|
||||
--output-all
|
||||
--raw
|
||||
--reset
|
||||
--size
|
||||
--streams
|
||||
--help
|
||||
--version"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _zramctl_module zramctl
|
||||
Reference in New Issue
Block a user