?? bash_completion
字號:
_filedir return 0}complete -F _find $filenames find# Linux iwconfig(8) completion#[ $UNAME = Linux ] && have iwconfig &&_iwconfig(){ local cur prev COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in mode) COMPREPLY=( $( compgen -W 'managed ad-hoc master \ repeater secondary monitor' -- $cur ) ) return 0 ;; essid) COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) if [ -n "${COMP_IWLIST_SCAN:-}" ]; then COMPREPLY=( "${COMPREPLY[@]}" \ $( iwlist ${COMP_WORDS[1]} scan | \ awk -F '"' '/ESSID/ {print $2}' | \ grep "^$cur" )) fi return 0 ;; nwid) COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) return 0 ;; channel) COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ awk '/^[[:space:]]*Channel/ {print $2}' | \ grep "^$cur" ) ) return 0 ;; freq) COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ awk '/^[[:space:]]*Channel/ {print $4"G"}' | \ grep "^$cur" ) ) return 0 ;; ap) COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) if [ -n "${COMP_IWLIST_SCAN:-}" ]; then COMPREPLY=( "${COMPREPLY[@]}" \ $( iwlist ${COMP_WORDS[1]} scan | \ awk -F ': ' '/Address/ {print $2}' | \ grep "^$cur" ) ) fi return 0 ;; rate) COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) ) COMPREPLY=( "${COMPREPLY[@]}" \ $( iwlist ${COMP_WORDS[1]} rate | \ awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \ grep "^$cur" ) ) return 0 ;; rts) COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) return 0 ;; frag) COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) return 0 ;; key) COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) return 0 ;; enc) COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) return 0 ;; power) COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) ) return 0 ;; txpower) COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) ) return 0 ;; retry) COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) ) return 0 ;; esac if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) else _available_interfaces -w fi else COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \ ap nick rate rts frag enc key power txpower commit' -- $cur ) ) fi} &&complete -F _iwconfig iwconfig# Linux iwlist(8) completion#[ $UNAME = Linux ] && have iwlist &&_iwlist(){ local cur prev COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) else _available_interfaces -w fi else COMPREPLY=( $( compgen -W 'scan scanning freq frequency \ channel rate bit bitrate key enc encryption power \ txpower retry ap accesspoint peers event' -- $cur ) ) fi} &&complete -F _iwlist iwlist# Linux iwspy(8) completion#[ $UNAME = Linux ] && have iwspy &&_iwspy(){ local cur COMPREPLY=() cur=`_get_cword` if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) else _available_interfaces -w fi else COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) ) fi} &&complete -F _iwspy iwspy# Linux iwpriv(8) completion#[ $UNAME = Linux ] && have iwpriv &&_iwpriv(){ local cur prev COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} case "$prev" in roam) COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) return 0 ;; port) COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) ) return 0 ;; esac if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) else _available_interfaces -w fi else COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) ) fi} &&complete -F _iwpriv iwpriv# RedHat & Debian GNU/Linux if{up,down} completion#[ $UNAME = Linux ] && { have ifup || have ifdown; } &&_ifupdown(){ local cur COMPREPLY=() cur=`_get_cword` if [ $COMP_CWORD -eq 1 ]; then _configured_interfaces COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) fi return 0} &&complete -F _ifupdown ifup ifdown[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus# Linux ipsec(8) completion (for FreeS/WAN)#[ $UNAME = Linux ] && have ipsec &&_ipsec(){ local cur COMPREPLY=() cur=`_get_cword` if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \ manual pluto ranbits rsasigkey \ setup showdefaults showhostkey spi \ spigrp tncfg whack' -- $cur ) ) return 0 fi case ${COMP_WORDS[1]} in auto) COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \ --replace --down --route --unroute \ --ready --status --rereadsecrets' \ -- $cur ) ) ;; manual) COMPREPLY=( $( compgen -W '--up --down --route --unroute \ --union' -- $cur ) ) ;; ranbits) COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \ -- $cur ) ) ;; setup) COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) ) ;; *) ;; esac return 0} &&complete -F _ipsec ipsec# Postfix completion.#have postfix && {# postfix(1)#_postfix(){ local cur prev cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $cur == '-' ]]; then COMPREPLY=(-c -D -v) return 0 fi if [[ $prev == '-c' ]]; then _filedir -d return 0 fi if [[ $prev == '-D' ]]; then COMPREPLY=( $( compgen -W 'start' -- "`get_cword`" ) ) return 0 fi COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \ "`get_cword`" ) )}complete -F _postfix postfix# postalias(1) and postmap(1)#_postmap(){ local cur prev len idx cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $cur == '-' ]]; then COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q) return 0 fi if [[ $prev == '-c' ]]; then _filedir -d return 0 fi if [[ $prev == -[dq] ]]; then return 0 fi if [[ "$cur" == *:* ]]; then COMPREPLY=( $( compgen -f -- ${cur#*:} ) ) else len=${#cur} idx=0 for pval in $( /usr/sbin/postconf -m ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]="$pval:" idx=$(($idx+1)) fi done if [[ $idx -eq 0 ]]; then COMPREPLY=( $( compgen -f -- "$cur" ) ) fi fi return 0}complete -F _postmap postmap postalias# postcat(1)#_postcat(){ local cur prev pval len idx qfile cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $cur == '-' ]]; then COMPREPLY=(-c -q -v) return 0 fi if [[ $prev == '-c' ]]; then _filedir -d return 0 fi qfile=0 for idx in "${COMP_WORDS[@]}"; do [[ "$idx" = -q ]] && qfile=1 && break done if [[ $qfile == 1 ]]; then len=${#cur} idx=0 for pval in $( mailq | \ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done return 0 else _filedir return 0 fi}complete -F _postcat postcat# postconf(1)#_postconf(){ local cur prev pval len idx eqext cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $cur == '-' ]]; then COMPREPLY=(-c -d -e -h -m -l -n -v) return 0 fi if [[ $prev == '-c' ]]; then _filedir -d return 0 fi if [[ $prev == '-e' ]]; then cur=${cur#[\"\']} eqext='=' fi len=${#cur} idx=0 for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]="$pval$eqext" idx=$(($idx+1)) fi done return 0}complete -F _postconf postconf# postsuper(1)#_postsuper(){ local cur prev pval len idx cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $cur == '-' ]]; then COMPREPLY=(-c -d -h -H -p -r -s -v) return 0 fi case $prev in -[dr]) len=${#cur} idx=0 for pval in $( echo ALL; mailq | \ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done return 0 ;; -h) len=${#cur} idx=0 for pval in $( echo ALL; mailq | \ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done return 0 ;; -H) len=${#cur} idx=0 for pval in $( echo ALL; mailq | \ sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do if [[ "$cur" == "${pval:0:$len}" ]]; then COMPREPLY[$idx]=$pval idx=$(($idx+1)) fi done return 0 ;; esac COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) ) return 0}complete -F _postsuper postsuper}# cvs(1) completion#have cvs && {set_prefix(){ [ -z ${prefix:-} ] || prefix=${cur%/*}/ [ -r ${prefix:-}CVS/Entries ] || prefix=""}get_entries(){ local IFS=$'\n' [ -r ${prefix:-}CVS/Entries ] && \ entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)}get_modules(){ if [ -n "$prefix" ]; then COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) ) else COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) ) fi}_cvs(){ local cur count mode i cvsroot cvsroots pwd local -a flags miss files entries changed newremoved COMPREPLY=() cur=`_get_cword` count=0 for i in "${COMP_WORDS[@]}"; do [ $count -eq $COMP_CWORD ] && break # Last parameter was the CVSROOT, now go back to mode selection if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then mode="" fi if [ -z "$mode" ]; then case $i in -d) mode=cvsroot cvsroot=${COMP_WORDS[((count+1))]} ;; @(ad?(d)|new)) mode=add ;; @(adm?(in)|rcs)) mode=admin ;; ann?(notate)) mode=annotate ;; @(checkout|co|get)) mode=checkout ;; @(com?(mit)|ci)) mode=commit ;; di?(f?(f))) mode=diff ;; ex?(p?(ort))) mode=export ;; ?(un)edit) mode=$i ;; hi?(s?(tory))) mode=history ;; im?(p?(ort))) mode=import ;; re?(l?(ease))) mode=release ;; ?(r)log)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -