芝麻web文件管理V1.00
编辑当前文件:/home/mybf1/public_html/class.bf1.my/wp-admin/js/bash-completion.tar
completions/resizepart 0000644 00000001263 15122360056 0011215 0 ustar 00 _resizepart_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1) local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) OPTS="--help --version $DEVICES" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) prev="${COMP_WORDS[COMP_CWORD-1]}" COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) ) ;; 3) COMPREPLY="length" ;; esac return 0 } complete -F _resizepart_module resizepart completions/gapplication 0000644 00000002555 15122360056 0011504 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __app() { case "${COMP_CWORD}" in 1) COMPREPLY=($(compgen -W "help version list-apps launch action list-actions" -- "${COMP_WORDS[1]}")) return 0 ;; 2) case "${COMP_WORDS[1]}" in launch|action|list-actions) COMPREPLY=($(compgen -W "`gapplication list-apps`" -- "${COMP_WORDS[2]}")) return 0 ;; *) COMPREPLY=() return 0 ;; esac ;; esac # Otherwise, what we will do is based on the command in ${COMP_WORDS[1]} case "${COMP_WORDS[1]}" in action) # Word 3 is the action name. This is the only one we can help with. if [ "${COMP_CWORD}" == 3 ]; then COMPREPLY=($(compgen -W "`gapplication list-actions "${COMP_WORDS[2]}"`" -- "${COMP_WORDS[3]}")) return 0 else COMPREPLY=() return 0 fi ;; launch) # Filenames... COMPREPLY=($(compgen -A file "${COMP_WORDS[COMP_CWORD]}")) return 0 ;; *) # Nothing else should be out this far... COMPREPLY=() return 0 esac } #################################################################################################### complete -F __app gapplication completions/su 0000644 00000001540 15122360056 0007452 0 ustar 00 _su_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-'|'-u'|'--user') COMPREPLY=( $(compgen -u -- $cur) ) return 0 ;; '-g'|'--group'|'-G'|'--supp-group') COMPREPLY=( $(compgen -g -- $cur) ) return 0 ;; '-s'|'--shell') COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --user --preserve-environment --group --supp-group --login --command --session-command --fast --shell --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _su_module su complete -F _su_module runuser completions/gdbus 0000644 00000001647 15122360056 0010137 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __gdbus() { local IFS=$'\n' local cur=`_get_cword :` local suggestions=$(gdbus complete "${COMP_LINE}" ${COMP_POINT}) COMPREPLY=($(compgen -W "$suggestions" -- "$cur")) # Remove colon-word prefix from COMPREPLY items case "$cur" in *:*) case "$COMP_WORDBREAKS" in *:*) local colon_word=${cur%${cur##*:}} local i=${#COMPREPLY[*]} while [ $((--i)) -ge 0 ]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} done ;; esac ;; esac } #################################################################################################### complete -o nospace -F __gdbus gdbus completions/rtcwake 0000644 00000001511 15122360056 0010461 0 ustar 00 _rtcwake_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--device') local RTC_DEVS RTC_DEVS=$(cd /sys/class/rtc/ && echo *) COMPREPLY=( $(compgen -W "$RTC_DEVS" -- $cur) ) return 0 ;; '-m'|'--mode') COMPREPLY=( $(compgen -W "standby mem disk off no on disable show" -- $cur) ) return 0 ;; '-s'|'--seconds') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-t'|'--time') COMPREPLY=( $(compgen -W "time_t" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--device --dry-run --local --mode --seconds --time --utc --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _rtcwake_module rtcwake completions/gsettings 0000644 00000005415 15122360056 0011037 0 ustar 00 # Check for bash [ -z "$BASH_VERSION" ] && return #################################################################################################### __gsettings() { local choices coffset schemadir if [ ${COMP_CWORD} -gt 2 ]; then if [ ${COMP_WORDS[1]} = --schemadir ]; then # this complexity is needed to perform correct tilde expansion schemadir=$(eval "echo --schemadir ${COMP_WORDS[2]}") coffset=2 else coffset=0 fi else coffset=0 fi case "$((${COMP_CWORD}-$coffset))" in 1) choices=$'--schemadir\n--version\nhelp \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nreset-recursively \nwritable \nmonitor \ndescribe ' ;; 2) case "${COMP_WORDS[$(($coffset+1))]}" in --schemadir) COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]})) return 0 ;; help) choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nreset-recursively\nwritable\nmonitor' ;; list-keys|list-children|list-recursively|reset-recursively) choices="$(gsettings $schemadir list-schemas 2> /dev/null)"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')" ;; list-schemas) COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]})) return 0 ;; get|range|set|reset|writable|monitor|describe) choices="$(gsettings $schemadir list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')" ;; esac ;; 3) case "${COMP_WORDS[$(($coffset+1))]}" in set) choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')" ;; get|range|reset|writable|monitor|describe) choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null)" ;; esac ;; 4) case "${COMP_WORDS[$(($coffset+2))]}" in set) range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null)) case "${range[0]}" in enum) unset range[0] ;; *) unset range ;; esac local IFS=$'\n' choices="${range[*]}" ;; esac ;; esac local IFS=$'\n' COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}")) } #################################################################################################### complete -o nospace -F __gsettings gsettings completions/tc 0000644 00000064637 15122360056 0007451 0 ustar 00 # tc(8) completion -*- shell-script -*- # Copyright 2016 6WIND S.A. # Copyright 2016 Quentin Monnet
QDISC_KIND=' choke codel bfifo pfifo pfifo_head_drop fq fq_codel gred hhf \ mqprio multiq netem pfifo_fast pie red rr sfb sfq tbf atm cbq drr \ dsmark hfsc htb prio qfq ' FILTER_KIND=' basic bpf cgroup flow flower fw route rsvp tcindex u32 matchall ' ACTION_KIND=' gact mirred bpf sample ' # Takes a list of words in argument; each one of them is added to COMPREPLY if # it is not already present on the command line. Returns no value. _tc_once_attr() { local w subcword found for w in $*; do found=0 for (( subcword=3; subcword < ${#words[@]}-1; subcword++ )); do if [[ $w == ${words[subcword]} ]]; then found=1 break fi done [[ $found -eq 0 ]] && \ COMPREPLY+=( $( compgen -W "$w" -- "$cur" ) ) done } # Takes a list of words in argument; each one of them is added to COMPREPLY if # it is not already present on the command line from the provided index. Returns # no value. _tc_once_attr_from() { local w subcword found from=$1 shift for w in $*; do found=0 for (( subcword=$from; subcword < ${#words[@]}-1; subcword++ )); do if [[ $w == ${words[subcword]} ]]; then found=1 break fi done [[ $found -eq 0 ]] && \ COMPREPLY+=( $( compgen -W "$w" -- "$cur" ) ) done } # Takes a list of words in argument; adds them all to COMPREPLY if none of them # is already present on the command line. Returns no value. _tc_one_of_list() { local w subcword for w in $*; do for (( subcword=3; subcword < ${#words[@]}-1; subcword++ )); do [[ $w == ${words[subcword]} ]] && return 1 done done COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) ) } # Takes a list of words in argument; adds them all to COMPREPLY if none of them # is already present on the command line from the provided index. Returns no # value. _tc_one_of_list_from() { local w subcword from=$1 shift for w in $*; do for (( subcword=$from; subcword < ${#words[@]}-1; subcword++ )); do [[ $w == ${words[subcword]} ]] && return 1 done done COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) ) } # Returns "$cur ${cur}arg1 ${cur}arg2 ..." _tc_expand_units() { [[ $cur =~ ^[0-9]+ ]] || return 1 local value=${cur%%[^0-9]*} [[ $cur == $value ]] && echo $cur echo ${@/#/$value} } # Complete based on given word, usually $prev (or possibly the word before), # for when an argument or an option name has but a few possible arguments (so # tc does not take particular commands into account here). # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_direct_complete() { case $1 in # Command options dev) _available_interfaces return 0 ;; classid) return 0 ;; estimator) local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) return 0 ;; handle) return 0 ;; parent|flowid) local i iface ids cmd for (( i=3; i < ${#words[@]}-2; i++ )); do [[ ${words[i]} == dev ]] && iface=${words[i+1]} break done for cmd in qdisc class; do if [[ -n $iface ]]; then ids+=$( tc $cmd show dev $iface 2>/dev/null | \ cut -d\ -f 3 )" " else ids+=$( tc $cmd show 2>/dev/null | cut -d\ -f 3 ) fi done [[ $ids != " " ]] && \ COMPREPLY+=( $( compgen -W "$ids" -- "$cur" ) ) return 0 ;; protocol) # list comes from lib/ll_proto.c COMPREPLY+=( $( compgen -W ' 802.1Q 802.1ad 802_2 802_3 LLDP aarp \ all aoe arp atalk atmfate atmmpoa ax25 bpq can control cust \ ddcmp dec diag dna_dl dna_rc dna_rt econet ieeepup ieeepupat \ ip ipv4 ipv6 ipx irda lat localtalk loop mobitex ppp_disc \ ppp_mp ppp_ses ppptalk pup pupat rarp sca snap tipc tr_802_2 \ wan_ppp x25' -- "$cur" ) ) return 0 ;; prio) return 0 ;; stab) COMPREPLY+=( $( compgen -W 'mtu tsize mpu overhead linklayer' -- "$cur" ) ) ;; # Qdiscs and classes options alpha|bands|beta|buckets|corrupt|debug|decrement|default|\ default_index|depth|direct_qlen|divisor|duplicate|ewma|flow_limit|\ flows|hh_limit|increment|indices|linklayer|non_hh_weight|num_tc|\ penalty_burst|penalty_rate|prio|priomap|probability|queues|r2q|\ reorder|vq|vqs) return 0 ;; setup) COMPREPLY+=( $( compgen -W 'vqs' -- "$cur" ) ) return 0 ;; hw) COMPREPLY+=( $( compgen -W '1 0' -- "$cur" ) ) return 0 ;; distribution) COMPREPLY+=( $( compgen -W 'uniform normal pareto paretonormal' -- "$cur" ) ) return 0 ;; loss) COMPREPLY+=( $( compgen -W 'random state gmodel' -- "$cur" ) ) return 0 ;; # Qdiscs and classes options options gap|gmodel|state) return 0 ;; # Filters options map) COMPREPLY+=( $( compgen -W 'key' -- "$cur" ) ) return 0 ;; hash) COMPREPLY+=( $( compgen -W 'keys' -- "$cur" ) ) return 0 ;; indev) _available_interfaces return 0 ;; eth_type) COMPREPLY+=( $( compgen -W 'ipv4 ipv6' -- "$cur" ) ) return 0 ;; ip_proto) COMPREPLY+=( $( compgen -W 'tcp udp' -- "$cur" ) ) return 0 ;; # Filters options options key|keys) [[ ${words[@]} =~ graft ]] && return 1 COMPREPLY+=( $( compgen -W 'src dst proto proto-src proto-dst iif \ priority mark nfct nfct-src nfct-dst nfct-proto-src \ nfct-proto-dst rt-classid sk-uid sk-gid vlan-tag rxhash' -- \ "$cur" ) ) return 0 ;; # BPF options - used for filters, actions, and exec export|bytecode|bytecode-file|object-file) _filedir return 0 ;; object-pinned|graft) # Pinned object is probably under /sys/fs/bpf/ [[ -n "$cur" ]] && _filedir && return 0 COMPREPLY=( $( compgen -G "/sys/fs/bpf/*" -- "$cur" ) ) || _filedir compopt -o nospace return 0 ;; section) if (type objdump > /dev/null 2>&1) ; then local fword objfile section_list for (( fword=3; fword < ${#words[@]}-3; fword++ )); do if [[ ${words[fword]} == object-file ]]; then objfile=${words[fword+1]} break fi done section_list=$( objdump -h $objfile 2>/dev/null | \ sed -n 's/^ *[0-9]\+ \([^ ]*\) *.*/\1/p' ) COMPREPLY+=( $( compgen -W "$section_list" -- "$cur" ) ) fi return 0 ;; import|run) _filedir return 0 ;; type) COMPREPLY+=( $( compgen -W 'cls act' -- "$cur" ) ) return 0 ;; # Actions options random) _tc_one_of_list 'netrand determ' return 0 ;; # Units for option arguments bandwidth|maxrate|peakrate|rate) local list=$( _tc_expand_units 'bit' \ 'kbit' 'kibit' 'kbps' 'kibps' \ 'mbit' 'mibit' 'mbps' 'mibps' \ 'gbit' 'gibit' 'gbps' 'gibps' \ 'tbit' 'tibit' 'tbps' 'tibps' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; admit_bytes|avpkt|burst|cell|initial_quantum|limit|max|min|mtu|mpu|\ overhead|quantum|redflowlist) local list=$( _tc_expand_units \ 'b' 'kbit' 'k' 'mbit' 'm' 'gbit' 'g' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; db|delay|evict_timeout|interval|latency|perturb|rehash|reset_timeout|\ target|tupdate) local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) ;; esac return 1 } # Complete with options names for qdiscs. Each qdisc has its own set of options # and it seems we cannot really parse it from anywhere, so we add it manually # in this function. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_qdisc_options() { case $1 in choke) _tc_once_attr 'limit bandwidth ecn min max burst' return 0 ;; codel) _tc_once_attr 'limit target interval' _tc_one_of_list 'ecn noecn' return 0 ;; bfifo|pfifo|pfifo_head_drop) _tc_once_attr 'limit' return 0 ;; fq) _tc_once_attr 'limit flow_limit quantum initial_quantum maxrate \ buckets' _tc_one_of_list 'pacing nopacing' return 0 ;; fq_codel) _tc_once_attr 'limit flows target interval quantum' _tc_one_of_list 'ecn noecn' return 0 ;; gred) _tc_once_attr 'setup vqs default grio vq prio limit min max avpkt \ burst probability bandwidth' return 0 ;; hhf) _tc_once_attr 'limit quantum hh_limit reset_timeout admit_bytes \ evict_timeout non_hh_weight' return 0 ;; mqprio) _tc_once_attr 'num_tc map queues hw' return 0 ;; netem) _tc_once_attr 'delay distribution corrupt duplicate loss ecn \ reorder rate' return 0 ;; pie) _tc_once_attr 'limit target tupdate alpha beta' _tc_one_of_list 'bytemode nobytemode' _tc_one_of_list 'ecn noecn' return 0 ;; red) _tc_once_attr 'limit min max avpkt burst adaptive probability \ bandwidth ecn harddrop' return 0 ;; rr|prio) _tc_once_attr 'bands priomap multiqueue' return 0 ;; sfb) _tc_once_attr 'rehash db limit max target increment decrement \ penalty_rate penalty_burst' return 0 ;; sfq) _tc_once_attr 'limit perturb quantum divisor flows depth headdrop \ redflowlimit min max avpkt burst probability ecn harddrop' return 0 ;; tbf) _tc_once_attr 'limit burst rate mtu peakrate latency overhead \ linklayer' return 0 ;; cbq) _tc_once_attr 'bandwidth avpkt mpu cell ewma' return 0 ;; dsmark) _tc_once_attr 'indices default_index set_tc_index' return 0 ;; hfsc) _tc_once_attr 'default' return 0 ;; htb) _tc_once_attr 'default r2q direct_qlen debug' return 0 ;; multiq|pfifo_fast|atm|drr|qfq) return 0 ;; esac return 1 } # Complete with options names for BPF filters or actions. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_bpf_options() { [[ ${words[${#words[@]}-3]} == object-file ]] && \ _tc_once_attr 'section export' [[ ${words[${#words[@]}-5]} == object-file ]] && \ [[ ${words[${#words[@]}-3]} =~ (section|export) ]] && \ _tc_once_attr 'section export' _tc_one_of_list 'bytecode bytecode-file object-file object-pinned' _tc_once_attr 'verbose index direct-action action classid' return 0 } # Complete with options names for filter actions. # This function is recursive, thus allowing multiple actions statement to be # parsed. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_filter_action_options() { for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ action == ${words[acwd]} ]]; then _tc_filter_action_options $((acwd+1)) && return 0 fi done local action acwd for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ $ACTION_KIND =~ ' '${words[acwd]}' ' ]]; then _tc_one_of_list_from $acwd action _tc_action_options $acwd && return 0 fi done _tc_one_of_list_from $acwd $ACTION_KIND return 0 } # Complete with options names for filters. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_filter_options() { for ((acwd=$1; acwd < ${#words[@]}-1; acwd++)); do if [[ action == ${words[acwd]} ]]; then _tc_filter_action_options $((acwd+1)) && return 0 fi done filter=${words[$1]} case $filter in basic) _tc_once_attr 'match action classid' return 0 ;; bpf) _tc_bpf_options return 0 ;; cgroup) _tc_once_attr 'match action' return 0 ;; flow) local i for (( i=5; i < ${#words[@]}-1; i++ )); do if [[ ${words[i]} =~ ^keys?$ ]]; then _tc_direct_complete 'key' COMPREPLY+=( $( compgen -W 'or and xor rshift addend' -- \ "$cur" ) ) break fi done _tc_once_attr 'map hash divisor baseclass match action' return 0 ;; matchall) _tc_once_attr 'action skip_sw skip_hw' return 0 ;; flower) _tc_once_attr 'action classid indev dst_mac src_mac eth_type \ ip_proto dst_ip src_ip dst_port src_port' return 0 ;; fw) _tc_once_attr 'action classid' return 0 ;; route) _tc_one_of_list 'from fromif' _tc_once_attr 'to classid action' return 0 ;; rsvp) _tc_once_attr 'ipproto session sender classid action tunnelid \ tunnel flowlabel spi/ah spi/esp u8 u16 u32' [[ ${words[${#words[@]}-3]} == tunnel ]] && \ COMPREPLY+=( $( compgen -W 'skip' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} =~ u(8|16|32) ]] && \ COMPREPLY+=( $( compgen -W 'mask' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} == mask ]] && \ COMPREPLY+=( $( compgen -W 'at' -- "$cur" ) ) return 0 ;; tcindex) _tc_once_attr 'hash mask shift classid action' _tc_one_of_list 'pass_on fall_through' return 0 ;; u32) _tc_once_attr 'match link classid action offset ht hashkey sample' COMPREPLY+=( $( compgen -W 'ip ip6 udp tcp icmp u8 u16 u32 mark \ divisor' -- "$cur" ) ) return 0 ;; esac return 1 } # Complete with options names for actions. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_action_options() { local from=$1 local action=${words[from]} case $action in bpf) _tc_bpf_options return 0 ;; mirred) _tc_one_of_list_from $from 'ingress egress' _tc_one_of_list_from $from 'mirror redirect' _tc_once_attr_from $from 'index dev' return 0 ;; sample) _tc_once_attr_from $from 'rate' _tc_once_attr_from $from 'trunc' _tc_once_attr_from $from 'group' return 0 ;; gact) _tc_one_of_list_from $from 'reclassify drop continue pass' _tc_once_attr_from $from 'random' return 0 ;; esac return 1 } # Complete with options names for exec. # Returns 0 is completion should stop after running this function, 1 otherwise. _tc_exec_options() { case $1 in import) [[ ${words[${#words[@]}-3]} == import ]] && \ _tc_once_attr 'run' return 0 ;; graft) COMPREPLY+=( $( compgen -W 'key type' -- "$cur" ) ) [[ ${words[${#words[@]}-3]} == object-file ]] && \ _tc_once_attr 'type' _tc_bpf_options return 0 ;; esac return 1 } # Main completion function # Logic is as follows: # 1. Check if previous word is a global option; if so, propose arguments. # 2. Check if current word is a global option; if so, propose completion. # 3. Check for the presence of a main command (qdisc|class|filter|...). If # there is one, first call _tc_direct_complete to see if previous word is # waiting for a particular completion. If so, propose completion and exit. # 4. Extract main command and -- if available -- its subcommand # (add|delete|show|...). # 5. Propose completion based on main and sub- command in use. Additional # functions may be called for qdiscs, classes or filter options. _tc() { local cur prev words cword _init_completion || return case $prev in -V|-Version) return 0 ;; -b|-batch|-cf|-conf) _filedir return 0 ;; -force) COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) ) return 0 ;; -nm|name) [[ -r /etc/iproute2/tc_cls ]] || \ COMPREPLY=( $( compgen -W '-conf' -- "$cur" ) ) return 0 ;; -n|-net|-netns) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY+=( $( compgen -W "$nslist" -- "$cur" ) ) return 0 ;; -tshort) _tc_once_attr '-statistics' COMPREPLY+=( $( compgen -W 'monitor' -- "$cur" ) ) return 0 ;; -timestamp) _tc_once_attr '-statistics -tshort' COMPREPLY+=( $( compgen -W 'monitor' -- "$cur" ) ) return 0 ;; esac # Search for main commands local subcword cmd subcmd for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do [[ ${words[subcword]} == -b?(atch) ]] && return 0 [[ -n $cmd ]] && subcmd=${words[subcword]} && break [[ ${words[subcword]} != -* && \ ${words[subcword-1]} != -@(n?(et?(ns))|c?(on)f) ]] && \ cmd=${words[subcword]} done if [[ -z $cmd ]]; then case $cur in -*) local c='-Version -statistics -details -raw -pretty \ -iec -graphe -batch -name -netns -timestamp' [[ $cword -eq 1 ]] && c+=' -force' COMPREPLY=( $( compgen -W "$c" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "help $( tc help 2>&1 | \ command sed \ -e '/OBJECT := /!d' \ -e 's/.*{//' \ -e 's/}.*//' \ -e \ 's/|//g' )" -- "$cur" ) ) return 0 ;; esac fi [[ $subcmd == help ]] && return 0 # For this set of commands we may create COMPREPLY just by analysing the # previous word, if it expects for a specific list of options or values. if [[ $cmd =~ (qdisc|class|filter|action|exec) ]]; then _tc_direct_complete $prev && return 0 if [[ ${words[${#words[@]}-3]} == estimator ]]; then local list=$( _tc_expand_units 'secs' 'msecs' 'usecs' ) COMPREPLY+=( $( compgen -W "$list" -- "$cur" ) ) && return 0 fi fi # Completion depends on main command and subcommand in use. case $cmd in qdisc) case $subcmd in add|change|replace|link|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local qdisc qdwd for ((qdwd=$subcword; qdwd < ${#words[@]}-1; qdwd++)); do if [[ $QDISC_KIND =~ ' '${words[qdwd]}' ' ]]; then qdisc=${words[qdwd]} _tc_qdisc_options $qdisc && return 0 fi done _tc_one_of_list $QDISC_KIND _tc_one_of_list 'root ingress parent clsact' _tc_once_attr 'handle estimator stab' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'ingress clsact' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace link show' -- "$cur" ) ) ;; esac ;; class) case $subcmd in add|change|replace|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local qdisc qdwd for ((qdwd=$subcword; qdwd < ${#words[@]}-1; qdwd++)); do if [[ $QDISC_KIND =~ ' '${words[qdwd]}' ' ]]; then qdisc=${words[qdwd]} _tc_qdisc_options $qdisc && return 0 fi done _tc_one_of_list $QDISC_KIND _tc_one_of_list 'root parent' _tc_once_attr 'classid' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'root parent' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show' -- "$cur" ) ) ;; esac ;; filter) case $subcmd in add|change|replace|del|delete) if [[ $(($cword-$subcword)) -eq 1 ]]; then COMPREPLY=( $( compgen -W 'dev' -- "$cur" ) ) return 0 fi local filter fltwd for ((fltwd=$subcword; fltwd < ${#words[@]}-1; fltwd++)); do if [[ $FILTER_KIND =~ ' '${words[fltwd]}' ' ]]; then _tc_filter_options $fltwd && return 0 fi done _tc_one_of_list $FILTER_KIND _tc_one_of_list 'root ingress egress parent' _tc_once_attr 'handle estimator pref protocol' ;; show) _tc_once_attr 'dev' _tc_one_of_list 'root ingress egress parent' _tc_once_attr '-statistics -details -raw -pretty -iec \ -graph -name' ;; help) return 0 ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show' -- "$cur" ) ) ;; esac ;; action) case $subcmd in add|change|replace) local action acwd for ((acwd=$subcword; acwd < ${#words[@]}-1; acwd++)); do if [[ $ACTION_KIND =~ ' '${words[acwd]}' ' ]]; then _tc_action_options $acwd && return 0 fi done _tc_one_of_list $ACTION_KIND ;; get|del|delete) _tc_once_attr 'index' ;; lst|list|flush|show) _tc_one_of_list $ACTION_KIND ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'help add delete change \ replace show list flush action' -- "$cur" ) ) ;; esac ;; monitor) COMPREPLY=( $( compgen -W 'help' -- "$cur" ) ) ;; exec) case $subcmd in bpf) local excmd exwd EXEC_KIND=' import debug graft ' for ((exwd=$subcword; exwd < ${#words[@]}-1; exwd++)); do if [[ $EXEC_KIND =~ ' '${words[exwd]}' ' ]]; then excmd=${words[exwd]} _tc_exec_options $excmd && return 0 fi done _tc_one_of_list $EXEC_KIND ;; *) [[ $cword -eq $subcword ]] && \ COMPREPLY=( $( compgen -W 'bpf' -- "$cur" ) ) ;; esac ;; esac } && complete -F _tc tc # ex: ts=4 sw=4 et filetype=sh completions/rpm 0000644 00000023426 15122360056 0007630 0 ustar 00 # bash completion for rpm -*- shell-script -*- # helper functions _rpm_installed_packages() { if [[ -r /var/log/rpmpkgs && \ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then # using RHL 7.2 or later - this is quicker than querying the DB COMPREPLY=( $( compgen -W "$( sed -ne \ 's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \ /var/log/rpmpkgs )" -- "$cur" ) ) elif type rpmqpack &>/dev/null ; then # SUSE's rpmqpack is faster than rpm -qa COMPREPLY=( $( compgen -W '$( rpmqpack )' -- "$cur" ) ) else COMPREPLY=( $( ${1:-rpm} -qa --nodigest --nosignature \ --queryformat='%{NAME} ' "$cur*" 2>/dev/null ) ) fi } _rpm_groups() { local IFS=$'\n' COMPREPLY=( $( compgen -W "$( ${1:-rpm} -qa --nodigest --nosignature \ --queryformat='%{GROUP}\n' 2>/dev/null )" -- "$cur" ) ) } _rpm_macros() { # get a list of macros COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \ 's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \ -- "$cur" ) ) } _rpm_buildarchs() { COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \ 's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \ -- "$cur" ) ) } # rpm(8) completion # _rpm() { local cur prev words cword split _init_completion -s || return if [[ $cword -eq 1 ]]; then # first parameter on line case $cur in --*) COMPREPLY=( $( compgen -W '--help --version --initdb --checksig --addsign --delsign --rebuilddb --showrc --setperms --setugids --eval --install --upgrade --query --freshen --erase --verify --querytags --import' \ -- "$cur" ) ) ;; *) COMPREPLY=( $( compgen -W '-e -E -F -i -q -t -U -V' \ -- "$cur" ) ) ;; esac return 0 fi case $prev in --dbpath|--excludepath|--prefix|--relocate|--root|-r) _filedir -d return 0 ;; --eval|-E) _rpm_macros $1 return 0 ;; --pipe) compopt -o filenames COMPREPLY=( $( compgen -c -- "$cur" ) ) return 0 ;; --rcfile) _filedir return 0 ;; --specfile) # complete on .spec files _filedir spec return 0 ;; --whatprovides) if [[ "$cur" == */* ]]; then _filedir else # complete on capabilities local IFS=$'\n' COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \ --queryformat='%{PROVIDENAME}\n' 2>/dev/null )" \ -- "$cur" ) ) fi return 0 ;; --whatrequires) if [[ "$cur" == */* ]]; then _filedir else # complete on capabilities local IFS=$'\n' COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \ --queryformat='%{REQUIRENAME}\n' 2>/dev/null )" \ -- "$cur" ) ) fi return 0 ;; --define|-D|--fileid|--hdrid|--pkgid) # argument required but no completions available return 0 ;; esac $split && return 0 # options common to all modes local opts="--define= --eval= --macros= --nodigest --nosignature --rcfile= --quiet --pipe --verbose" case ${words[1]} in -[iFU]*|--install|--freshen|--upgrade) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --percent --force --test --replacepkgs --replacefiles --root --excludedocs --includedocs --noscripts --ignorearch --dbpath --prefix= --ignoreos --nodeps --allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport --noorder --relocate= --badreloc --notriggers --excludepath= --ignoresize --oldpackage --queryformat --repackage --nosuggests" -- "$cur" ) ) else _filedir '[rs]pm' fi ;; -e|--erase) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --allmatches --noscripts --notriggers --nodeps --test --repackage" -- "$cur" ) ) else _rpm_installed_packages $1 fi ;; -q*|--query) # options common to all query types opts+=" --changelog --configfiles --conflicts --docfiles --dump --enhances --filesbypkg --filecaps --fileclass --filecolor --fileprovide --filerequire --filesbypkg --info --list --obsoletes --pipe --provides --queryformat= --requires --scripts --suggests --triggers --xml" if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext --last --root --state" -- "$cur" ) ) else _filedir fi elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then # -qg completion _rpm_groups $1 elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy --httpport --httpproxy --nomanifest" -- "$cur" ) ) else _filedir '[rs]pm' fi else # -q; installed package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last --package --pkgid --root= --specfile --state --triggeredby --whatprovides --whatrequires" \ -- "$cur" ) ) elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages $1 fi fi ;; -K*|--checksig) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \ -- "$cur" ) ) else _filedir '[rs]pm' fi ;; -[Vy]*|--verify) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps --nogroup --nolinkto --nomode --nomtime --nordev --nouser --nofiles --noscripts --nomd5 --querytags --specfile --whatrequires --whatprovides" -- "$cur" ) ) # check whether we're doing file completion elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then _filedir elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups $1 elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then _filedir '[rs]pm' else _rpm_installed_packages $1 fi ;; --resign|--addsign|--delsign) _filedir '[rs]pm' ;; --setperms|--setgids) _rpm_installed_packages $1 ;; --import|--dbpath|--root) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--import --dbpath --root=' \ -- "$cur" ) ) else _filedir fi ;; esac [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 } && complete -F _rpm rpm _rpmbuild() { local cur prev words cword split _init_completion -s || return local rpm="${1%build*}" [[ $rpm == $1 ]] || ! type $rpm &>/dev/null && rpm= case $prev in --buildroot|--root|-r|--dbpath) _filedir -d return 0 ;; --target) _rpm_buildarchs return 0 ;; --eval|-E) _rpm_macros $rpm return 0 ;; --macros|--rcfile) _filedir return 0 ;; --buildpolicy) local cfgdir=$( $rpm --eval '%{_rpmconfigdir}' 2>/dev/null ) if [[ $cfgdir ]]; then COMPREPLY=( $( compgen -W "$( command ls $cfgdir 2>/dev/null \ | sed -ne 's/^brp-//p' )" -- "$cur" ) ) fi ;; --define|-D|--with|--without) return 0 ;; esac $split && return 0 if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi # Figure out file extensions to complete local word ext for word in ${words[@]}; do case $word in -b?) ext=spec break ;; -t?|--tarbuild) ext='@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))' break ;; --rebuild|--recompile) ext='@(?(no)src.r|s)pm' break ;; esac done [[ -n $ext ]] && _filedir $ext } && complete -F _rpmbuild rpmbuild rpmbuild-md5 # ex: ts=4 sw=4 et filetype=sh completions/taskset 0000644 00000002073 15122360056 0010503 0 ustar 00 _taskset_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--cpu-list') local CPULIST # FIXME: will propose only binding to a cpu. # Maybe this should add comma, and continue? CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) ) return 0 ;; '-p'|'--pid') local PIDS # FIXME: the pid argument is ambiguous. When # setting an affinity the optarg has to be cpu # mask. The following is good only for getting # affinity. PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-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 completions/addpart 0000644 00000001010 15122360056 0010432 0 ustar 00 _addpart_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" case $COMP_CWORD in 1) local DEVS='' while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) OPTS="--help --version $DEVS" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) # FIXME: how to determine next free partition number ;; 3) COMPREPLY=( $(compgen -W "start" -- $cur) ) ;; 4) COMPREPLY=( $(compgen -W "length" -- $cur) ) ;; esac return 0 } complete -F _addpart_module addpart completions/ul 0000644 00000001217 15122360056 0007444 0 ustar 00 _ul_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--terminal') local TERM_LIST I TERM_LIST='' for I in /usr/share/terminfo/?/*; do TERM_LIST+="${I##*/} " done COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--terminal --indicated --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _ul_module ul completions/blkdiscard 0000644 00000001213 15122360056 0011122 0 ustar 00 _blkdiscard_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset'|'-l'|'--length') COMPREPLY=( $(compgen -W "num" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--offset --length --secure --zeroout --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _blkdiscard_module blkdiscard completions/unshare 0000644 00000000760 15122360056 0010473 0 ustar 00 _unshare_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="--mount --uts --ipc --net --pid --user --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _unshare_module unshare completions/blkid 0000644 00000002746 15122360056 0010121 0 ustar 00 _blkid_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-o') COMPREPLY=( $(compgen -W "value device export full" -- $cur) ) return 0 ;; '-s') COMPREPLY=( $(compgen -W "tag" -- $cur) ) return 0 ;; '-t') COMPREPLY=( $(compgen -W "token" -- $cur) ) return 0 ;; '-L') COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) ) return 0 ;; '-U') COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) ) return 0 ;; '-s') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-O') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-u') COMPREPLY=( $(compgen -W "filesystem raid crypto other nofilesystem noraid nocrypto noother" -- $cur) ) return 0 ;; '-n') COMPREPLY=( $(compgen -W "$(awk '{print $NF}' /proc/filesystems)" -- $cur) ) return 0 ;; '-h'|'-V') return 0 ;; esac case $cur in -*) OPTS="-c -d -h -g -o -k -s -t -l -L -U -V -p -i -S -O -u -n" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'part' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 } complete -F _blkid_module blkid completions/utmpdump 0000644 00000000722 15122360056 0010677 0 ustar 00 _utmpdump_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--follow --reverse --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _utmpdump_module utmpdump completions/blockdev 0000644 00000001371 15122360056 0010616 0 ustar 00 _blockdev_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) OPTS="-h -V -q --report --getsz --setro --setrw --getro --getdiscardzeroes --getss --getpbsz --getiomin --getioopt --getalignoff --getmaxsect --getbsz --setbsz --getsize64 --setra --getra --setfra --getfra --flushbufs --rereadpt $DEVS" case $prev in '--setbsz') COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; '--setbsz'|'--setfra') COMPREPLY=( $(compgen -W "sectors" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _blockdev_module blockdev completions/cal 0000644 00000000624 15122360056 0007564 0 ustar 00 _cal_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="--one --three --sunday --monday --julian --year --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _cal_module cal completions/uuidgen 0000644 00000000600 15122360056 0010457 0 ustar 00 _uuidgen_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="--random --time --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _uuidgen_module uuidgen completions/cfdisk 0000644 00000001340 15122360056 0010264 0 ustar 00 _cfdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c') COMPREPLY=( $(compgen -W "cylinders" -- $cur) ) return 0 ;; '-h') COMPREPLY=( $(compgen -W "heads" -- $cur) ) return 0 ;; '-s') COMPREPLY=( $(compgen -W "sectors" -- $cur) ) return 0 ;; '-v') return 0 ;; esac case $cur in -*) OPTS="-a -z -c -h -s" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 } complete -F _cfdisk_module cfdisk completions/wdctl 0000644 00000002262 15122360056 0010142 0 ustar 00 _wdctl_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--flags') local FLAGS FLAGS="ALARMONLY CARDRESET EXTERN1 EXTERN2 FANFAULT KEEPALIVEPING MAGICCLOSE OVERHEAT POWEROVER POWERUNDER PRETIMEOUT SETTIMEOUT" COMPREPLY=( $(compgen -W "$FLAGS" -- $cur) ) return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-s'|'--settimeout') COMPREPLY=( $(compgen -W "seconds" -- $cur) ) return 0 ;; '-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 completions/chcpu 0000644 00000002266 15122360056 0010133 0 ustar 00 _chcpu_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-e'|'--enable') local CPULIST # FIXME: will propose only binding to a cpu. # Maybe this should add comma, and continue? CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) ) return 0 ;; '-d'|'--disable') local CPULIST # FIXME: will propose only binding to a cpu. # Maybe this should add comma, and continue? CPULIST=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) COMPREPLY=( $(compgen -W "$(eval echo $CPULIST)" -- $cur) ) return 0 ;; '-c'|'--configure'|'-g'|'--deconfigure') COMPREPLY=( $(compgen -W "cpu-list" -- $cur) ) return 0 ;; '-p'|'--dispatch') COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) ) return 0 ;; '-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 completions/whereis 0000644 00000001027 15122360056 0010471 0 ustar 00 _whereis_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-B'|'-M'|'-S') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '-h'|'-V') return 0 ;; esac case $cur in -*) OPTS="-b -B -m -M -s -S -f -u -l" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "file" -- $cur) ) return 0 } complete -F _whereis_module whereis completions/chfn 0000644 00000000675 15122360056 0007751 0 ustar 00 _chfn_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-u'|'--help'|'-v'|'--version') return 0 ;; esac case $cur in -*) OPTS="--full-name --office --office-phone --home-phone --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -u -- $cur) ) return 0 } complete -F _chfn_module chfn completions/wipefs 0000644 00000001370 15122360056 0010321 0 ustar 00 _wipefs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-o'|'--offset') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-t'|'--types') local TYPES TYPES="$(blkid -k)" COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --force --help --no-act --offset --parsable --quiet --types --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _wipefs_module wipefs completions/chrt 0000644 00000001440 15122360056 0007762 0 ustar 00 _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 ;; esac # FIXME: -p is ambiguous, it takes either pid or priority as an # argument depending on whether user wanted to get or set the # values. Perhaps the command interface should be reconsidered. case $cur in -*) OPTS="--batch --fifo --idle --other --rr --reset-on-fork --all-tasks --help --max --pid --verbose --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local PIDS PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 } complete -F _chrt_module chrt completions/write 0000644 00000000756 15122360056 0010165 0 ustar 00 _write_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1) COMPREPLY=( $(compgen -u -- $cur) ) return 0 ;; 2) local I TERMS='' for I in /sys/class/tty/*; do TERMS+="/dev${I##/sys/class/tty} " done COMPREPLY=( $(compgen -W "$TERMS" -- $cur) ) return 0 ;; esac return 0 } complete -F _write_module write completions/chsh 0000644 00000000772 15122360056 0007756 0 ustar 00 _chsh_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s'|'--shell') COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) ) return 0 ;; '-u'|'--help'|'-v'|'--version') return 0 ;; esac case $cur in -*) OPTS="--shell --list-shells --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -u -- $cur) ) return 0 } complete -F _chsh_module chsh completions/col 0000644 00000000714 15122360056 0007602 0 ustar 00 _col_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-l'|'--lines') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-H'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--no-backspaces --fine --pass --tabs --spaces --lines --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _col_module col completions/zramctl 0000644 00000002275 15122360056 0010505 0 ustar 00 _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" -- $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 MOUNTPOINT" for WORD in $OUTPUT_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then OUTPUT="$WORD $OUTPUT" fi done compopt -o nospace COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) return 0 ;; '-s'|'--size') COMPREPLY=( $(compgen -W "size" -- $cur) ) return 0 ;; '-t'|'--streams') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=" --algorithm --bytes --find --noheadings --output --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 completions/colcrt 0000644 00000000744 15122360056 0010316 0 ustar 00 _colcrt_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS=" --no-underlining --half-lines --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _colcrt_module colcrt completions/dracut 0000644 00000007000 15122360056 0010302 0 ustar 00 # # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh # # Copyright 2013 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see
. # __contains_word () { local word=$1; shift for w in $*; do [[ $w = $word ]] && return 0; done return 1 } _dracut() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-f -v -q -l -H -h -M -N --ro-mnt --force --kernel-only --no-kernel --strip --nostrip --hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf --lvmconf --nolvmconf --debug --profile --verbose --quiet --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma --xz --no-compress --gzip --list-modules --show-modules --keep --printsize --regenerate-all --noimageifnotneeded --early-microcode --no-early-microcode --print-cmdline --prelink --noprelink' [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers --omit-drivers --modules --omit --drivers --filesystems --install --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix --kernel-cmdline --sshkey --persistent-policy --install-optional' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --kmoddir|-k|--fwdir|--confdir|--tmpdir) comps=$(compgen -d -- "$cur") compopt -o filenames ;; -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional) comps=$(compgen -f -- "$cur") compopt -o filenames ;; -a|-m|-o|--add|--modules|--omit) comps=$(dracut --list-modules 2>/dev/null) ;; --persistent-policy) comps=$(cd /dev/disk/; echo *) ;; --kver) comps=$(cd /lib/modules; echo [0-9]*) ;; *) return 0 ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi } complete -F _dracut dracut completions/colrm 0000644 00000000775 15122360056 0010150 0 ustar 00 _colrm_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac case $COMP_CWORD in 1) COMPREPLY=( $(compgen -W "startcol" -- $cur) ) ;; 2) COMPREPLY=( $(compgen -W "endcol" -- $cur) ) ;; esac return 0 } complete -F _colrm_module colrm completions/lsinitrd 0000644 00000004057 15122360056 0010661 0 ustar 00 # # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh # # Copyright 2013 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see
. # __contains_word () { local word=$1; shift for w in $*; do [[ $w = $word ]] && return 0; done return 1 } _lsinitrd() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-s --size -h --help' [ARG]='-f --file -k --kver' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --file|-f) comps=$(compgen -f -- "$cur") compopt -o filenames ;; --kver|-k) comps=$(cd /lib/modules; echo [0-9]*) ;; *) return 0 ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi comps=$(compgen -f -- "$cur") compopt -o filenames COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _lsinitrd lsinitrd completions/column 0000644 00000001325 15122360056 0010321 0 ustar 00 _column_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c'|'--columns') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-s'|'--separator'|'-o'|'--output-separator') COMPREPLY=( $(compgen -W "string" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--columns --table --separator --output-separator --fillrows --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _column_module column completions/kmod 0000644 00000006243 15122360056 0007762 0 ustar 00 # kmod completion -*- shell-script -*- # # This file is part of kmod. # # Copyright 2010 Ran Benita # Copyright (C) 2013 Intel Corporation. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, see
. __contains_word () { local word=$1; shift for w in "$@"; do [[ "$w" = "$word" ]] && return 0; done return 1 } __is_opt () { local prevprev=${COMP_WORDS[COMP_CWORD-2]} local short="$1" long="$2" if [[ "$prev" = "$short" || "$prev" = "$long" ]]; then declare -g cur=${cur#=} return 0 elif [[ "$prev" = "=" && "$prevprev" = "$long" ]]; then return 0 fi return 1 } _kmod_static_nodes () { local OPTS='-o -f -h --help' local OPTS_EQUAL='--output --format' local GROUP_FORMAT='human tmpfiles devname' if __is_opt '-o' '--output'; then compopt -o filenames COMPREPLY=( $(compgen -f -- "$cur") ) return 0 elif __is_opt '-f' '--format'; then COMPREPLY=( $(compgen -W "$GROUP_FORMAT" -- "$cur" ) ) return 0 fi local cur=${COMP_WORDS[COMP_CWORD]} compopt -o nospace COMPREPLY=( $(compgen -W "$OPTS" -- "$cur") ) COMPREPLY+=( $(compgen -W "$OPTS_EQUAL" -S= -- "$cur") ) } _kmod() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local VERBS=(help list static-nodes) local OPTS='-h --help -V --version' local verb # standalone options, no other option or action allowed for ((i=0; $i < $COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${OPTS}; then return 0 fi done # find the action for ((i=0; $i <= $COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${VERBS[@]}"; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]} ${VERBS[*]}' -- "$cur") ) return 0 fi local func=${verb//-/_} if declare -F _kmod_${func} > /dev/null; then _kmod_${func} fi # allow the space if there's only one completion and it doesn't end with # '=' if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *"=" ]] ; then compopt +o nospace fi return 0 } complete -F _kmod kmod completions/ctrlaltdel 0000644 00000000517 15122360056 0011160 0 ustar 00 _ctrlaltdel_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $(compgen -W "hard soft" -- $cur) ) fi return 0 } complete -F _ctrlaltdel_module ctrlaltdel completions/bootctl 0000644 00000003454 15122360056 0010477 0 ustar 00 # bootctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _bootctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version' ) if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='status' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _bootctl bootctl completions/delpart 0000644 00000001211 15122360056 0010451 0 ustar 00 _delpart_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $COMP_CWORD in 1) local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) OPTS="--help --version $DEVICES" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) ;; 2) prev="${COMP_WORDS[COMP_CWORD-1]}" COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) ) ;; esac return 0 } complete -F _delpart_module delpart completions/busctl 0000644 00000017044 15122360056 0010325 0 ustar 00 # busctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2013 Zbigniew Jędrzejewski-Szmek # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_busnames() { local mode=$1 local a b busctl $mode list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_objects() { local mode=$1 local busname=$2 local a b busctl $mode tree --list --no-legend --no-pager $busname | { while read a b; do echo " $a"; done; }; } __get_interfaces() { local mode=$1 local busname=$2 local path=$3 local a b busctl $mode introspect --list --no-legend --no-pager $busname $path | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }; } __get_members() { local mode=$1 local busname=$2 local path=$3 local interface=$4 local type=$5 local a b busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c; do [[ "$b" == "$type" ]] && echo " $a"; done; }; } __get_signature() { local mode=$1 local busname=$2 local path=$3 local interface=$4 local member=$5 local a b busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" ]] && echo " \"$c\""; done; }; } _busctl() { local i verb comps mode local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version --no-pager --no-legend --system --show-machine --unique --acquired --activatable --list --quiet --verbose --expect-reply=no --auto-start=no --allow-interactive-authorization=yes --augment-creds=no' [ARG]='-H --host -M --machine --address --match --timeout' ) if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user else mode=--system fi if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='list help' [BUSNAME]='status monitor capture tree' [OBJECT]='introspect' [METHOD]='call' [PROPERTY_GET]='get-property' [PROPERTY_SET]='set-property' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done n=$(($COMP_CWORD - $i)) if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[BUSNAME]}; then comps=$( __get_busnames $mode) elif __contains_word "$verb" ${VERBS[OBJECT]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi elif __contains_word "$verb" ${VERBS[METHOD]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} method) elif [[ $n -eq 5 ]] ; then comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi elif __contains_word "$verb" ${VERBS[PROPERTY_GET]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property) else comps='' fi elif __contains_word "$verb" ${VERBS[PROPERTY_SET]}; then if [[ $n -eq 1 ]] ; then comps=$( __get_busnames $mode) elif [[ $n -eq 2 ]] ; then comps=$( __get_objects $mode ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 3 ]] ; then comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) elif [[ $n -eq 4 ]] ; then comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property) elif [[ $n -eq 5 ]] ; then comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]}) else comps='' fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _busctl busctl completions/dmesg 0000644 00000002040 15122360056 0010116 0 ustar 00 _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 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS="--clear --read-clear --console-off --show-delta --reltime --console-on --file --facility --human --kernel --color --level --console-level --nopager --raw --syslog --buffer-size --ctime --notime --userspace --follow --decode --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _dmesg_module dmesg completions/coredumpctl 0000644 00000006533 15122360056 0011353 0 ustar 00 # coredumpctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE _{P,U,G}ID _COMM _EXE _CMDLINE _AUDIT_{SESSION,LOGINUID} _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT _KERNEL_{DEVICE,SUBSYSTEM} _UDEV_{SYSNAME,DEVNODE,DEVLINK} __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP) _coredumpctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1' local -A VERBS=( [LIST]='list' [DUMP]='dump gdb' ) if __contains_word "$prev" '--output -o'; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames elif __contains_word "$prev" '--FIELD -F'; then comps=$( compgen -W '${__journal_fields[*]}' -- "$cur" ) elif [[ $cur = -* ]]; then comps=${OPTS} elif __contains_word "$prev" ${VERBS[*]} && ! __contains_word ${COMP_WORDS[COMP_CWORD-2]} '--output -o -F --field'; then compopt -o nospace COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") ) return 0 elif [[ $cur = *=* ]]; then mapfile -t field_vals < <(coredumpctl -F "${prev%=}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) return 0 elif [[ $prev = '=' ]]; then mapfile -t field_vals < <(coredumpctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null) comps=${field_vals[*]} else for ((i=0; i <= COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[LIST]} ${VERBS[DUMP]}; then comps='' fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _coredumpctl coredumpctl completions/eject 0000644 00000002250 15122360056 0010114 0 ustar 00 _eject_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-a'|'--auto'|'-i'|'--manualeject') COMPREPLY=( $(compgen -W "off on" -- $cur) ) return 0 ;; '-c'|'--changerslot') # FIXME: there must be way to determine slots COMPREPLY=( $(compgen -W "slot" -- $cur) ) return 0 ;; '-x'|'--cdspeed') COMPREPLY=( $(compgen -W "$(eject -X)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--auto --changerslot --default --floppy --force --manualeject --no-unmount --no-partitions-unmount --noop --proc --tape --cdrom --scsi --trayclose --traytoggle --verbose --cdspeed --listspeed --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS="$(for I in /sys/class/block/*/removable; do if [ $(cat $I) -ne 0 ]; then OLD_IFS=$IFS IFS='/'; ARR=($I) echo "/dev/${ARR[4]}" IFS=$OLD_IFS fi done)" COMPREPLY=( $(compgen -W "$DEVS" $cur) ) return 0 } complete -F _eject_module eject completions/hostnamectl 0000644 00000004245 15122360056 0011351 0 ustar 00 # hostnamectl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _hostnamectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --transient --static --pretty --no-ask-password -H --host --machine' if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='status' [ICONS]='set-icon-name' [NAME]='set-hostname set-deployment' [CHASSIS]='set-chassis' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[CHASSIS]}; then comps='desktop laptop server tablet handset watch embedded vm container' elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _hostnamectl hostnamectl completions/fallocate 0000644 00000001121 15122360056 0010750 0 ustar 00 _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="--keep-size --punch-hole --offset --length --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 completions/journalctl 0000644 00000012635 15122360056 0011207 0 ustar 00 # journalctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE _{P,U,G}ID _COMM _EXE _CMDLINE _AUDIT_{SESSION,LOGINUID} _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT _KERNEL_{DEVICE,SUBSYSTEM} _UDEV_{SYSNAME,DEVNODE,DEVLINK} __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP) __syslog_priorities=(emerg alert crit err warning notice info debug) _journalctl() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-a --all --full --system --user --disk-usage -f --follow --header -h --help -l --local --new-id128 -m --merge --no-pager --no-tail -q --quiet --setup-keys --this-boot --verify --version --list-catalog --update-catalog --list-boots --show-cursor --dmesg -k --pager-end -e -r --reverse --utc -x --catalog --no-full --force --dump-catalog --flush' [ARG]='-b --boot --this-boot -D --directory --file -F --field -o --output -u --unit -p --priority' [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until --after-cursor --verify-key --identifier --root --machine' ) if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then case $prev in --boot|--this-boot|-b) comps=$(journalctl -F '_BOOT_ID' 2>/dev/null) ;; --directory|-D) comps=$(compgen -d -- "$cur") compopt -o filenames ;; --file) comps=$(compgen -f -- "$cur") compopt -o filenames ;; --output|-o) comps='short short-iso short-precise short-monotonic verbose export json json-pretty json-sse cat' ;; --field|-F) comps=${__journal_fields[*]} ;; --priority|-p) comps=${__syslog_priorities[*]} ;; --unit|-u) comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null) ;; *) return 0 ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 elif [[ $cur = *=* ]]; then mapfile -t field_vals < <(journalctl -F "${prev%=}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") ) elif [[ $cur = /dev* ]]; then compopt -o filenames COMPREPLY=( $(compgen -f -- "${cur}") ) elif [[ $cur = /* ]]; then # Append /dev/ to the list of completions, so that # after typing /
the user sees /dev/ as one # of the alternatives. Later on the rule above will # take care of showing device files in /dev/. mapfile -t field_vals < <(journalctl -F "_EXE" 2>/dev/null; echo '/dev/') COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur}") ) if [[ "${COMPREPLY[@]}" = '/dev/' ]]; then compopt -o filenames COMPREPLY=( $(compgen -f -- "${cur}") ) fi elif [[ $prev = '=' ]]; then mapfile -t field_vals < <(journalctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null) COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") ) else compopt -o nospace COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") ) fi } complete -F _journalctl journalctl completions/fdformat 0000644 00000000636 15122360056 0010632 0 ustar 00 _fdformat_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 DEVS=$(for I in echo /dev/fd*; do if [ -e $I ]; then echo $I; fi; done) OPTS="--no-verify --help --version $DEVS" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _fdformat_module fdformat completions/kernel-install 0000644 00000003400 15122360056 0011744 0 ustar 00 # kernel-install(8) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2013 Kay Sievers # Copyright 2013 Harald Hoyer # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. _kernel_install() { local comps local MACHINE_ID local cur=${COMP_WORDS[COMP_CWORD]} case $COMP_CWORD in 1) comps="add remove" ;; 2) comps=$(cd /lib/modules; echo [0-9]*) if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then read MACHINE_ID < /etc/machine-id if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*) fi fi ;; 3) [[ "$cur" ]] || cur=/boot/vmlinuz-${COMP_WORDS[2]} comps=$(compgen -f -- "$cur") compopt -o filenames ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _kernel_install kernel-install completions/fdisk 0000644 00000002057 15122360056 0010127 0 ustar 00 _fdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s') local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'part' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 ;; '-b') COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) ) return 0 ;; '-c') COMPREPLY=( $(compgen -W "dos nondos" -- $cur) ) return 0 ;; '-u') COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) ) return 0 ;; '-C'|'-H'|'-S') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'-v') return 0 ;; esac case $cur in -*) OPTS="-l -s -b -c -h -u -v -C -H -S" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 } complete -F _fdisk_module fdisk completions/localectl 0000644 00000006554 15122360056 0010777 0 ustar 00 # localectl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \ LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \ LC_NAME LC_ADDRESS LC_TELEPHONE \ LC_MEASUREMENT LC_IDENTIFICATION ) # LC_ALL is omitted on purpose _localectl() { local i verb comps locale_vals local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-convert --no-pager --no-ask-password -H --host --machine' if __contains_word "$prev" $OPTS; then case $prev in --host|-H) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [STANDALONE]='status list-locales list-keymaps' [LOCALES]='set-locale' [KEYMAPS]='set-keymap' [X11]='set-x11-keymap' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[LOCALES]}; then if [[ $cur = *=* ]]; then mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "${cur#=}") ) elif [[ $prev = "=" ]]; then mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "$cur") ) else compopt -o nospace COMPREPLY=( $(compgen -W '${__locale_fields[*]}' -S= -- "$cur") ) fi return 0 elif __contains_word "$verb" ${VERBS[KEYMAPS]}; then comps=$(command localectl list-keymaps) elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[X11]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _localectl localectl completions/findmnt 0000644 00000005427 15122360056 0010472 0 ustar 00 _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 < <(findmnt -rno OPTIONS) COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) ) return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="SOURCE TARGET FSTYPE OPTIONS VFS-OPTIONS FS-OPTIONS LABEL UUID PARTLABEL PARTUUID MAJ\:MIN ACTION OLD-TARGET OLD-OPTIONS SIZE AVAIL USED USE% FSROOT TID ID OPT-FIELDS PROPAGATION FREQ PASSNO" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-t'|'--types') local TYPES TYPES="adfs affs autofs cifs coda coherent cramfs debugfs devpts efs ext ext2 ext3 ext4 hfs hfsplus hpfs iso9660 jfs minix msdos ncpfs nfs nfs4 ntfs proc qnx4 ramfs reiserfs romfs squashfs smbfs sysv tmpfs ubifs udf ufs umsdos usbfs vfat xenix xfs xiafs" COMPREPLY=( $(compgen -W "$TYPES" -- $cur) ) return 0 ;; '-S'|'--source') local DEV_MPOINT DEV_MPOINT=$(findmnt -rno SOURCE | grep ^/dev) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; '-T'|'--target') local DEV_MPOINT DEV_MPOINT=$(findmnt -rno TARGET) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--fstab --mtab --kernel --poll --timeout --all --ascii --canonicalize --df --direction --evaluate --tab-file --first-only --invert --list --task --noheadings --notruncate --options --output --pairs --raw --types --nofsroot --submounts --source --target --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV_MPOINT DEV_MPOINT=$(findmnt -rno TARGET,SOURCE) COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) ) return 0 } complete -F _findmnt_module findmnt completions/loginctl 0000644 00000010037 15122360056 0010637 0 ustar 00 # loginctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_all_sessions () { loginctl --no-legend list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; } __get_all_users () { loginctl --no-legend list-users | { while read -r a b; do printf "%s\n" "$b"; done; } ; } __get_all_seats () { loginctl --no-legend list-seats | { while read -r a b; do printf "%s\n" "$a"; done; } ; } _loginctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version --no-legend --no-ask-password -l --full' [ARG]='--host -H --kill-who --property -p --signal -s --machine' ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) comps=$(compgen -A signal) ;; --kill-who) comps='all leader' ;; --host|-H) comps=$(compgen -A hostname) ;; --property|-p) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session' [USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user' [SEATS]='seat-status show-seat terminate-seat' [STANDALONE]='list-sessions list-users list-seats flush-devices' [ATTACH]='attach' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[SESSIONS]}; then comps=$( __get_all_sessions ) elif __contains_word "$verb" ${VERBS[USERS]}; then comps=$( __get_all_users ) elif __contains_word "$verb" ${VERBS[SEATS]}; then comps=$( __get_all_seats ) elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[ATTACH]}; then if [[ $prev = $verb ]]; then comps=$( __get_all_seats ) else comps=$(compgen -A file -- "$cur" ) compopt -o filenames fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _loginctl loginctl completions/flock 0000644 00000001534 15122360056 0010124 0 ustar 00 _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 --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 completions/machinectl 0000644 00000006172 15122360056 0011140 0 ustar 00 # machinectl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _machinectl() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='--all -a --full --help -h --no-ask-password --no-legend --no-pager --version' [ARG]='--host -H --kill-who -M --machine --property -p --signal -s' ) local -A VERBS=( [STANDALONE]='list' [MACHINES]='status show terminate kill reboot login' ) _init_completion || return for ((i=0; i <= COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) comps=$(compgen -A signal) ;; --kill-who) comps='all leader' ;; --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; --property|-p) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' elif __contains_word "$verb" ${VERBS[MACHINES]}; then comps=$( __get_machines ) fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _machinectl machinectl completions/fsck 0000644 00000001425 15122360056 0007753 0 ustar 00 _fsck_module() { local cur prev OPTS DEVS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-b') COMPREPLY=( $(compgen -W "superblock" -- $cur) ) return 0 ;; '-B') COMPREPLY=( $(compgen -W "blocksize" -- $cur) ) return 0 ;; '-j') COMPREPLY=( $(compgen -W "external_journal" -- $cur) ) return 0 ;; '-l'|'-L') COMPREPLY=( $(compgen -W "bad_blocks_file" -- $cur) ) return 0 ;; '-?') return 0 ;; esac case $cur in -*) OPTS="-p -n -y -c -f -v -b -B -j -l -L" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _fsck_module fsck completions/systemctl 0000644 00000030456 15122360056 0011062 0 ustar 00 # systemctl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __systemctl() { local mode=$1; shift 1 systemctl $mode --full --no-legend "$@" } __systemd_properties() { local mode=$1 { __systemctl $mode show --all; /usr/lib/systemd/systemd --dump-configuration-items; } | while IFS='=' read -r key value; do [[ $value ]] && echo "$key" done } __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __filter_units_by_property () { local mode=$1 property=$2 value=$3 ; shift 3 local units=("$@") local props IFS=$'\n' read -rd '' -a props < \ <(__systemctl $mode show --property "$property" -- "${units[@]}") for ((i=0; $i < ${#units[*]}; i++)); do if [[ "${props[i]}" = "$property=$value" ]]; then echo " ${units[i]}" fi done } __get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \ | { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; } __get_template_names () { __systemctl $1 list-unit-files \ | { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; } __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } __get_startable_units () { # find startable inactive units __filter_units_by_property $mode ActiveState inactive $( __filter_units_by_property $mode CanStart yes $( __systemctl $mode list-unit-files --state enabled,disabled,static | \ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; } __systemctl $mode list-units --state inactive,failed | \ { while read -r a b; do echo " $a"; done; } )) } __get_restartable_units () { # filter out masked and not-found __filter_units_by_property $mode CanStart yes $( __systemctl $mode list-unit-files --state enabled,disabled,static | \ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; } __systemctl $mode list-units | \ { while read -r a b; do echo " $a"; done; } ) } __get_failed_units () { __systemctl $1 list-units \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } __get_enabled_units () { __systemctl $1 list-unit-files \ | { while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }; } __get_disabled_units () { __systemctl $1 list-unit-files \ | { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }; } __get_masked_units () { __systemctl $1 list-unit-files \ | { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; } __get_all_unit_files () { { __systemctl $1 list-unit-files; } | { while read -r a b; do echo " $a"; done; }; } _systemctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps mode local -A OPTS=( [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --now --quiet -q --privileged -P --system --version --runtime --recursive -r' [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' ) local -A PROPS='CPUQuota= CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= SendSIGKILL= WakeSystem= DefaultDependencies= MemoryLimit= CPUShares= BlockIOWeight= User= Group= DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= KillSignal= AccuracySec= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= LimitNICE= LimitRTPRIO= LimitRTTIME=' if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user else mode=--system fi if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) comps=$(compgen -A signal) ;; --type|-t) comps='automount busname device mount path service snapshot socket swap target timer' ;; --state) comps='loaded not-found stub active inactive dead elapsed exited listening mounted plugged running waiting' ;; --kill-who) comps='all control main' ;; --root) comps=$(compgen -A directory -- "$cur" ) compopt -o filenames ;; --host|-H) comps=$(compgen -A hostname) ;; --property|-p) comps=$(__systemd_properties $mode) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies edit' [ENABLED_UNITS]='disable' [DISABLED_UNITS]='enable' [REENABLABLE_UNITS]='reenable' [FAILED_UNITS]='reset-failed' [STARTABLE_UNITS]='start' [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart' [ISOLATABLE_UNITS]='isolate' [RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload' [RESTARTABLE_UNITS]='restart reload-or-restart' [TARGET_AND_UNITS]='add-wants add-requires' [MASKED_UNITS]='unmask' [JOBS]='cancel' [SNAPSHOTS]='delete' [PROPERTIES]='set-property' [ENVS]='set-environment unset-environment' [STANDALONE]='daemon-reexec daemon-reload default emergency exit halt hibernate hybrid-sleep kexec list-jobs list-sockets list-timers list-units list-unit-files poweroff reboot rescue show-environment suspend get-default is-system-running' [NAME]='snapshot' [FILE]='link switch-root' [TARGETS]='set-default' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps="${VERBS[*]}" elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then comps=$( __get_all_units $mode ) compopt -o filenames elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then comps=$( __get_enabled_units $mode ) compopt -o filenames elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then comps=$( __get_disabled_units $mode; __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then comps=$( __get_disabled_units $mode; __get_enabled_units $mode; __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then comps=$( __get_startable_units $mode; __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __get_restartable_units $mode; __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStop yes \ $( __get_active_units $mode ) ) compopt -o filenames elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanReload yes \ $( __get_active_units $mode ) ) compopt -o filenames elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then comps=$( __filter_units_by_property $mode AllowIsolate yes \ $( __get_all_units $mode ) ) compopt -o filenames elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then comps=$( __get_failed_units $mode ) compopt -o filenames elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then comps=$( __get_masked_units $mode ) compopt -o filenames elif __contains_word "$verb" ${VERBS[TARGET_AND_UNITS]}; then if __contains_word "$prev" ${VERBS[TARGET_AND_UNITS]} \ || __contains_word "$prev" ${OPTS[STANDALONE]}; then comps=$( __systemctl $mode list-unit-files --type target --all \ | { while read -r a b; do echo " $a"; done; } ) else comps=$( __get_all_unit_files $mode ) fi compopt -o filenames elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then comps='' elif __contains_word "$verb" ${VERBS[JOBS]}; then comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } ) elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then comps=$( __systemctl $mode list-units --type snapshot --full --all \ | { while read -r a b; do echo " $a"; done; } ) elif __contains_word "$verb" ${VERBS[ENVS]}; then comps=$( __systemctl $mode show-environment \ | while read -r line; do echo " ${line%%=*}=";done ) compopt -o nospace elif __contains_word "$verb" ${VERBS[FILE]}; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames elif __contains_word "$verb" ${VERBS[TARGETS]}; then comps=$( __systemctl $mode list-unit-files --type target --full --all \ | { while read -r a b; do echo " $a"; done; } ) elif __contains_word "$verb" ${VERBS[PROPERTIES]}; then if __contains_word "$prev" ${VERBS[PROPERTIES]}; then comps=$( __get_active_units $mode ) else comps=$PROPS compopt -o nospace fi fi COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") ) return 0 } complete -F _systemctl systemctl completions/fsck.cramfs 0000644 00000000774 15122360056 0011233 0 ustar 00 _fsck.cramfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-x'|'--destination') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac OPTS='--verbose --destination --help --version file' COMPREPLY=( $(compgen -W "${OPTS[*]}" -S ' ' -- $cur) ) return 0 } complete -F _fsck.cramfs_module fsck.cramfs completions/systemd-analyze 0000644 00000007625 15122360056 0012166 0 ustar 00 # systemd-analyze(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # Copyright 2013 Harald Hoyer # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _systemd_analyze() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='--help --version --system --from-pattern --to-pattern --order --require --no-pager' [ARG]='-H --host -M --machine --fuzz --man' ) local -A VERBS=( [STANDALONE]='time blame plot dump' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [LOG_LEVEL]='set-log-level' [VERIFY]='verify' ) _init_completion || return for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --host|-H) comps=$(compgen -A hostname) ;; --machine|-M) comps=$( __get_machines ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ -z $verb && $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then if [[ $cur = -* ]]; then comps='--help --version --system ' fi elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then if [[ $cur = -* ]]; then comps='--help --version --system --fuzz' fi elif __contains_word "$verb" ${VERBS[DOT]}; then if [[ $cur = -* ]]; then comps='--help --version --system --from-pattern --to-pattern --order --require' fi elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then if [[ $cur = -* ]]; then comps='--help --version --system' else comps='debug info notice warning err crit alert emerg' fi elif __contains_word "$verb" ${VERBS[VERIFY]}; then if [[ $cur = -* ]]; then comps='--help --version --system --no-man' else comps=$( compgen -A file -- "$cur" ) compopt -o filenames fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _systemd_analyze systemd-analyze completions/fsck.minix 0000644 00000000623 15122360056 0011075 0 ustar 00 _fsck.minix_module() { local cur prev OPTS DEVS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-V'|'--version') return 0 ;; esac while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) OPTS="-l -a -r -v -s -m -f --version" COMPREPLY=( $(compgen -W "${OPTS[*]} $DEVS" -- $cur) ) return 0 } complete -F _fsck.minix_module fsck.minix completions/systemd-cat 0000644 00000003570 15122360056 0011265 0 ustar 00 # systemd-cat(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd_cat() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version' [ARG]='-t --identifier -p --priority --level-prefix' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --identifier|-t) comps='' ;; --priority|-p) comps='emerg alert crit err warning notice info debug' ;; --level-prefix) comps='yes no' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cat systemd-cat completions/fsfreeze 0000644 00000001014 15122360056 0010630 0 ustar 00 _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 completions/systemd-cgls 0000644 00000003400 15122360056 0011436 0 ustar 00 # systemd-cgls(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _systemd_cgls() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version --all -l --full -k --no-pager' [ARG]='-M --machine' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --machine|-M) comps=$( __get_machines ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cgls systemd-cgls completions/fstrim 0000644 00000001162 15122360056 0010327 0 ustar 00 _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="--offset --length --minimum --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local MPOINTS MPOINTS=$(findmnt -rno SOURCE | grep ^/dev) COMPREPLY=( $(compgen -W "$MPOINTS" -- $cur) ) return 0 } complete -F _fstrim_module fstrim completions/systemd-cgtop 0000644 00000002512 15122360056 0011625 0 ustar 00 # systemd-cgtop(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd_cgtop() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local comps local -A OPTS=( [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay' [ARG]='--cpu --depth' ) _init_completion || return COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_cgtop systemd-cgtop completions/getopt 0000644 00000001457 15122360056 0010334 0 ustar 00 _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 completions/systemd-delta 0000644 00000003640 15122360056 0011605 0 ustar 00 # systemd-delta(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd-delta() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local comps local -A OPTS=( [STANDALONE]='--help -h --no-pager --version' [ARG]='--diff --type -t' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --diff) comps='yes no' ;; --type|-t) comps='masked equivalent redirected overridden unchanged extended default' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ "$cur" = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _systemd-delta systemd-delta completions/hexdump 0000644 00000001223 15122360056 0010473 0 ustar 00 _hexdump_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-e') COMPREPLY=( $(compgen -W "format" -- $cur) ) return 0 ;; '-n') COMPREPLY=( $(compgen -W "length" -- $cur) ) return 0 ;; '-s') COMPREPLY=( $(compgen -W "offset" -- $cur) ) return 0 ;; '-V') return 0 ;; esac case $cur in -*) OPTS="-b -c -C -d -o -x -e -f -n -s -v -V" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _hexdump_module hexdump completions/systemd-detect-virt 0000644 00000002445 15122360056 0012750 0 ustar 00 # systemd-detect-virt(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _systemd_detect_virt() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet' ) _init_completion || return COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_detect_virt systemd-detect-virt completions/hwclock 0000644 00000001651 15122360056 0010460 0 ustar 00 _hwclock_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--rtc'|'--adjfile') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '--date') COMPREPLY=( $(compgen -W "date" -- $cur) ) return 0 ;; '--epoch') COMPREPLY=( $(compgen -W "year" -- $cur) ) return 0 ;; '-h'|'-?'|'--help'|'-v'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--help --show --set --hctosys --systohc --systz --adjust --compare --getepoch --setepoch --predict --version --utc --localtime --rtc --directisa --badyear --date --epoch --noadjfile --adjfile --test --debug" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _hwclock_module hwclock completions/systemd-nspawn 0000644 00000013364 15122360056 0012026 0 ustar 00 # systemd-nspawn(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2014 Thomas H.P. Andersen # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word() { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_users() { local a b loginctl list-users --no-legend --no-pager | { while read a b; do echo " $b"; done; }; } __get_slices() { local a b systemctl list-units -t slice --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } __get_env() { local a env | { while read a; do echo " ${a%%=*}"; done; }; } __get_interfaces(){ cut -f 1 -d ' ' /proc/net/dev | tail -n +3 | tr -s '\n' | tr -d ':' | xargs } _systemd_nspawn() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit --network-veth -j' [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine -S --slice --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge --personality -i --image --tmpfs --volatile --network-macvlan' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --directory|-D) compopt -o nospace comps=$(compgen -S/ -A directory -- "$cur" ) ;; --user|-u) comps=$( __get_users ) ;; --uuid) comps='' ;; --capability) comps='CAP_BLOCK_SUSPEND CAP_IPC_LOCK CAP_MAC_ADMIN CAP_MAC_OVERRIDE CAP_SYS_MODULE CAP_SYS_PACCT CAP_SYS_RAWIO CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM CAP_NET_ADMIN' ;; --drop-capability) comps='CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE CAP_MKNOD CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETFCAP CAP_SETGID CAP_SETPCAP CAP_SETUID CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_RESOURCE CAP_SYS_TTY_CONFIG' ;; --link-journal) comps='no auto guest host' ;; --bind|--bind-ro) compopt -o nospace comps=$(compgen -S/ -A directory -- "$cur" ) ;; --tmpfs) compopt -o nospace comps=$(compgen -S/ -A directory -- "$cur" ) ;; --machine|-M) comps=$( __get_machines ) ;; --slice|-S) comps=$( __get_slices ) ;; --setenv) comps=$( __get_env ) ;; --selinux-context|-Z) comps='' ;; --selinux-apifs-context|-L) comps='' ;; --register) comps='yes no' ;; --network-interface) comps=$(__get_interfaces) ;; --network-bridge) comps='' ;; --network-macvlan) comps='' ;; --personality) comps='x86 x86-64' ;; --volatile) comps='yes state no' ;; --image|-i) compopt -o nospace comps=$( compgen -A file -- "$cur" ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } complete -F _systemd_nspawn systemd-nspawn completions/ionice 0000644 00000001505 15122360056 0010272 0 ustar 00 _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'|'--pid') local PIDS PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--class --classdata --pid --ignore --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 completions/systemd-run 0000644 00000007016 15122360056 0011321 0 ustar 00 # systemd-run(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2013 Zbigniew Jędrzejewski-Szmek # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __systemctl() { local mode=$1; shift 1 systemctl $mode --full --no-legend "$@" } __get_slice_units () { __systemctl $1 list-units --all -t slice \ | { while read -r a b c d; do echo " $a"; done; }; } __get_machines() { local a b machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } _systemd_run() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --system --scope --unit --description --slice -r --remain-after-exit --send-sighup -H --host -M --machine --service-type --uid --gid --nice --setenv -p --property' local mode=--system local i for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then local root_command=${COMP_WORDS[i]} _command_offset $i return fi [[ $i -lt $COMP_CWORD && ${COMP_WORDS[i]} == @(--unit|--description|--slice|--service-type|-H|--host|-M|--machine|-p|--property) ]] && ((i++)) done case "$prev" in --unit|--description) # argument required but no completions available return ;; --slice) local comps=$(__get_slice_units $mode) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; --service-type) local comps='simple forking oneshot dbus notify idle' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -p|--property) local comps='CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= KillSignal= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= LimitNICE= LimitRTPRIO= LimitRTTIME= PassEnvironment=' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -H|--host) local comps=$(compgen -A hostname) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; -M|--machine) local comps=$( __get_machines ) COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; esac COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 } complete -F _systemd_run systemd-run completions/ipcrm 0000644 00000002617 15122360056 0010143 0 ustar 00 _ipcrm_module() { local cur prev OPTS KEYIDS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-m'|'--shmem-id') KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-M'|'--shmem-key') KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-q'|'--queue-id') KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-Q'|'--queue-key') KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-s'|'--semaphore-id') KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $2}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-S'|'--semaphore-key') KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $1}}')" COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) ) return 0 ;; esac OPTS=" --shmem-id --shmem-key --queue-id --queue-key --semaphore-id --semaphore-key --all= --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _ipcrm_module ipcrm completions/timedatectl 0000644 00000005024 15122360056 0011323 0 ustar 00 # timedatectl(1) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } _timedatectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --adjust-system-clock --no-pager --no-ask-password -H --host --machine' if __contains_word "$prev" $OPTS; then case $prev in --host|-H) comps='' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 fi if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi local -A VERBS=( [BOOLEAN]='set-local-rtc set-ntp' [STANDALONE]='status set-time list-timezones' [TIMEZONES]='set-timezone' [TIME]='set-time' ) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then comps='true false' elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then comps=$(command timedatectl list-timezones) elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[TIME]}; then comps='' fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _timedatectl timedatectl completions/ipcs 0000644 00000001002 15122360056 0007752 0 ustar 00 _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 completions/udevadm 0000644 00000007216 15122360056 0010456 0 ustar 00 # udevadm(8) completion -*- shell-script -*- # # This file is part of systemd. # # Copyright 2010 Ran Benita # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see
. __contains_word () { local w word=$1; shift for w in "$@"; do [[ $w = "$word" ]] && return done } __get_all_sysdevs() { local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/) printf '%s\n' "${devs[@]%/}" } _udevadm() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --debug' local verbs=(info trigger settle control monitor hwdb test-builtin test) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}" && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then verb=${COMP_WORDS[i]} break fi done if [[ -z $verb ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]} ${verbs[*]}' -- "$cur") ) return 0 fi case $verb in 'info') if [[ $cur = -* ]]; then comps='--help --query= --path= --name= --root --attribute-walk --export-db --cleanup-db' else comps=$( __get_all_sysdevs ) fi ;; 'trigger') comps='--help --verbose --dry-run --type= --action= --subsystem-match= --subsystem-nomatch= --attr-match= --attr-nomatch= --property-match= --tag-match= --sysname-match= --parent-match=' ;; 'settle') comps='--help --timeout= --seq-start= --seq-end= --exit-if-exists= --quiet' ;; 'control') comps='--help --exit --log-priority= --stop-exec-queue --start-exec-queue --reload --property= --children-max= --timeout=' ;; 'monitor') comps='--help --kernel --udev --property --subsystem-match= --tag-match=' ;; 'hwdb') comps='--help --update --test=' ;; 'test') if [[ $cur = -* ]]; then comps='--help --action=' else comps=$( __get_all_sysdevs ) fi ;; 'test-builtin') comps='blkid btrfs hwdb input_id keyboard kmod net_id net_setup_link path_id usb_id uaccess' ;; *) comps=${VERBS[*]} ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 } complete -F _udevadm udevadm completions/isosize 0000644 00000000652 15122360056 0010513 0 ustar 00 _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 OPTS='--divisor --sectors --help --version' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 } complete -F _isosize_module isosize completions/grub 0000644 00000026641 15122360056 0007773 0 ustar 00 # # Bash completion for grub # # Copyright (C) 2010 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GRUB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GRUB. If not, see
. # bash completion for grub __grub_dir() { local i c=1 boot_dir for (( c=1; c <= ${#COMP_WORDS[@]}; c++ )); do i="${COMP_WORDS[c]}" case "$i" in --boot-directory) c=$((++c)) i="${COMP_WORDS[c]}" boot_dir="${i##*=}"; break ;; esac done boot_dir=${boot_dir-/boot} echo "${boot_dir%/}/grub2" } # This function generates completion reply with compgen # - arg: accepts 1, 2, 3, or 4 arguments # $1 wordlist separate by space, tab or newline # $2 (optional) prefix to add # $3 (optional) current word to complete # $4 (optional) suffix to add __grubcomp () { local cur="${COMP_WORDS[COMP_CWORD]}" if [ $# -gt 2 ]; then cur="$3" fi case "$cur" in --*=) COMPREPLY=() ;; *) local IFS=' '$'\t'$'\n' COMPREPLY=($(compgen -P "${2-}" -W "${1-}" -S "${4-}" -- "$cur")) ;; esac } # Function that return long options from the help of the command # - arg: $1 (optional) command to get the long options from __grub_get_options_from_help () { local prog if [ $# -ge 1 ]; then prog="$1" else prog="${COMP_WORDS[0]}" fi local i IFS=" "$'\t'$'\n' for i in $(LC_ALL=C $prog --help) do case $i in --*) echo "${i%=*}";; esac done } # Function that return long options from the usage of the command # - arg: $1 (optional) command to get the long options from __grub_get_options_from_usage () { local prog if [ $# -ge 1 ]; then prog="$1" else prog="${COMP_WORDS[0]}" fi local i IFS=" "$'\t'$'\n' for i in $(LC_ALL=C $prog --usage) do case $i in \[--*\]) i=${i#[} # Remove leading [ echo ${i%%?(=*)]} # Remove optional value and trailing ] ;; esac done } __grub_get_last_option () { local i for (( i=$COMP_CWORD-1; i > 0; i-- )); do if [[ "${COMP_WORDS[i]}" == -* ]]; then echo "${COMP_WORDS[i]}" break; fi done } __grub_list_menuentries () { local cur="${COMP_WORDS[COMP_CWORD]}" local config_file=$(__grub_dir)/grub.cfg if [ -f "$config_file" ];then local IFS=$'\n' COMPREPLY=( $(compgen \ -W "$( awk -F "[\"']" '/menuentry/ { print $2 }' $config_file )" \ -- "$cur" )) #'# Help emacs syntax highlighting fi } __grub_list_modules () { local grub_dir=$(__grub_dir) local IFS=$'\n' COMPREPLY=( $( compgen -f -X '!*/*.mod' -- "${grub_dir}/$cur" | { while read -r tmp; do [ -n $tmp ] && { tmp=${tmp##*/} printf '%s\n' ${tmp%.mod} } done } )) } # # grub-set-default & grub-reboot # _grub_set_entry () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in --boot-directory) _filedir -d return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a menuentry __grub_list_menuentries fi } __grub_set_default_program="grub2-set-default" have ${__grub_set_default_program} && \ complete -F _grub_set_entry -o filenames ${__grub_set_default_program} unset __grub_set_default_program __grub_reboot_program="grub2-reboot" have ${__grub_reboot_program} && \ complete -F _grub_set_entry -o filenames ${__grub_reboot_program} unset __grub_reboot_program # # grub-editenv # _grub_editenv () { local cur prev COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} case "$prev" in create|list|set|unset) COMPREPLY=( "" ) return ;; esac __grubcomp "$(__grub_get_options_from_help) create list set unset" } __grub_editenv_program="grub2-editenv" have ${__grub_editenv_program} && \ complete -F _grub_editenv -o filenames ${__grub_editenv_program} unset __grub_editenv_program # # grub-mkconfig # _grub_mkconfig () { local cur prev COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else _filedir fi } __grub_mkconfig_program="grub2-mkconfig" have ${__grub_mkconfig_program} && \ complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program} unset __grub_mkconfig_program # # grub-setup # _grub_setup () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -d|--directory) _filedir -d return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_bios_setup_program="grub2-bios-setup" have ${__grub_bios_setup_program} && \ complete -F _grub_setup -o filenames ${__grub_bios_setup_program} unset __grub_bios_setup_program __grub_sparc64_setup_program="grub2-sparc64-setup" have ${__grub_sparc64_setup_program} && \ complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program} unset __grub_sparc64_setup_program # # grub-get-kernel-settings # _grub_get_kernel_settings () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_get_kernel_settings_program="grub2-get-kernel-settings" have ${__grub_get_kernel_settings_program} && \ complete -F _grub_get_kernel_settings -o filenames ${__grub_get_kernel_settings_program} unset __grub_get_kernel_settings_program # # grub-install # _grub_install () { local cur prev last split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} last=$(__grub_get_last_option) _split_longopt && split=true case "$prev" in --boot-directory) _filedir -d return ;; --disk-module) __grubcomp "biosdisk ata" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else case "$last" in --modules) __grub_list_modules return ;; esac # Default complete with a filename _filedir fi } __grub_install_program="grub2-install" have ${__grub_install_program} && \ complete -F _grub_install -o filenames ${__grub_install_program} unset __grub_install_program # # grub-mkfont # _grub_mkfont () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkfont_program="grub2-mkfont" have ${__grub_mkfont_program} && \ complete -F _grub_mkfont -o filenames ${__grub_mkfont_program} unset __grub_mkfont_program # # grub-mkrescue # _grub_mkrescue () { local cur prev last COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} last=$(__grub_get_last_option) if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else case "$last" in --modules) __grub_list_modules return ;; esac # Default complete with a filename _filedir fi } __grub_mkrescue_program="grub2-mkrescue" have ${__grub_mkrescue_program} && \ complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program} unset __grub_mkrescue_program # # grub-mkimage # _grub_mkimage () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -d|--directory|-p|--prefix) _filedir -d return ;; -O|--format) # Get available format from help local prog=${COMP_WORDS[0]} __grubcomp "$(LC_ALL=C $prog --help | \ awk -F ":" '/available formats/ { print $2 }' | \ sed 's/, / /g')" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkimage_program="grub2-mkimage" have ${__grub_mkimage_program} && \ complete -F _grub_mkimage -o filenames ${__grub_mkimage_program} unset __grub_mkimage_program # # grub-mkpasswd-pbkdf2 # _grub_mkpasswd_pbkdf2 () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_mkpasswd_pbkdf2_program="grub2-mkpasswd-pbkdf2" have ${__grub_mkpasswd_pbkdf2_program} && \ complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program} unset __grub_mkpasswd_pbkdf2_program # # grub-probe # _grub_probe () { local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true case "$prev" in -t|--target) # Get target type from help local prog=${COMP_WORDS[0]} __grubcomp "$(LC_ALL=C $prog --help | \ awk -F "[()]" '/--target=/ { print $2 }' | \ sed 's/|/ /g')" return ;; esac $split && return 0 if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_probe_program="grub2-probe" have ${__grub_probe_program} && \ complete -F _grub_probe -o filenames ${__grub_probe_program} unset __grub_probe_program # # grub-script-check # _grub_script_check () { local cur COMPREPLY=() cur=`_get_cword` if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)" else # Default complete with a filename _filedir fi } __grub_script_check_program="grub2-script-check" have ${__grub_script_check_program} && \ complete -F _grub_script_check -o filenames ${__grub_script_check_program} # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh completions/ldattach 0000644 00000002357 15122360056 0010616 0 ustar 00 _ldattach_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-s'|'--speed') COMPREPLY=( $(compgen -W "speed" -- $cur) ) return 0 ;; '-i'|'--iflag') local IFLAGS IFLAGS="BRKINT ICRNL IGNBRK IGNCR IGNPAR IMAXBEL INLCR INPCK ISTRIP IUCLC IUTF8 IXANY IXOFF IXON PARMRK -BRKINT -ICRNL -IGNBRK -IGNCR -IGNPAR -IMAXBEL -INLCR -INPCK -ISTRIP -IUCLC -IUTF8 -IXANY -IXOFF -IXON -PARMRK" COMPREPLY=( $(compgen -W "$IFLAGS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--debug --speed --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 completions/nmcli 0000644 00000007372 15122360056 0010136 0 ustar 00 # nmcli(1) completion _nmcli_array_delete_at() { eval "local ARRAY=(\"\${$1[@]}\")" local i local tmp=() local lower=$2 local upper=${3:-$lower} # for some reason the following fails. So this clumsy workaround... # A=(a "") # echo " >> ${#A[@]}" # >> 2 # A=("${A[@]:1}") # echo " >> ${#A[@]}" # >> 0 # ... seriously??? for i in "${!ARRAY[@]}"; do if [[ "$i" -lt "$2" || "$i" -gt "${3-$2}" ]]; then tmp=("${tmp[@]}" "${ARRAY[$i]}") fi done eval "$1=(\"\${tmp[@]}\")" } _nmcli() { local cur words cword i output _init_completion || return # we don't care about any arguments after the current cursor position # because we only parse from left to right. So, if there are some arguments # right of the cursor, just ignore them. Also don't care about ${words[0]}. _nmcli_array_delete_at words $((cword+1)) ${#words[@]} _nmcli_array_delete_at words 0 # _init_completion returns the words with all the quotes and escaping # characters. We don't care about them, drop them at first. for i in ${!words[@]}; do words[i]="$(printf '%s' "${words[i]}" | xargs printf '%s\n' 2>/dev/null || true)" done # In case the cursor is not at the end of the line, # $cur consists of spaces that we want do remove. # For example: `nmcli connection modify id
lo` if [[ "$cur" =~ ^[[:space:]]+ ]]; then cur='' fi output="$(nmcli --complete-args "${words[@]}" 2>/dev/null)" # Bail out early if we're completing a file name if [ $? = 65 ]; then compopt -o default COMPREPLY=() return 0 fi local IFS=$'\n' COMPREPLY=( $( compgen -W '$output' -- $cur ) ) # Now escape special characters (spaces, single and double quotes), # so that the argument is really regarded a single argument by bash. # See http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion local escaped_single_quote="'\''" local i=0 local entry for entry in ${COMPREPLY[*]} do if [[ "${cur:0:1}" == "'" ]]; then # started with single quote, escaping only other single quotes # [']bla'bla"bla\bla bla --> [']bla'\''bla"bla\bla bla COMPREPLY[$i]="${entry//\'/${escaped_single_quote}}" elif [[ "${cur:0:1}" == '"' ]]; then # started with double quote, escaping all double quotes and all backslashes # ["]bla'bla"bla\bla bla --> ["]bla'bla\"bla\\bla bla entry="${entry//\\/\\\\}" entry="${entry//\"/\\\"}" entry="${entry//!/\"\\!\"}" COMPREPLY[$i]="$entry" else # no quotes in front, escaping _everything_ # [ ]bla'bla"bla\bla bla --> [ ]bla\'bla\"bla\\bla\ bla entry="${entry//\\/\\\\}" entry="${entry//\'/\'}" entry="${entry//\"/\\\"}" entry="${entry// /\\ }" entry="${entry//\(/\\(}" entry="${entry//)/\\)}" entry="${entry//!/\\!}" entry="${entry//&/\\&}" COMPREPLY[$i]="$entry" fi (( i++ )) done # Work-around bash_completion issue where bash interprets a colon # as a separator. # Colon is escaped here. Change "\\:" back to ":". # See also: # http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons # http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727 i=0 for entry in ${COMPREPLY[*]} do entry="${entry//\\\\:/:}" COMPREPLY[$i]=${entry} (( i++ )) done } && complete -F _nmcli nmcli # ex: ts=4 sw=4 et filetype=sh completions/logger 0000644 00000002207 15122360056 0010303 0 ustar 00 _logger_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n'|'--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 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--udp --id --file --help --server --port --priority --stderr --tag --socket --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _logger_module logger completions/yum 0000644 00000026350 15122360056 0007643 0 ustar 00 # bash completion for yum _yum_helper() { local IFS=$'\n' if [[ -n "$YUM_CACHEDIR" && "$1 $2" == "list available" ]]; then for db in $(find "$YUM_CACHEDIR" -name primary_db.sqlite); do COMPREPLY+=( $( sqlite3 "$db" \ "SELECT name||'.'||arch FROM packages WHERE name LIKE '$3%'" ) ) done return fi COMPREPLY+=( $( /usr/share/yum-cli/completion-helper.py -d 0 -C "$@" 2>/dev/null ) ) } _yum_list() { # Fail fast for things that look like paths or options. [[ $2 == */* || $2 == [.~-]* ]] && return # Listing all available packages takes way too long [[ $1 != "installed" && ${#2} -lt 1 ]] && return _yum_helper list "$@" } # arguments: # 1 = 1 or 0 to list enabled or disabled plugins # 2 = current word to be completed _yum_plugins() { local val [[ $1 -eq 1 ]] && val='\(1\|yes\|true\|on\)' || val='\(0\|no\|false\|off\)' COMPREPLY+=( $( compgen -W '$( command grep -il "^\s*enabled\s*=\s*$val" \ /etc/yum/pluginconf.d/*.conf 2>/dev/null \ | sed -ne "s|^.*/\([^/]\{1,\}\)\.conf$|\1|p" )' -- "$2" ) ) } # arguments: # 1 = current word to be completed _yum_binrpmfiles() { COMPREPLY+=( $( compgen -f -o plusdirs -X '!*.rpm' -- "$1" ) ) COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -X '*.src.rpm' ) ) COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -X '*.nosrc.rpm' ) ) } _yum_baseopts() { local opts='--help --tolerant --cacheonly --config --randomwait --debuglevel --showduplicates --errorlevel --rpmverbosity --quiet --verbose --assumeyes --assumeno --version --installroot --enablerepo --disablerepo --exclude --disableexcludes --obsoletes --noplugins --nogpgcheck --skip-broken --color --releasever --setopt --downloadonly --downloaddir --disableincludes' [[ $COMP_LINE == *--noplugins* ]] || \ opts+=" --disableplugin --enableplugin" printf %s "$opts" } _yum_transactions() { COMPREPLY+=( $( compgen -W "$( $yum -d 0 -C history 2>/dev/null | \ sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" -- "$cur" ) ) } _yum_atgroups() { if [[ $1 == \@* ]]; then _yum_helper groups list all "${1:1}" COMPREPLY=( "${COMPREPLY[@]/#/@}" ) return 0 fi return 1 } # arguments: # 1 = current word to be completed # 2 = previous word # return 0 if no more completions should be sought, 1 otherwise _yum_complete_baseopts() { case $2 in -d|--debuglevel|-e|--errorlevel) COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$1" ) ) return 0 ;; --rpmverbosity) COMPREPLY=( $( compgen -W 'info critical emergency error warn debug' -- "$1" ) ) return 0 ;; -c|--config) COMPREPLY=( $( compgen -f -o plusdirs -X "!*.conf" -- "$1" ) ) return 0 ;; --installroot|--downloaddir) COMPREPLY=( $( compgen -d -- "$1" ) ) return 0 ;; --enablerepo) _yum_helper repolist disabled "$1" return 0 ;; --disablerepo) _yum_helper repolist enabled "$1" return 0 ;; --disableexcludes|--disableincludes) _yum_helper repolist all "$1" local main= [[ $2 == *excludes ]] && main=main COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all $main' -- "$1" ) ) return 0 ;; --enableplugin) _yum_plugins 0 "$1" return 0 ;; --disableplugin) _yum_plugins 1 "$1" return 0 ;; --color) COMPREPLY=( $( compgen -W 'always auto never' -- "$1" ) ) return 0 ;; -R|--randomwait|-x|--exclude|-h|--help|--version|--releasever|--cve|\ --bz|--advisory|--tmprepo|--verify-filenames|--setopt) return 0 ;; --download-order) COMPREPLY=( $( compgen -W 'default smallestfirst largestfirst' \ -- "$1" ) ) return 0 ;; --override-protection) _yum_list installed "$1" return 0 ;; --verify-configuration-files) COMPREPLY=( $( compgen -W '1 0' -- "$1" ) ) return 0 ;; esac return 1 } _yum() { COMPREPLY=() local yum=$1 cur=$2 prev=$3 words=("${COMP_WORDS[@]}") declare -F _get_comp_words_by_ref &>/dev/null && \ _get_comp_words_by_ref -n = cur prev words # Commands offered as completions local cmds=( check check-update clean deplist distro-sync downgrade groups help history info install list load-transaction makecache provides reinstall remove repolist search shell update upgrade version ) local i c cmd subcmd for (( i=1; i < ${#words[@]}-1; i++ )) ; do [[ -n $cmd ]] && subcmd=${words[i]} && break # Recognize additional commands and aliases for c in ${cmds[@]} check-rpmdb distribution-synchronization erase \ group groupinfo groupinstall grouplist groupremove groupupdate \ grouperase install-na load-ts localinstall localupdate whatprovides ; do [[ ${words[i]} == $c ]] && cmd=$c && break done done case $cmd in check|check-rpmdb) COMPREPLY=( $( compgen -W 'dependencies duplicates all' \ -- "$cur" ) ) return 0 ;; check-update|makecache|resolvedep) return 0 ;; clean) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W 'expire-cache packages headers metadata cache dbcache all' -- "$cur" ) ) return 0 ;; deplist) COMPREPLY=( $( compgen -f -o plusdirs -X '!*.[rs]pm' -- "$cur" ) ) _yum_list all "$cur" return 0 ;; distro-sync|distribution-synchronization) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W 'full different' -- "$cur" ) ) _yum_list installed "$cur" return 0 ;; downgrade|reinstall) if ! _yum_atgroups "$cur" ; then _yum_binrpmfiles "$cur" _yum_list installed "$cur" fi return 0 ;; erase|remove) _yum_atgroups "$cur" || _yum_list installed "$cur" return 0 ;; group*) if [[ ($cmd == groups || $cmd == group) && $prev == $cmd ]] ; then COMPREPLY=( $( compgen -W 'info install list remove summary' \ -- "$cur" ) ) else _yum_helper groups list all "$cur" fi return 0 ;; help) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) return 0 ;; history) if [[ $prev == $cmd ]] ; then COMPREPLY=( $( compgen -W 'info list packages-list packages-info summary addon-info redo undo rollback new sync stats' -- "$cur" ) ) return 0 fi case $subcmd in undo|repeat|addon|addon-info|rollback) if [[ $prev == $subcmd ]]; then COMPREPLY=( $( compgen -W "last" -- "$cur" ) ) _yum_transactions fi ;; redo) case $prev in redo) COMPREPLY=( $( compgen -W "force-reinstall force-remove last" -- "$cur" ) ) _yum_transactions ;; reinstall|force-reinstall|remove|force-remove) COMPREPLY=( $( compgen -W "last" -- "$cur" ) ) _yum_transactions ;; esac ;; package-list|pkg|pkgs|pkg-list|pkgs-list|package|packages|\ packages-list|pkg-info|pkgs-info|package-info|packages-info) _yum_list available "$cur" ;; info|list|summary) if [[ $subcmd != info ]] ; then COMPREPLY=( $( compgen -W "all" -- "$cur" ) ) [[ $cur != all ]] && _yum_list available "$cur" else _yum_list available "$cur" fi _yum_transactions ;; sync|synchronize) _yum_list installed "$cur" ;; esac return 0 ;; info) _yum_list all "$cur" return 0 ;; install) if ! _yum_atgroups "$cur" ; then _yum_binrpmfiles "$cur" _yum_list available "$cur" fi return 0 ;; install-na) _yum_list available "$cur" return 0 ;; list) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- "$cur" ) ) return 0 ;; load-transaction|load-ts) COMPREPLY=( $( compgen -f -o plusdirs -X '!*.yumtx' -- "$cur" ) ) return 0 ;; localinstall|localupdate) _yum_binrpmfiles "$cur" return 0 ;; provides|whatprovides) COMPREPLY=( $( compgen -f -o plusdirs -- "$cur" ) ) return 0 ;; repolist) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W 'all enabled disabled' -- "$cur" ) ) return 0 ;; search) [[ $prev == $cmd ]] && COMPREPLY=( $( compgen -W 'all' -- "$cur" ) ) return 0 ;; shell) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -f -o plusdirs -- "$cur" ) ) return 0 ;; update|upgrade) if ! _yum_atgroups "$cur" ; then _yum_binrpmfiles "$cur" _yum_list updates "$cur" fi return 0 ;; version) [[ $prev == $cmd ]] && \ COMPREPLY=( $( compgen -W 'all installed available nogroups grouplist groupinfo' -- "$cur" ) ) return 0 ;; esac local split=false declare -F _split_longopt &>/dev/null && _split_longopt && split=true _yum_complete_baseopts "$cur" "$prev" && return 0 $split && return 0 if [[ $cur == -* ]] ; then COMPREPLY=( $( compgen -W '$( _yum_baseopts )' -- "$cur" ) ) return 0 fi COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) ) } && complete -F _yum -o filenames yum yummain.py # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh completions/look 0000644 00000001074 15122360056 0007771 0 ustar 00 _look_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--terminate') COMPREPLY=( $(compgen -W "char" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--alternative --alphanum --ignore-case --terminate --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _look_module look completions/losetup 0000644 00000002740 15122360056 0010521 0 ustar 00 _losetup_module() { local cur prev OPTS ARG COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--detach') ARG="$(losetup --output NAME | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-j'|'--associated') ARG="$(losetup --output BACK-FILE | awk '{if (1 < NR) {print}}')" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-c'|'--set-capacity') ARG="$(for I in /dev/loop[0-9]*; do if [ -e $I ]; then echo $I; fi; done)" COMPREPLY=( $(compgen -W "$ARG" -- $cur) ) return 0 ;; '-o'|'--offset'|'--sizelimit') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-O'|'--output') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="NAME AUTOCLEAR BACK-FILE BACK-INO BACK-MAJ:MIN MAJ:MIN OFFSET PARTSCAN RO SIZELIMIT" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --detach --detach-all --find --set-capacity --associated --list --offset --output --sizelimit --partscan --read-only --show --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 _losetup_module losetup completions/tuned-adm 0000644 00000000777 15122360056 0010714 0 ustar 00 # bash completion for tuned-adm _tuned_adm() { local commands="active list off profile recommend verify" local cur prev words cword _init_completion || return if [[ "$cword" -eq 1 ]]; then COMPREPLY=( $(compgen -W "$commands" -- "$cur" ) ) elif [[ "$cword" -eq 2 && "$prev" == "profile" ]]; then COMPREPLY=( $(compgen -W "$(command find /usr/lib/tuned /etc/tuned -mindepth 1 -maxdepth 1 -type d -printf "%f\n")" -- "$cur" ) ) else COMPREPLY=() fi return 0 } && complete -F _tuned_adm tuned-adm completions/lsblk 0000644 00000002704 15122360056 0010135 0 ustar 00 _lsblk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-e'|'--exclude'|'-I'|'--include') local MAJOR I J MAJOR='' for I in /sys/dev/block/*; do J=${I##*/} MAJOR="$MAJOR ${J%%:*}" done # FIXME: how to append to a string with compgen? compopt -o nospace COMPREPLY=( $(compgen -W "$MAJOR" -S ',' -- $cur) ) return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? OUTPUT="NAME KNAME MAJ:MIN FSTYPE MOUNTPOINT LABEL UUID PARTLABEL PARTUUID RA RO RM MODEL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO WSAME WWN RAND PKNAME HCTL TRAN REV VENDOR" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --bytes --nodeps --discard --exclude --fs --help --include --ascii --list --perms --noheadings --output --pairs --raw --inverse --topology --scsi --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS=''; while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _lsblk_module lsblk completions/firewall-cmd 0000644 00000024145 15122360056 0011377 0 ustar 00 # bash completion for firewall-cmd -*- shell-script -*- # Copyright (C) 2013 Red Hat, Inc. # # Authors: # Jiri Popelka
# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see
. # # TODO: find a way how to get the following options from firewall-cmd OPTIONS_LOCKDOWN="--add-lockdown-whitelist-command= --remove-lockdown-whitelist-command= \ --query-lockdown-whitelist-command= --list-lockdown-whitelist-commands \ --add-lockdown-whitelist-context= --remove-lockdown-whitelist-context= \ --query-lockdown-whitelist-context= --list-lockdown-whitelist-contexts \ --add-lockdown-whitelist-uid= --remove-lockdown-whitelist-uid= \ --query-lockdown-whitelist-uid= --list-lockdown-whitelist-uids \ --add-lockdown-whitelist-user= --remove-lockdown-whitelist-user= \ --query-lockdown-whitelist-user= --list-lockdown-whitelist-users" # can be used as standalone or with --permanent OPTIONS_CONFIG="--get-zones --get-services --get-icmptypes --get-helpers \ ${OPTIONS_LOCKDOWN} --list-all-zones \ --info-zone= --info-service= --info-icmptype= \ --info-ipset= --info-helper=" OPTIONS_ZONE_INTERFACES_SOURCES="\ --add-interface= --remove-interface= --query-interface= \ --list-interfaces --change-interface= --change-zone= \ --add-source= --remove-source= --query-source= \ --change-source= --list-sources" OPTIONS_ZONE_ACTION_ACTION="--add-service= --remove-service= --query-service= \ --add-port= --remove-port= --query-port= \ --add-source-port= --remove-source-port= --query-source-port= \ --add-protocol= --remove-protocol= --query-protocol= \ --add-icmp-block= --remove-icmp-block= --query-icmp-block= \ --add-forward-port= --remove-forward-port= --query-forward-port=" OPTIONS_ZONE_ADAPT_QUERY="--add-rich-rule= --remove-rich-rule= --query-rich-rule= \ --add-icmp-block-inversion --remove-icmp-block-inversion \ --query-icmp-block-inversion \ --add-masquerade --remove-masquerade --query-masquerade \ --list-services --list-ports --list-protocols \ --list-source-ports --list-icmp-blocks \ --list-forward-ports --list-rich-rules --list-all" OPTIONS_ZONE_PERMANENT_ONLY="--get-description --get-short \ --set-description= --set-short=" OPTIONS_IPSET_ACTION_ACTION="--add-entry= --remove-entry= --query-entry= --add-entries-from-file= --remove-entries-from-file" OPTIONS_IPSET_ADAPT_QUERY="--list-entries" # can be used with/without preceding --zone=
OPTIONS_ZONE="${OPTIONS_ZONE_INTERFACES_SOURCES} \ ${OPTIONS_ZONE_ACTION_ACTION} ${OPTIONS_ZONE_ADAPT_QUERY} ${OPTIONS_ZONE_PERMANENT_ONLY}" OPTIONS_IPSET="${OPTIONS_IPSETACTION_ACTION} ${OPTIONS_IPSET_ADAPT_QUERY}" OPTIONS_PERMANENT_ONLY="--new-icmptype= --new-icmptype-from-file= --delete-icmptype= \ --new-service= --new-service-from-file= --delete-service= \ --new-zone= --new-zone-from-file= --delete-zone= \ --new-ipset= --new-helper-from-file= --delete-ipset= \ --new-helper= --new-helper-from-file= --delete-helper= \ --get-target --set-target= \ --path-zone= --path-service= --path-icmptype= \ --path-ipset= --path-helper=" OPTIONS_NEW_IPSET="--type= --option=" OPTIONS_NEW_HELPER="--module= --family=" OPTIONS_HELPER="" # can be used after --permanent OPTIONS_PERMANENT="${OPTIONS_CONFIG} --zone= ${OPTIONS_ZONE} \ ${OPTIONS_PERMANENT_ONLY}" OPTIONS_DIRECT="--passthrough \ --add-chain --remove-chain --query-chain --get-chains --get-all-chains \ --add-rule --remove-rule --remove-rules --query-rule --get-rules --get-all-rules \ --add-passthrough --remove-passthrough \ --query-passthrough --get-passthroughs --get-all-passthroughs" # these all can be used as a "first" option OPTIONS_GENERAL="--help --version \ --state --reload --complete-reload \ --panic-on --panic-off --query-panic \ --get-log-denied --set-log-denied= --get-ipset-types \ --lockdown-on --lockdown-off --query-lockdown \ --get-default-zone --set-default-zone= --get-active-zones \ --get-zone-of-interface= --get-zone-of-interface= \ ${OPTIONS_CONFIG} \ --zone= ${OPTIONS_ZONE} \ --permanent --direct" _firewall_cmd() { local cur prev words cword split _init_completion -s || return case $prev in --*-entries-from-file|--new-*-from-file) _filedir return ;; --new-ipset*) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_IPSET}" -- "$cur") ) fi ;; --new-helper*) if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_HELPER}" -- "$cur") ) fi ;; --new-*) ;; --zone|--set-default-zone|--info-zone|--path-zone) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-zones`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-zones`' -- "$cur" ) ) fi ;; --zone=*) COMPREPLY=( $( compgen -W "${OPTIONS_ZONE}" -- "$cur" ) ) ;; --ipset=*) COMPREPLY=( $( compgen -W "${OPTIONS_IPSET}" -- "$cur" ) ) ;; --*-ipset) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-ipsets`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-ipsets`' -- "$cur" ) ) fi ;; --*-service) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-services`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-services`' -- "$cur" ) ) fi ;; --helper|--info-helper|--path-helper) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-helpers`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-helpers`' -- "$cur" ) ) fi ;; --helper=*) COMPREPLY=( $( compgen -W "${OPTIONS_HELPER}" -- "$cur" ) ) ;; --*-icmp-block|--info-icmptype|--path-icmptype) if [[ ${words[@]} == *--permanent* ]]; then COMPREPLY=( $( compgen -W '`firewall-cmd --permanent --get-icmptypes`' -- "$cur" ) ) else COMPREPLY=( $( compgen -W '`firewall-cmd --get-icmptypes`' -- "$cur" ) ) fi ;; --list-services|--add-service=*|--remove-service=*|--query-service=*|\ --list-ports|--add-port=*|--remove-port=*|--query-port=*|\ --list-source-ports|--add-source-port=*|--remove-source-port=*|--query-source-port=*|\ --list-protocols|--add-protocol=*|--remove-protocol=*|--query-protocol=*|\ --list-icmp-blocks|--add-icmp-block=*|--remove-icmp-block=*|--query-icmp-block=*|\ --list-forward-ports|--add-forward-port=*|--remove-forward-port=*|--query-forward-port=*|\ --list-interfaces|--add-interface=*|--remove-interface=*|--query-interface=*|\ --list-sources|--add-source=*|--remove-source=*|--query-source=*|\ --add-masquerade|--remove-masquerade|--query-masquerade|--list-all|\ --get-description|--get-short|--set-description=*|--set-short=*) opts="" # --add and --remove can be used multiple times if [[ ( ${prev} == --add-* ) || ( ${prev} == --remove-* ) ]]; then [[ ${prev} == *=* ]] && opts="${prev%=*}=" || opts="${prev}" fi if [[ ! ${words[@]} == *--permanent* ]]; then opts="${opts} --permanent" [[ ${prev} == --add-* ]] && opts="${opts} --timeout=" fi [[ ! ${words[@]} == *--zone=* ]] && opts="${opts} --zone=" if [ -n "${opts}" ]; then COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) fi ;; --*-interface|--change-zone) _available_interfaces ;; --permanent) [[ ${words[@]} == *--direct* ]] && opts="${OPTIONS_DIRECT}" || opts="${OPTIONS_PERMANENT} --direct" COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) ;; --direct) [[ ${words[@]} == *--permanent* ]] && opts="${OPTIONS_DIRECT}" || opts="${OPTIONS_DIRECT} --permanent" COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) ) ;; --*-rich-rule) # to not be matched with --*-rule below return 0 ;; --passthrough|--*-chain|--get-chains|--*-rule|--get-rules|--remove-rules) COMPREPLY=( $( compgen -W 'ipv4 ipv6 eb' -- "$cur" ) ) ;; ipv4|ipv6|eb) if [[ ${words[@]} == *--passthrough* ]]; then return 0 else COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) fi ;; *) if [[ "$cur" == -* ]]; then if [[ ${words[@]} == *--new-ipset* ]]; then COMPREPLY=( $( compgen -W "${OPTIONS_NEW_IPSET}" -- "$cur") ) else COMPREPLY=( $( compgen -W "${OPTIONS_GENERAL}" -- "$cur") ) fi fi ;; esac # do not append a space to words that end with = [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _firewall_cmd firewall-cmd completions/lscpu 0000644 00000001475 15122360056 0010160 0 ustar 00 _lscpu_module() { local cur OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--extended'|'=') cur=${cur#=} # FIXME: how to append to a string with compgen? OPTS="CPU, CORE, SOCKET, NODE, BOOK, CACHE, POLARIZATION, ADDRESS, CONFIGURED, ONLINE," compopt -o nospace COMPREPLY=( $(compgen -W "$OPTS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --online --offline --extended= --parse= --sysroot --hex --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _lscpu_module lscpu completions/semanage 0000644 00000014651 15122360056 0010612 0 ustar 00 # This file is part of systemd. # # Copyright 2011-2013 Dan Walsh # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with systemd; If not, see
. __contains_word () { local word=$1; shift for w in $*; do [[ $w = $word ]] && return 0; done return 1 } ALL_OPTS='-l --list -S -o -n --noheading -h --help' MANAGED_OPTS='-a --add -m --modify -d --delete -D --deleteall -C --locallist ' __get_all_stores () { dir -1 -F /etc/selinux/ | grep '/' | cut -d'/' -f 1 } __get_all_ftypes () { echo '-- -d -c -b -s -l -p' } __get_all_users () { seinfo -u 2> /dev/null | tail -n +3 } __get_all_types () { seinfo -t 2> /dev/null | tail -n +3 } __get_all_port_types () { seinfo -aport_type -x 2>/dev/null | tail -n +2 } __get_all_domains () { seinfo -adomain -x 2>/dev/null | tail -n +2 } __get_all_node_types () { seinfo -anode_type -x 2>/dev/null | tail -n +2 } __get_all_file_types () { seinfo -afile_type -x 2>/dev/null | tail -n +2 } __get_all_roles () { seinfo -r 2> /dev/null | tail -n +3 } __get_all_stores () { dir -1 -F /etc/selinux/ | grep '/' | cut -d'/' -f 1 } __get_import_opts () { echo '$ALL_OPTS --f --input_file' ; } __get_export_opts () { echo '$ALL_OPTS --f --output_file' ; } __get_boolean_opts () { echo '$ALL_OPTS --on -off -1 -0' ; } __get_user_opts () { echo '$ALL_OPTS $MANAGED_OPTS -L --level -r --range -R --role '; } __get_login_opts () { echo '$ALL_OPTS $MANAGED_OPTS -s --seuser -r --range'; } __get_port_opts () { echo '$ALL_OPTS $MANAGED_OPTS -t -type -r --range -p --proto'; } __get_interface_opts () { echo '$ALL_OPTS $MANAGED_OPTS -t --type '; } __get_node_opts () { echo '$ALL_OPTS $MANAGED_OPTS -t --type -M --mask -p --proto'; } __get_fcontext_opts () { echo '$ALL_OPTS $MANAGED_OPTS -t --type -e --equal -f --ftype '; } __get_module_opts () { echo '$ALL_OPTS $MANAGED_OPTS --enable --disable '; } __get_dontaudit_opts () { echo '-S on off' ; } __get_permissive_opts () { echo '$ALL_OPTS -a --add -d --delete' ; } _semanage () { local command=${COMP_WORDS[1]} local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local verb comps local -A VERBS=( [BOOLEAN]='boolean' [DONTAUDIT]='dontaudit' [EXPORT]='export' [FCONTEXT]='fcontext' [IMPORT]='import' [INTERFACE]='interface' [LOGIN]='login' [MODULE]='module' [NODE]='node' [PERMISSIVE]='permissive' [PORT]='port' [USER]='user' ) if [ "$prev" = "-a" -a "$command" = "permissive" ]; then COMPREPLY=( $(compgen -W "$( __get_all_domains ) " -- "$cur") ) return 0 fi if [ "$verb" = "" -a "$prev" = "semanage" ]; then comps="${VERBS[*]}" elif [ "$verb" = "" -a "$prev" = "-S" -o "$prev" = "--store" ]; then COMPREPLY=( $(compgen -W "$( __get_all_stores ) " -- "$cur") ) return 0 elif [ "$verb" = "" -a "$prev" = "-p" -o "$prev" = "--proto" ]; then COMPREPLY=( $(compgen -W "tcp udp" -- "$cur") ) return 0 elif [ "$verb" = "" -a "$prev" = "-R" -o "$prev" = "-r" -o "$prev" = "--role" ]; then if [ "$command" != "user" -o "$prev" != "-r" ]; then COMPREPLY=( $(compgen -W "$( __get_all_roles ) " -- "$cur") ) return 0 else return 0 fi elif [ "$verb" = "" -a "$prev" = "-s" -o "$prev" = "--seuser" ]; then COMPREPLY=( $(compgen -W "$( __get_all_users ) " -- "$cur") ) return 0 elif [ "$verb" = "" -a "$prev" = "-f" -o "$prev" = "--ftype" ]; then COMPREPLY=( $(compgen -W "$( __get_all_ftypes ) " -- "$cur") ) return 0 elif [ "$verb" = "" -a "$prev" = "-t" -o "$prev" = "--types" ]; then if [ "$command" = "port" ]; then COMPREPLY=( $(compgen -W "$( __get_all_port_types ) " -- "$cur") ) return 0 fi if [ "$command" = "fcontext" ]; then COMPREPLY=( $(compgen -W "$( __get_all_file_types ) " -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W "$( __get_all_types ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[LOGIN]} ; then COMPREPLY=( $(compgen -W "$( __get_login_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[USER]} ; then COMPREPLY=( $(compgen -W "$( __get_user_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[PORT]} ; then COMPREPLY=( $(compgen -W "$( __get_port_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[INTERFACE]} ; then COMPREPLY=( $(compgen -W "$( __get_interface_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[MODULE]} ; then COMPREPLY=( $(compgen -W "$( __get_module_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[NODE]} ; then COMPREPLY=( $(compgen -W "$( __get_node_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[FCONTEXT]} ; then COMPREPLY=( $(compgen -W "$( __get_fcontext_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[BOOLEAN]} ; then COMPREPLY=( $(compgen -W "$( __get_boolean_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[PERMISSIVE]} ; then COMPREPLY=( $(compgen -W "$( __get_permissive_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[DONTAUDIT]} ; then COMPREPLY=( $(compgen -W "$( __get_dontaudit_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[IMPORT]} ; then COMPREPLY=( $(compgen -W "$( __get_import_opts ) " -- "$cur") ) return 0 elif __contains_word "$command" ${VERBS[EXPORT]} ; then COMPREPLY=( $(compgen -W "$( __get_export_opts ) " -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W "$comps" -- "$cur") ) return 0 } complete -F _semanage semanage completions/lslocks 0000644 00000001752 15122360056 0010502 0 ustar 00 _lslocks_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid') local PIDS # /proc/locks can have 8 to 9 fields, see commit # 55c0d16bab8cc84b72bf11cb2fdd8aa6205ac608 PIDS="$(awk '{print $(NF-3)}' /proc/locks)" COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--pid --output --noheadings --raw --notruncate --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _lslocks_module lslocks completions/setsebool 0000644 00000003430 15122360056 0011022 0 ustar 00 # This file is part of systemd. # # Copyright 2011 Dan Walsh # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with systemd; If not, see
. __contains_word () { local word=$1; shift for w in $*; do [[ $w = $word ]] && return 0; done return 1 } __get_all_booleans () { getsebool -a | cut -f1 -d' ' } _setsebool () { local command=${COMP_WORDS[1]} local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local verb comps if [ "$verb" = "" -a "$prev" = "setsebool" -o "$prev" = "-P" ]; then COMPREPLY=( $(compgen -W "-P $( __get_all_booleans ) " -- "$cur") ) return 0 fi COMPREPLY=( $(compgen -W "0 1 -P" -- "$cur") ) return 0 } _getsebool () { local command=${COMP_WORDS[1]} local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local verb comps if [ "$verb" = "" -a "$prev" == "getsebool" ]; then COMPREPLY=( $(compgen -W "-a $( __get_all_booleans ) " -- "$cur") ) return 0 fi if [ "$verb" = "" -a "$prev" != "-a" ]; then COMPREPLY=( $(compgen -W "$( __get_all_booleans ) " -- "$cur") ) return 0 fi return 0 } complete -F _setsebool setsebool complete -F _getsebool getsebool completions/mcookie 0000644 00000000766 15122360056 0010462 0 ustar 00 _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 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--file --verbose --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac return 0 } complete -F _mcookie_module mcookie completions/mkfs 0000644 00000001264 15122360056 0007766 0 ustar 00 _mkfs_module() { local cur prev OPTS DEVS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--type') FSTYPES=$(for I in /sbin/mkfs.* /usr/sbin/mkfs.*; do if [ -e $I ]; then echo ${I##*mkfs.}; fi; done) COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS='--type --verbose --help --version' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) ) return 0 } complete -F _mkfs_module mkfs completions/mkfs.cramfs 0000644 00000001465 15122360056 0011243 0 ustar 00 _mkfs.cramfs_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-b') COMPREPLY=( $(compgen -W "blksize" -- $cur) ) return 0 ;; '-e') COMPREPLY=( $(compgen -W "edition" -- $cur) ) return 0 ;; '-N') COMPREPLY=( $(compgen -W "big little host" -- $cur) ) return 0 ;; '-i') COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-n') COMPREPLY=( $(compgen -W "name" -- $cur) ) return 0 ;; '-h'|'-V') return 0 ;; esac case $cur in -*) OPTS="-h -v -E -b -e -N -i -n -p -s -z" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _mkfs.cramfs_module mkfs.cramfs completions/mkfs.minix 0000644 00000001314 15122360056 0011105 0 ustar 00 _mkfs.minix_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-i') COMPREPLY=( $(compgen -W "inodes" -- $cur) ) return 0 ;; '-l') COMPREPLY=( $(compgen -W "badblocks-file" -- $cur) ) return 0 ;; '-n') COMPREPLY=( $(compgen -W "14 30" -- $cur) ) return 0 ;; '-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="-c -i -l -n -1 -2 -3" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name) COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _mkfs.minix_module mkfs.minix completions/mkswap 0000644 00000001375 15122360056 0010333 0 ustar 00 _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'|'-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--check --force --pagesize --label --swapversion --uuid --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _mkswap_module mkswap completions/more 0000644 00000001020 15122360056 0007756 0 ustar 00 _more_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-V') return 0 ;; esac case $cur in -*) OPTS="-d -f -l -p -c -u -s -number -V" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; +*) OPTS="+number +/string" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _more_module more completions/mountpoint 0000644 00000001072 15122360056 0011237 0 ustar 00 _mountpoint_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--fixme') COMPREPLY=( $(compgen -W "fixme" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--quiet --fs-devno --devno --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 } complete -F _mountpoint_module mountpoint completions/namei 0000644 00000000764 15122360056 0010123 0 ustar 00 _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 completions/nsenter 0000644 00000001673 15122360056 0010510 0 ustar 00 _nsenter_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-t'|'--target') local PIDS PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-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="--target --mount= --uts= --ipc= --net= --pid= --user= --root= --wd= --no-fork --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _nsenter_module nsenter completions/partx 0000644 00000002114 15122360056 0010157 0 ustar 00 _partx_module() { local cur prev OPTS OUTPUT COMPREPLY=() OUTPUT="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME" cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-n'|'--nr') return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-t'|'--type') # FIXME: some command should list type libblkid knows. COMPREPLY=( $(compgen -W "aix bsd dos gpt mac minix sgi solaris_x86 sun ultrix unixware" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--add --delete --show --update --bytes --noheadings --nr --output --pairs --raw --type --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 } complete -F _partx_module partx completions/pivot_root 0000644 00000000603 15122360056 0011226 0 ustar 00 _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 completions/prlimit 0000644 00000002244 15122360056 0010505 0 ustar 00 _prlimit_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid') PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-o'|'--output') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="DESCRIPTION RESOURCE SOFT HARD UNITS" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-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 completions/raw 0000644 00000000742 15122360056 0007617 0 ustar 00 _raw_module() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) local OPTS OPTS="--query --all --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "$(for I in /dev/raw/*; do if [ -e $I ]; then echo $I; fi; done)" -- $cur) ) return 0 } complete -F _raw_module raw completions/readprofile 0000644 00000001247 15122360056 0011323 0 ustar 00 _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 completions/rename 0000644 00000001170 15122360056 0010271 0 ustar 00 _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" 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 completions/renice 0000644 00000001454 15122360056 0010274 0 ustar 00 _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=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) return 0 ;; '-u'|'--user') COMPREPLY=( $(compgen -u -- $cur) ) return 0 ;; '-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 completions/rev 0000644 00000000660 15122360056 0007621 0 ustar 00 _rev_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _rev_module rev completions/script 0000644 00000001233 15122360056 0010326 0 ustar 00 _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 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} ;; -*) OPTS="--append --command --return --flush --force --quiet --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 completions/tailf 0000644 00000001022 15122360056 0010115 0 ustar 00 _tailf_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-n'|'--lines') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--lines --version --help" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 } complete -F _tailf_module tailf completions/scriptreplay 0000644 00000001120 15122360056 0011536 0 ustar 00 _scriptreplay_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-d'|'--divisor') COMPREPLY=( $(compgen -W "digit" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--timing --typescript --divisor --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 completions/setarch 0000644 00000001407 15122360056 0010456 0 ustar 00 _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 "$(setarch --list)" -- $cur) ) return 0 fi case $cur in -*) OPTS="--verbose --addr-no-randomize --fdpic-funcptrs --mmap-page-zero --addr-compat-layout --read-implies-exec --32bit --short-inode --whole-seconds --sticky-timeouts --3gb --4gb --uname-2.6 --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setarch_module setarch completions/setpriv 0000644 00000003737 15122360056 0010531 0 ustar 00 _setpriv_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '--inh-caps'|'--bounding-set') # FIXME: how to append to a string with compgen? local INHERIT INHERIT=$(setpriv --list-caps| awk '{print $1, "-" $1}') compopt -o nospace COMPREPLY=( $(compgen -W "all $INHERIT" -S ',' -- $cur) ) return 0 ;; '--ruid'|'--euid'|'--reuid') local UIDS UIDS=$(getent passwd | awk -F: '{print $3}') COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) return 0 ;; '--rgid'|'--egid'|'--regid') local GIDS GIDS=$(getent group | awk -F: '{print $3}') COMPREPLY=( $(compgen -W "$GIDS" -- $cur) ) return 0 ;; '--groups') # FIXME: how to append to a string with compgen? local GIDS GIDS=$(getent group | awk -F: '{print $3}') compopt -o nospace COMPREPLY=( $(compgen -W "$GIDS" -S ',' -- $cur) ) return 0 ;; '--securebits') local SBITS SBITS="noroot noroot_locked no_setuid_fixup no_setuid_fixup_locked keep_caps_locked -noroot -noroot_locked -no_setuid_fixup -no_setuid_fixup_locked -keep_caps_locked" COMPREPLY=( $(compgen -W "$SBITS" -- $cur) ) return 0 ;; '--selinux-label') # FIXME: how to list selinux labels? COMPREPLY=( $(compgen -W "label" -- $cur) ) return 0 ;; '--apparmor-profile') # FIXME: how to list apparmor profiles? COMPREPLY=( $(compgen -W "profile" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--dump --no-new-privs --inh-caps --bounding-set --ruid --euid --rgid --egid --reuid --regid --clear-groupsclear --keep-groupskeep --groups --securebits --selinux-label --apparmor-profile --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setpriv_module setpriv completions/setsid 0000644 00000000661 15122360056 0010321 0 ustar 00 _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 --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac compopt -o bashdefault COMPREPLY=( $(compgen -c -- $cur) ) return 0 } complete -F _setsid_module setsid completions/setterm 0000644 00000004371 15122360056 0010513 0 ustar 00 _setterm_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-term') local TERM_LIST I TERM_LIST='' for I in /usr/share/terminfo/?/*; do TERM_LIST+="${I##*/} " done COMPREPLY=( $(compgen -W "$TERM_LIST" -- $cur) ) return 0 ;; '-foreground'|'-background'|'-ulcolor'|'-hbcolor') COMPREPLY=( $(compgen -W "default black blue cyan green magenta red white yellow" -- $cur) ) return 0 ;; '-cursor'|'-repeat'|'-appcursorkeys'|'-linewrap'|'-inversescreen'|'-bold'|'-half-bright'|'-blink'|'-reverse'|'-underline'|'-msg') COMPREPLY=( $(compgen -W "off on" -- $cur) ) return 0 ;; '-clear') COMPREPLY=( $(compgen -W "all rest" -- $cur) ) return 0 ;; '-tabs'|'-clrtabs') COMPREPLY=( $(compgen -W "tab1 tab2 tab3 tab160" -- $cur) ) return 0 ;; '-regtabs') COMPREPLY=( $(compgen -W "{1..160}" -- $cur) ) return 0 ;; '-blank') COMPREPLY=( $(compgen -W "{0..60} force poke" -- $cur) ) return 0 ;; '-dump'|'-append') local NUM_CONS NUM_CONS=(/sys/class/tty/*) 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 "{1..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 -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 completions/sfdisk 0000644 00000002650 15122360056 0010311 0 ustar 00 _sfdisk_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-u'|'--unit') COMPREPLY=( $(compgen -W "S C B M" -- $cur) ) return 0 ;; '-n'|'-C'|'--cylinders'|'-H'|'--heads'|'-S'|'--sectors') COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 ;; '-O'|'-I') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-h'|'--help'|'-v'|'--version') return 0 ;; esac case $cur in '=') cur=${cur#=} ;; -*) OPTS="--show-size --id --change-id --print-id --list --dump --increment --unit --one-only --list-types --DOS --DOS-extended --re-read -N -n -O -I --verify --version --help --force --no-reread --quiet --Linux --show-geometry --show-pt-geometry --activate= --unhide= --show-extended --leave-last --IBM --in-order --not-in-order --inside-outer --not-inside-outer --nested --chained --onesector --cylinders --heads --sectors" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEV TYPE DEVICES='' while read DEV TYPE; do [ $TYPE = 'disk' ] && DEVICES+="$DEV " done < <(lsblk -pnro name,type) COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) ) return 0 } complete -F _sfdisk_module sfdisk completions/swaplabel 0000644 00000001173 15122360056 0010777 0 ustar 00 _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 completions/swapon 0000644 00000002505 15122360056 0010334 0 ustar 00 _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') # FIXME: how to append to a string with compgen? local OUTPUT OUTPUT="NAME TYPE SIZE USED PRIO" compopt -o nospace COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) ) return 0 ;; '-U') local UUIDS UUIDS="$(lsblk -nrp -o FSTYPE,UUID | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) ) return 0 ;; '-L') local LABELS LABELS="$(lsblk -nrp -o FSTYPE,LABEL | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$LABELS" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version') return 0 ;; esac case $cur in -*) OPTS="--all --discard --ifexists --fixpgsz --priority --summary --show --noheadings --raw --bytes --verbose --help --version" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac local DEVS DEVS="$(lsblk -nrp -o FSTYPE,NAME | awk '$1 ~ /swap/ { print $2 }')" COMPREPLY=( $(compgen -W "$DEVS" -- $cur) ) return 0 } complete -F _swapon_module swapon