BASH=/bin/bash BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:interactive_comments:progcomp:promptvars:sourcepath BASH_ALIASES=() BASH_ARGC=() BASH_ARGV=() BASH_CMDS=() BASH_COMPLETION=/etc/bash_completion BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d BASH_COMPLETION_DIR=/etc/bash_completion.d BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="4" [1]="2" [2]="10" [3]="1" [4]="release" [5]="i686-pc-linux-gnu") BASH_VERSION='4.2.10(1)-release' COLORTERM=gnome-terminal COLUMNS=80 COMPIZ_CONFIG_PROFILE=ubuntu COMP_WORDBREAKS=$' \t\n"\'><=;|&(:' DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-lncz133dvR,guid=94d3ca29abe66ecf830e2d320000001c DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path DESKTOP_SESSION=ubuntu DIRSTACK=() DISPLAY=:0 EUID=1000 GDMSESSION=ubuntu GNOME_DESKTOP_SESSION_ID=this-is-deprecated GNOME_KEYRING_CONTROL=/tmp/keyring-QiOPE6 GNOME_KEYRING_PID=1500 GPG_AGENT_INFO=/tmp/keyring-QiOPE6/gpg:0:1 GROUPS=() GTK_MODULES=canberra-gtk-module:canberra-gtk-module HISTCONTROL=ignoredups:ignorespace HISTFILE=/home/eren/.bash_history HISTFILESIZE=2000 HISTSIZE=1000 HOME=/home/eren HOSTNAME=eren-laptop HOSTTYPE=i686 IBUS_ENABLE_SYNC_MODE=1 IFS=$' \t\n' LANG=tr_TR.UTF-8 LESSCLOSE='/usr/bin/lesspipe %s %s' LESSOPEN='| /usr/bin/lesspipe %s' LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri LINES=24 LOGNAME=eren LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:' MACHTYPE=i686-pc-linux-gnu MAILCHECK=60 MAKEFLAGS=-I/opt/qnx650/target/qnx6/usr/include MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path OLDPWD=/home/eren OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/qnx650/host/linux/x86/usr/bin:/etc/qnx/bin:/opt/qnx650/host/linux/x86/usr/bin:/etc/qnx/bin:/opt/qnx650/host/linux/x86/usr/bin:/etc/qnx/bin:/opt/qnx650/host/linux/x86/usr/bin:/etc/qnx/bin PIPESTATUS=([0]="0") PPID=17500 PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS2='> ' PS4='+ ' PWD=/home/eren/qt-everywhere-opensource-src-4.8.2 QNX_CONFIGURATION=/etc/qnx QNX_HOST=/opt/qnx650/host/linux/x86 QNX_JAVAHOME=/opt/qnx650/_jvm QNX_TARGET=/opt/qnx650/target/qnx6 SESSION_MANAGER=local/eren-laptop:@/tmp/.ICE-unix/1509,unix/eren-laptop:/tmp/.ICE-unix/1509 SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=1 SSH_AGENT_PID=1548 SSH_AUTH_SOCK=/tmp/keyring-QiOPE6/ssh TERM=xterm UBUNTU_MENUPROXY=libappmenu.so UID=1000 USER=eren USERNAME=eren WINDOWID=52428806 XAUTHORITY=/home/eren/.Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg XDG_CURRENT_DESKTOP=Unity XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/ XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SESSION_COOKIE=082a33b98001b5a3b0f8b1740000000e-1348010696.800761-1318097927 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 _=set __KMP_REGISTERED_LIB_1586=0xb5c95414-cafe7bc0-libiomp5.a __KMP_REGISTERED_LIB_17499=0xb5c95414-cafec644-libiomp5.a __KMP_REGISTERED_LIB_17500=0xb5c95414-cafe89e8-libiomp5.a __git_all_commands= __git_diff_common_options=$'--stat --numstat --shortstat --summary\n\t\t\t--patch-with-stat --name-only --name-status --color\n\t\t\t--no-color --color-words --no-renames --check\n\t\t\t--full-index --binary --abbrev --diff-filter=\n\t\t\t--find-copies-harder\n\t\t\t--text --ignore-space-at-eol --ignore-space-change\n\t\t\t--ignore-all-space --exit-code --quiet --ext-diff\n\t\t\t--no-ext-diff\n\t\t\t--no-prefix --src-prefix= --dst-prefix=\n\t\t\t--inter-hunk-context=\n\t\t\t--patience\n\t\t\t--raw\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n' __git_fetch_options=$'\n\t--quiet --verbose --append --upload-pack --force --keep --depth=\n\t--tags --no-tags --all --prune --dry-run\n' __git_log_common_options=$'\n\t--not --all\n\t--branches --tags --remotes\n\t--first-parent --merges --no-merges\n\t--max-count=\n\t--max-age= --since= --after=\n\t--min-age= --until= --before=\n\t--min-parents= --max-parents=\n\t--no-min-parents --no-max-parents\n' __git_log_date_formats='relative iso8601 rfc2822 short local default raw' __git_log_gitk_options=$'\n\t--dense --sparse --full-history\n\t--simplify-merges --simplify-by-decoration\n\t--left-right\n' __git_log_pretty_formats='oneline short medium full fuller email raw format:' __git_log_shortlog_options=$'\n\t--author= --committer= --grep=\n\t--all-match\n' __git_merge_options=$'\n\t--no-commit --no-stat --log --no-log --squash --strategy\n\t--commit --stat --no-squash --ff --no-ff --ff-only\n' __git_merge_strategies= __git_mergetools_common=$'diffuse ecmerge emerge kdiff3 meld opendiff\n\t\t\ttkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3\n' __git_porcelain_commands= __git_send_email_confirm_options='always never auto cc compose' __git_send_email_suppresscc_options='author self cc bodycc sob cccmd body all' __git_whitespacelist='nowarn warn error error-all fix' __grub_script_check_program=grub-script-check _scp_path_esc='[][(){}<>",:;^&!$=?`|\\'\''[:space:]]' __expand_tilde_by_ref () { if [ "${!1:0:1}" = "~" ]; then if [ "${!1}" != "${!1//\/}" ]; then eval $1="${!1/%\/*}"/'${!1#*/}'; else eval $1="${!1}"; fi; fi } __get_cword_at_cursor_by_ref () { local cword words=(); __reassemble_comp_words_by_ref "$1" words cword; local i cur2; local cur="$COMP_LINE"; local index="$COMP_POINT"; for ((i = 0; i <= cword; ++i )) do while [[ "${#cur}" -ge ${#words[i]} && "${cur:0:${#words[i]}}" != "${words[i]}" ]]; do cur="${cur:1}"; ((index--)); done; if [[ "$i" -lt "$cword" ]]; then local old_size="${#cur}"; cur="${cur#${words[i]}}"; local new_size="${#cur}"; index=$(( index - old_size + new_size )); fi; done; if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then cur2=${words[cword]}; else cur2=${cur:0:$index}; fi; local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 "${words[@]}" -v $3 "$cword" -v $4 "$cur2" } __git_aliased_command () { local word cmdline=$(git --git-dir="$(__gitdir)" config --get "alias.$1"); for word in $cmdline; do case "$word" in \!gitk | gitk) echo "gitk"; return ;; \!*) : shell command alias ;; -*) : option ;; *=*) : setting env ;; git) : git itself ;; *) echo "$word"; return ;; esac; done } __git_aliases () { local i IFS=' '; for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do case "$i" in alias.*) i="${i#alias.}"; echo "${i/ */}" ;; esac; done } __git_complete_file () { __git_complete_revlist_file } __git_complete_remote_or_refspec () { local cur words cword; _get_comp_words_by_ref -n =: cur words cword; local cmd="${words[1]}"; local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; --all) case "$cmd" in push) no_complete_refspec=1 ;; fetch) COMPREPLY=(); return ;; *) ;; esac ;; -*) ;; *) remote="$i"; break ;; esac; c=$((++c)); done; if [ -z "$remote" ]; then __gitcomp "$(__git_remotes)"; return; fi; if [ $no_complete_refspec = 1 ]; then COMPREPLY=(); return; fi; [ "$remote" = "." ] && remote=; case "$cur" in *:*) case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="${cur%%:*}:" ;; esac; cur="${cur#*:}"; lhs=0 ;; +*) pfx="+"; cur="${cur#+}" ;; esac; case "$cmd" in fetch) if [ $lhs = 1 ]; then __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur"; else __gitcomp "$(__git_refs)" "$pfx" "$cur"; fi ;; pull) if [ $lhs = 1 ]; then __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"; else __gitcomp "$(__git_refs)" "$pfx" "$cur"; fi ;; push) if [ $lhs = 1 ]; then __gitcomp "$(__git_refs)" "$pfx" "$cur"; else __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"; fi ;; esac } __git_complete_revlist () { __git_complete_revlist_file } __git_complete_revlist_file () { local pfx ls ref cur; _get_comp_words_by_ref -n =: cur; case "$cur" in *..?*:*) return ;; ?*:*) ref="${cur%%:*}"; cur="${cur#*:}"; case "$cur" in ?*/*) pfx="${cur%/*}"; cur="${cur##*/}"; ls="$ref:$pfx"; pfx="$pfx/" ;; *) ls="$ref" ;; esac; case "$COMP_WORDBREAKS" in *:*) : great ;; *) pfx="$ref:$pfx" ;; esac; local IFS=' '; COMPREPLY=($(compgen -P "$pfx" -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" | sed '/^100... blob /{ s,^.* ,, s,$, , } /^120000 blob /{ s,^.* ,, s,$, , } /^040000 tree /{ s,^.* ,, s,$,/, } s/^.* //')" -- "$cur")) ;; *...*) pfx="${cur%...*}..."; cur="${cur#*...}"; __gitcomp "$(__git_refs)" "$pfx" "$cur" ;; *..*) pfx="${cur%..*}.."; cur="${cur#*..}"; __gitcomp "$(__git_refs)" "$pfx" "$cur" ;; *) __gitcomp "$(__git_refs)" ;; esac } __git_complete_strategy () { local cur prev; _get_comp_words_by_ref -n =: cur prev; __git_compute_merge_strategies; case "$prev" in -s | --strategy) __gitcomp "$__git_merge_strategies"; return 0 ;; esac; case "$cur" in --strategy=*) __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"; return 0 ;; esac; return 1 } __git_compute_all_commands () { : ${__git_all_commands:=$(__git_list_all_commands)} } __git_compute_merge_strategies () { : ${__git_merge_strategies:=$(__git_list_merge_strategies)} } __git_compute_porcelain_commands () { __git_compute_all_commands; : ${__git_porcelain_commands:=$(__git_list_porcelain_commands)} } __git_config_get_set_variables () { local words cword; _get_comp_words_by_ref -n =: words cword; local prevword word config_file= c=$cword; while [ $c -gt 1 ]; do word="${words[c]}"; case "$word" in --global | --system | --file=*) config_file="$word"; break ;; -f | --file) config_file="$word $prevword"; break ;; esac; prevword=$word; c=$((--c)); done; git --git-dir="$(__gitdir)" config $config_file --list 2> /dev/null | while read line; do case "$line" in *.*=*) echo "${line/=*/}" ;; esac; done } __git_find_on_cmdline () { local word subcommand c=1 words cword; _get_comp_words_by_ref -n =: words cword; while [ $c -lt $cword ]; do word="${words[c]}"; for subcommand in $1; do if [ "$subcommand" = "$word" ]; then echo "$subcommand"; return; fi; done; c=$((++c)); done } __git_has_doubledash () { local c=1 words cword; _get_comp_words_by_ref -n =: words cword; while [ $c -lt $cword ]; do if [ "--" = "${words[c]}" ]; then return 0; fi; c=$((++c)); done; return 1 } __git_heads () { local cmd i is_hash=y dir="$(__gitdir "${1-}")"; if [ -d "$dir" ]; then git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/heads; return; fi; for i in $(git ls-remote "${1-}" 2>/dev/null); do case "$is_hash,$i" in y,*) is_hash=n ;; n,*^{}) is_hash=y ;; n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; n,*) is_hash=y; echo "$i" ;; esac; done } __git_list_all_commands () { local i IFS=" "' '; for i in $(git help -a|egrep '^ [a-zA-Z0-9]'); do case $i in *--*) : helper pattern ;; *) echo $i ;; esac; done } __git_list_merge_strategies () { git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// s/.*:// s/^[ ]*// s/[ ]*$// p }' } __git_list_porcelain_commands () { local i IFS=" "' '; __git_compute_all_commands; for i in "help" $__git_all_commands; do case $i in *--*) : helper pattern ;; applymbox) : ask gittus ;; applypatch) : ask gittus ;; archimport) : import ;; cat-file) : plumbing ;; check-attr) : plumbing ;; check-ref-format) : plumbing ;; checkout-index) : plumbing ;; commit-tree) : plumbing ;; count-objects) : infrequent ;; cvsexportcommit) : export ;; cvsimport) : import ;; cvsserver) : daemon ;; daemon) : daemon ;; diff-files) : plumbing ;; diff-index) : plumbing ;; diff-tree) : plumbing ;; fast-import) : import ;; fast-export) : export ;; fsck-objects) : plumbing ;; fetch-pack) : plumbing ;; fmt-merge-msg) : plumbing ;; for-each-ref) : plumbing ;; hash-object) : plumbing ;; http-*) : transport ;; index-pack) : plumbing ;; init-db) : deprecated ;; local-fetch) : plumbing ;; lost-found) : infrequent ;; ls-files) : plumbing ;; ls-remote) : plumbing ;; ls-tree) : plumbing ;; mailinfo) : plumbing ;; mailsplit) : plumbing ;; merge-*) : plumbing ;; mktree) : plumbing ;; mktag) : plumbing ;; pack-objects) : plumbing ;; pack-redundant) : plumbing ;; pack-refs) : plumbing ;; parse-remote) : plumbing ;; patch-id) : plumbing ;; peek-remote) : plumbing ;; prune) : plumbing ;; prune-packed) : plumbing ;; quiltimport) : import ;; read-tree) : plumbing ;; receive-pack) : plumbing ;; remote-*) : transport ;; repo-config) : deprecated ;; rerere) : plumbing ;; rev-list) : plumbing ;; rev-parse) : plumbing ;; runstatus) : plumbing ;; sh-setup) : internal ;; shell) : daemon ;; show-ref) : plumbing ;; send-pack) : plumbing ;; show-index) : plumbing ;; ssh-*) : transport ;; stripspace) : plumbing ;; symbolic-ref) : plumbing ;; tar-tree) : deprecated ;; unpack-file) : plumbing ;; unpack-objects) : plumbing ;; update-index) : plumbing ;; update-ref) : plumbing ;; update-server-info) : daemon ;; upload-archive) : plumbing ;; upload-pack) : plumbing ;; write-tree) : plumbing ;; var) : infrequent ;; verify-pack) : infrequent ;; verify-tag) : plumbing ;; *) echo $i ;; esac; done } __git_pretty_aliases () { local i IFS=' '; for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do case "$i" in pretty.*) i="${i#pretty.}"; echo "${i/ */}" ;; esac; done } __git_ps1 () { local g="$(__gitdir)"; if [ -n "$g" ]; then local r=""; local b=""; if [ -f "$g/rebase-merge/interactive" ]; then r="|REBASE-i"; b="$(cat "$g/rebase-merge/head-name")"; else if [ -d "$g/rebase-merge" ]; then r="|REBASE-m"; b="$(cat "$g/rebase-merge/head-name")"; else if [ -d "$g/rebase-apply" ]; then if [ -f "$g/rebase-apply/rebasing" ]; then r="|REBASE"; else if [ -f "$g/rebase-apply/applying" ]; then r="|AM"; else r="|AM/REBASE"; fi; fi; else if [ -f "$g/MERGE_HEAD" ]; then r="|MERGING"; else if [ -f "$g/CHERRY_PICK_HEAD" ]; then r="|CHERRY-PICKING"; else if [ -f "$g/BISECT_LOG" ]; then r="|BISECTING"; fi; fi; fi; fi; b="$(git symbolic-ref HEAD 2>/dev/null)" || { b="$( case "${GIT_PS1_DESCRIBE_STYLE-}" in (contains) git describe --contains HEAD ;; (branch) git describe --contains --all HEAD ;; (describe) git describe HEAD ;; (* | default) git describe --tags --exact-match HEAD ;; esac 2>/dev/null)" || b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || b="unknown"; b="($b)" }; fi; fi; local w=""; local i=""; local s=""; local u=""; local c=""; local p=""; if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then c="BARE:"; else b="GIT_DIR!"; fi; else if [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then git diff --no-ext-diff --quiet --exit-code || w="*"; if git rev-parse --quiet --verify HEAD > /dev/null; then git diff-index --cached --quiet HEAD -- || i="+"; else i="#"; fi; fi; fi; if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then git rev-parse --verify refs/stash > /dev/null 2>&1 && s="$"; fi; if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then if [ -n "$(git ls-files --others --exclude-standard)" ]; then u="%"; fi; fi; if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then __git_ps1_show_upstream; fi; fi; fi; local f="$w$i$s$u"; printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"; fi } __git_ps1_show_upstream () { local key value; local svn_remote=() svn_url_pattern count n; local upstream=git legacy="" verbose=""; while read key value; do case "$key" in bash.showupstream) GIT_PS1_SHOWUPSTREAM="$value"; if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then p=""; return; fi ;; svn-remote.*.url) svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"; svn_url_pattern+="\\|$value"; upstream=svn+git ;; esac; done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n '); for option in ${GIT_PS1_SHOWUPSTREAM}; do case "$option" in git | svn) upstream="$option" ;; verbose) verbose=1 ;; legacy) legacy=1 ;; esac; done; case "$upstream" in git) upstream="@{upstream}" ;; svn*) local svn_upstream=($(git log --first-parent -1 --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)); if [[ 0 -ne ${#svn_upstream[@]} ]]; then svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}; svn_upstream=${svn_upstream%@*}; local n_stop="${#svn_remote[@]}"; for ((n=1; n <= n_stop; ++n)) do svn_upstream=${svn_upstream#${svn_remote[$n]}}; done; if [[ -z "$svn_upstream" ]]; then upstream=${GIT_SVN_ID:-git-svn}; else upstream=${svn_upstream#/}; fi; else if [[ "svn+git" = "$upstream" ]]; then upstream="@{upstream}"; fi; fi ;; esac; if [[ -z "$legacy" ]]; then count="$(git rev-list --count --left-right "$upstream"...HEAD 2>/dev/null)"; else local commits; if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"; then local commit behind=0 ahead=0; for commit in $commits; do case "$commit" in "<"*) let ++behind ;; *) let ++ahead ;; esac; done; count="$behind $ahead"; else count=""; fi; fi; if [[ -z "$verbose" ]]; then case "$count" in "") p="" ;; "0 0") p="=" ;; "0 "*) p=">" ;; *" 0") p="<" ;; *) p="<>" ;; esac; else case "$count" in "") p="" ;; "0 0") p=" u=" ;; "0 "*) p=" u+${count#0 }" ;; *" 0") p=" u-${count% 0}" ;; *) p=" u+${count#* }-${count% *}" ;; esac; fi } __git_reassemble_comp_words_by_ref () { local exclude i j first; exclude="${1//[^$COMP_WORDBREAKS]}"; cword_=$COMP_CWORD; if [ -z "$exclude" ]; then words_=("${COMP_WORDS[@]}"); return; fi; for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)) do first=t; while [ $i -gt 0 ] && [ -n "${COMP_WORDS[$i]}" ] && [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ]; do if [ $j -ge 2 ] && [ -n "$first" ]; then ((j--)); fi; first=; words_[$j]=${words_[j]}${COMP_WORDS[i]}; if [ $i = $COMP_CWORD ]; then cword_=$j; fi; if (($i < ${#COMP_WORDS[@]} - 1)); then ((i++)); else return; fi; done; words_[$j]=${words_[j]}${COMP_WORDS[i]}; if [ $i = $COMP_CWORD ]; then cword_=$j; fi; done } __git_refs () { local i is_hash=y dir="$(__gitdir "${1-}")" track="${2-}"; local cur format refs; _get_comp_words_by_ref -n =: cur; if [ -d "$dir" ]; then case "$cur" in refs | refs/*) format="refname"; refs="${cur%/*}"; track="" ;; *) for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do if [ -e "$dir/$i" ]; then echo $i; fi; done; format="refname:short"; refs="refs/tags refs/heads refs/remotes" ;; esac; git --git-dir="$dir" for-each-ref --format="%($format)" $refs; if [ -n "$track" ]; then local ref entry; git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" "refs/remotes/" | while read entry; do eval "$entry"; ref="${ref#*/}"; if [[ "$ref" == "$cur"* ]]; then echo "$ref"; fi; done | uniq -u; fi; return; fi; for i in $(git ls-remote "$dir" 2>/dev/null); do case "$is_hash,$i" in y,*) is_hash=n ;; n,*^{}) is_hash=y ;; n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;; n,*) is_hash=y; echo "$i" ;; esac; done } __git_refs2 () { local i; for i in $(__git_refs "$1"); do echo "$i:$i"; done } __git_refs_remotes () { local cmd i is_hash=y; for i in $(git ls-remote "$1" 2>/dev/null); do case "$is_hash,$i" in n,refs/heads/*) is_hash=y; echo "$i:refs/remotes/$1/${i#refs/heads/}" ;; y,*) is_hash=n ;; n,*^{}) is_hash=y ;; n,refs/tags/*) is_hash=y ;; n,*) is_hash=y ;; esac; done } __git_remotes () { local i ngoff IFS=' ' d="$(__gitdir)"; shopt -q nullglob || ngoff=1; shopt -s nullglob; for i in "$d/remotes"/*; do echo ${i#$d/remotes/}; done; [ "$ngoff" ] && shopt -u nullglob; for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do i="${i#remote.}"; echo "${i/.url*/}"; done } __git_tags () { local cmd i is_hash=y dir="$(__gitdir "${1-}")"; if [ -d "$dir" ]; then git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/tags; return; fi; for i in $(git ls-remote "${1-}" 2>/dev/null); do case "$is_hash,$i" in y,*) is_hash=n ;; n,*^{}) is_hash=y ;; n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; n,*) is_hash=y; echo "$i" ;; esac; done } __gitcomp () { local cur; _get_comp_words_by_ref -n =: cur; if [ $# -gt 2 ]; then cur="$3"; fi; case "$cur" in --*=) COMPREPLY=() ;; *) local IFS=' '; COMPREPLY=($(compgen -P "${2-}" -W "$(__gitcomp_1 "${1-}" "${4-}")" -- "$cur")) ;; esac } __gitcomp_1 () { local c IFS=' '' '' '; for c in $1; do case "$c$2" in --*=*) printf %s' ' "$c$2" ;; *.) printf %s' ' "$c$2" ;; *) printf %s' ' "$c$2 " ;; esac; done } __gitdir () { if [ -z "${1-}" ]; then if [ -n "${__git_dir-}" ]; then echo "$__git_dir"; else if [ -d .git ]; then echo .git; else git rev-parse --git-dir 2> /dev/null; fi; fi; else if [ -d "$1/.git" ]; then echo "$1/.git"; else echo "$1"; fi; fi } __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%/}/grub" } __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_get_options_from_help () { local prog; if [ $# -ge 1 ]; then prog="$1"; else prog="${COMP_WORDS[0]}"; fi; local i IFS=" "' '' '; for i in $(LC_ALL=C $prog --help); do case $i in --*) echo "${i%=*}" ;; esac; done } __grub_get_options_from_usage () { local prog; if [ $# -ge 1 ]; then prog="$1"; else prog="${COMP_WORDS[0]}"; fi; local i IFS=" "' '' '; for i in $(LC_ALL=C $prog --usage); do case $i in \[--*\]) i=${i#[}; echo ${i%%?(=*)]} ;; esac; done } __grub_list_menuentries () { local cur="${COMP_WORDS[COMP_CWORD]}"; local config_file=$(__grub_dir)/grub.cfg; if [ -f "$config_file" ]; then local IFS=' '; COMPREPLY=($(compgen -W "$( awk -F "[\"']" '/menuentry/ { print $2 }' $config_file )" -- "$cur" )); fi } __grub_list_modules () { local grub_dir=$(__grub_dir); local IFS=' '; COMPREPLY=($( compgen -f -X '!*/*.mod' -- "${grub_dir}/$cur" | { while read -r tmp; do [ -n $tmp ] && { tmp=${tmp##*/} printf '%s\n' ${tmp%.mod} } done } )) } __grubcomp () { local cur="${COMP_WORDS[COMP_CWORD]}"; if [ $# -gt 2 ]; then cur="$3"; fi; case "$cur" in --*=) COMPREPLY=() ;; *) local IFS=' '' '' '; COMPREPLY=($(compgen -P "${2-}" -W "${1-}" -S "${4-}" -- "$cur")) ;; esac } __gvfs_multiple_uris () { local IFS=' '; local cur="${COMP_WORDS[COMP_CWORD]}"; COMPREPLY=($(compgen -W '$(gvfs-ls --show-completions "$cur")' -- "")); case "$cur" in *:*) case "$COMP_WORDBREAKS" in *:*) colon_prefix=$(echo $cur | sed 's/:[^:]*$/:/' ); COMPREPLY=${COMPREPLY##${colon_prefix}} ;; esac ;; esac } __linux_fstab_unescape () { eval $1="'${!1//\'/\047}'"; eval $1="'${!1/%\\/\\\\}'"; eval "$1=$'${!1}'" } __ltrim_colon_completions () { if [[ "$1" == *:* && ( ${BASH_VERSINFO[0]} -lt 4 || ( ${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:* ) ) ]]; then local colon_word=${1%${1##*:}}; local i=${#COMPREPLY[*]}; while [ $((--i)) -ge 0 ]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}; done; fi } __reassemble_comp_words_by_ref () { local exclude i j ref; if [[ -n $1 ]]; then exclude="${1//[^$COMP_WORDBREAKS]}"; fi; eval $3=$COMP_CWORD; if [[ -n $exclude ]]; then for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)) do while [[ $i -gt 0 && -n ${COMP_WORDS[$i]} && ${COMP_WORDS[$i]//[^$exclude]} == ${COMP_WORDS[$i]} ]]; do [ $j -ge 2 ] && ((j--)); ref="$2[$j]"; eval $2[$j]=\${!ref}\${COMP_WORDS[i]}; [ $i = $COMP_CWORD ] && eval $3=$j; (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2; done; ref="$2[$j]"; eval $2[$j]=\${!ref}\${COMP_WORDS[i]}; [[ $i == $COMP_CWORD ]] && eval $3=$j; done; else eval $2=\( \"\${COMP_WORDS[@]}\" \); fi } _alias () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; case $COMP_LINE in *[^=]) COMPREPLY=($( compgen -A alias -- "$cur" )) ;; *=) COMPREPLY=("$( alias ${cur%=} 2>/dev/null | sed -e 's|^alias '"$cur"'\(.*\)$|\1|' )") ;; esac } _allowed_groups () { if _complete_as_root; then local IFS=' '; COMPREPLY=($( compgen -g -- "$1" )); else local IFS=' '; COMPREPLY=($( compgen -W "$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" )); fi } _allowed_users () { if _complete_as_root; then local IFS=' '; COMPREPLY=($( compgen -u -- "${1:-$cur}" )); else local IFS=' '; COMPREPLY=($( compgen -W "$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" )); fi } _apport-bug () { local cur dashoptions prev param; COMPREPLY=(); cur=`_get_cword`; prev=${COMP_WORDS[COMP_CWORD-1]}; dashoptions='-h --help --save -v --version --tag -w --window'; case "$prev" in ubuntu-bug | apport-bug) case "$cur" in -*) COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; *) _apport_parameterless ;; esac ;; --save) COMPREPLY=($( compgen -o default -G "$cur*" )) ;; -w | --window) dashoptions="--save --tag"; COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; -h | --help | -v | --version | --tag) return 0 ;; *) dashoptions="--tag"; if ! [[ "${COMP_WORDS[*]}" =~ .*--save.* ]]; then dashoptions="--save $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--window.* || "${COMP_WORDS[*]}" =~ .*\ -w\ .* ]]; then dashoptions="-w --window $dashoptions"; fi; case "$cur" in -*) COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; *) _apport_parameterless ;; esac ;; esac } _apport-cli () { local cur dashoptions prev param; COMPREPLY=(); cur=`_get_cword`; prev=${COMP_WORDS[COMP_CWORD-1]}; dashoptions='-h --help -f --file-bug -u --update-bug -s --symptom \ -c --crash-file --save -v --version --tag -w --window'; case "$prev" in apport-cli) case "$cur" in -*) COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; *) _apport_parameterless ;; esac ;; -f | --file-bug) param="-P --pid -p --package -s --symptom"; COMPREPLY=($( compgen -W "$param $(_apport_symptoms)" -- $cur)) ;; -s | --symptom) COMPREPLY=($( compgen -W "$(_apport_symptoms)" -- $cur)) ;; --save) COMPREPLY=($( compgen -o default -G "$cur*" )) ;; -c | --crash-file) COMPREPLY=($( compgen -G "${cur}*.apport" compgen -G "${cur}*.crash" )) ;; -w | --window) dashoptions="--save --tag"; COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; -h | --help | -v | --version | --tag) return 0 ;; *) dashoptions='--tag'; if ! [[ "${COMP_WORDS[*]}" =~ .*--save.* ]]; then dashoptions="--save $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--window.* || "${COMP_WORDS[*]}" =~ .*\ -w\ .* ]]; then dashoptions="-w --window $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--symptom.* || "${COMP_WORDS[*]}" =~ .*\ -s\ .* ]]; then dashoptions="-s --symptom $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--update.* || "${COMP_WORDS[*]}" =~ .*\ -u\ .* ]]; then dashoptions="-u --update $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--file-bug.* || "${COMP_WORDS[*]}" =~ .*\ -f\ .* ]]; then dashoptions="-f --file-bug $dashoptions"; fi; if ! [[ "${COMP_WORDS[*]}" =~ .*--crash-file.* || "${COMP_WORDS[*]}" =~ .*\ -c\ .* ]]; then dashoptions="-c --crash-file $dashoptions"; fi; case "$cur" in -*) COMPREPLY=($( compgen -W "$dashoptions" -- $cur )) ;; *) _apport_parameterless ;; esac ;; esac } _apport-collect () { local cur prev; COMPREPLY=(); cur=`_get_cword`; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in apport-collect) COMPREPLY=($( compgen -W "-p --package --tag" -- $cur)) ;; -p | --package) COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null )) ;; --tag) return 0 ;; *) if [[ "${COMP_WORDS[*]}" =~ .*\ -p.* || "${COMP_WORDS[*]}" =~ .*--package.* ]]; then COMPREPLY=($( compgen -W "--tag" -- $cur)); else COMPREPLY=($( compgen -W "-p --package --tag" -- $cur)); fi ;; esac } _apport-unpack () { local cur prev; COMPREPLY=(); cur=`_get_cword`; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in apport-unpack) COMPREPLY=($( compgen -G "${cur}*.apport" compgen -G "${cur}*.crash" )) ;; esac } _apport_parameterless () { local param; param="$dashoptions $( apt-cache pkgnames $cur 2> /dev/null ) $( command ps axo pid | sed 1d ) $( _apport_symptoms ) $( compgen -G "${cur}*" )"; COMPREPLY=($( compgen -W "$param" -- $cur)) } _apport_symptoms () { local syms; if [ -r /usr/share/apport/symptoms ]; then for FILE in $(ls /usr/share/apport/symptoms); do if [[ ! "$FILE" =~ ^_.* && -n $(egrep "^def run\s*\(.*\):" /usr/share/apport/symptoms/$FILE) ]]; then syms="$syms ${FILE%.py}"; fi; done; fi; echo $syms } _apt_cache () { local cur prev special i; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [ "$cur" != show ]; then for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then special=${COMP_WORDS[i]}; fi; done; fi; if [ -n "$special" ]; then case $special in add) _filedir; return 0 ;; showsrc) COMPREPLY=($( apt-cache dumpavail | command grep "^Source: $cur" | sort -u | cut -f2 -d" " )); return 0 ;; *) COMPREPLY=($( apt-cache --no-generate pkgnames "$cur" 2> /dev/null )); return 0 ;; esac; fi; case $prev in -c | -p | -s | --config-file | --pkg-cache | --src-cache) _filedir; return 0 ;; search) if [[ "$cur" != -* ]]; then return 0; fi ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-h -v -p -s -q -i -f -a -g -c \ -o --help --version --pkg-cache --src-cache \ --quiet --important --full --all-versions \ --no-all-versions --generate --no-generate \ --names-only --all-names --recurse \ --config-file --option --installed' -- "$cur" )); else COMPREPLY=($( compgen -W 'add gencaches show showpkg showsrc \ stats dump dumpavail unmet search search \ depends rdepends pkgnames dotty xvcg \ policy madison' -- "$cur" )); fi; return 0 } _apt_get () { local cur prev special i; COMPREPLY=(); _get_comp_words_by_ref cur prev; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep|changelog|download) ]]; then special=${COMP_WORDS[i]}; fi; done; if [ -n "$special" ]; then case $special in remove | autoremove | purge) if [ -f /etc/debian_version ]; then COMPREPLY=($( _comp_dpkg_installed_packages $cur )); else _rpm_installed_packages; fi; return 0 ;; source) COMPREPLY=($( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) $( apt-cache dumpavail | command grep "^Source: $cur" | sort -u | cut -f2 -d" " )); return 0 ;; *) COMPREPLY=($( apt-cache --no-generate pkgnames "$cur" 2> /dev/null )); return 0 ;; esac; fi; case $prev in -c | --config-file) _filedir; return 0 ;; -t | --target-release | --default-release) COMPREPLY=($( apt-cache policy | command grep "release.o=Debian,a=$cur" | sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null)); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \ --download-only --fix-broken --help --version --ignore-missing \ --fix-missing --no-download --quiet --simulate --just-print \ --dry-run --recon --no-act --yes --assume-yes --show-upgraded \ --only-source --compile --build --ignore-hold --target-release \ --no-upgrade --force-yes --print-uris --purge --reinstall \ --list-cleanup --default-release --trivial-only --no-remove \ --diff-only --no-install-recommends --tar-only --config-file \ --option --auto-remove' -- "$cur" )); else COMPREPLY=($( compgen -W 'update upgrade dselect-upgrade \ dist-upgrade install remove purge source build-dep \ check download clean autoclean autoremove changelog' -- "$cur" )); fi; return 0 } _aspell () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | -p | check | --conf | --personal | --repl | --per-conf) _filedir; return 0 ;; --conf-dir | --data-dir | --dict-dir | --home-dir | --local-data-dir | --prefix) _filedir -d; return 0 ;; dump | create | merge) COMPREPLY=($( compgen -W 'master personal repl' -- "$cur" )); return 0 ;; --mode) COMPREPLY=($( compgen -W 'none url email sgml tex' -- "$cur" )); return 0 ;; --sug-mode) COMPREPLY=($( compgen -W 'ultra fast normal bad-speller' -- "$cur" )); return 0 ;; --keymapping) COMPREPLY=($( compgen -W 'aspell ispell' -- "$cur" )); return 0 ;; -d | --master) _aspell_dictionary; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--conf --conf-dir --data-dir --dict-dir \ --encoding --add-filter --rem-filter --mode \ --add-extra-dicts --rem-extra-dicts \ --home-dir --ignore --ignore-accents \ --dont-ignore-accents --ignore-case --dont-ignore-case \ --ignore-repl --dont-ignore-repl --jargon --keyboard \ --lang --language-tag --local-data-dir --master \ --module --add-module-search-order \ --rem-module-search-order --per-conf --personal \ --prefix --repl --run-together --dont-run-together \ --run-together-limit --run-together-min --save-repl \ --dont-save-repl --set-prefix --dont-set-prefix --size \ --spelling --strip-accents --dont-strip-accents \ --sug-mode --add-word-list-path --rem-word-list-path \ --backup --dont-backup --reverse --dont-reverse \ --time --dont-time --keymapping --add-email-quote \ --rem-email-quote --email-margin --add-tex-command \ --rem-tex-command --tex-check-comments \ --dont-tex-check-comments --add-tex-extension \ --rem-tex-extension --add-sgml-check --rem-sgml-check \ --add-sgml-extension --rem-sgml-extension' -- "$cur" )); else COMPREPLY=($( compgen -W 'usage help check pipe list \ config soundslike filter version dump create merge' -- "$cur" )); fi } _aspell_dictionary () { local datadir; datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ); COMPREPLY=($( command ls $datadir/*.alias 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]%.alias}); COMPREPLY=(${COMPREPLY[@]#$datadir/}); COMPREPLY=("${COMPREPLY[@]}" $( aspell dicts 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )) } _available_interfaces () { local cmd; if [ "${1:-}" = -w ]; then cmd="iwconfig"; else if [ "${1:-}" = -a ]; then cmd="ifconfig"; else cmd="ifconfig -a"; fi; fi; COMPREPLY=($( eval PATH="$PATH:/sbin" $cmd 2>/dev/null | awk '/^[^ \t]/ { print $1 }' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" )) } _avctrl () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --quiet' -- "$cur" )); else _count_args; if [ $args -eq 1 ]; then COMPREPLY=($( compgen -W 'discover switch' -- "$cur" )); fi; fi } _axi_cache () { local cur prev cmd; COMPREPLY=(); COMP_WORDBREAKS=${COMP_WORDBREAKS//:}; type _get_comp_words_by_ref &>/dev/null && { _get_comp_words_by_ref -n: cur prev } || { cur=$(_get_cword ":"); prev=${COMP_WORDS[$COMP_CWORD-1]} }; cmd=${COMP_WORDS[1]}; case "$prev" in *axi-cache*) COMPREPLY=($(compgen -W "help more search show again showpkg showsrc depends rdepends policy madison" -- "$cur")); return 0 ;; --sort) COMPREPLY=($(compgen -W "$(egrep ^[a-z] /var/lib/apt-xapian-index/values | awk -F"\t" '{print $1}')" -- "$cur")); return 0 ;; esac; case "$cmd" in search | again) if [[ "$cur" == -* ]]; then COMPREPLY=($(compgen -W "--sort --tags" -- "$cur")); return 0; fi ;; show | showpkg | showsrc | depends | rdepends | policy | madison) if [[ "$cur" == -* ]]; then COMPREPLY=($(compgen -W "--last" -- "$cur")); return 0; fi ;; *) return 0 ;; esac; if [ -n "$cur" ]; then COMPREPLY=($(compgen -W "$(${COMP_WORDS[@]} --tabcomplete=partial)" -- "$cur")); else COMPREPLY=($(compgen -W "$(${COMP_WORDS[@]} --tabcomplete=plain)" -- "$cur")); fi; return 0 } _badblocks () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -b | -c | -e | -d | -p | -t) return 0 ;; -i | -o) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _bluetooth_adresses () { if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | awk '/^\t/{print $1}' )" -- "$cur" )); fi } _bluetooth_devices () { COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | awk '/^\t/{print $1}' )" -- "$cur" )) } _bluetooth_packet_types () { COMPREPLY=($( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' -- "$cur" )) } _bluetooth_services () { COMPREPLY=($( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG \ SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE \ UDITE SYNCML' -- "$cur" )) } _bzip2 () { local cur prev xspec helpopts; COMPREPLY=(); _get_comp_words_by_ref cur prev; helpopts=`_parse_help ${COMP_WORDS[0]}`; case $prev in -b | -h | --help | -p) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "${helpopts//#/} -2 -3 -4 -5 -6 -7 -8 -9" -- "$cur" )); return 0; fi; local IFS=' '; xspec="*.bz2"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --compress ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec; [[ "$prev" == -*z* ]] && xspec=; fi; fi; _expand || return 0; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _cancel () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" )) } _cardctl () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'status config ident suspend \ resume reset eject insert scheme' -- "$cur" )); fi } _cd () { local cur IFS=' ' i j k; _get_comp_words_by_ref cur; if [[ "$cur" == ?(\\)\$* ]]; then COMPREPLY=($( compgen -v -P '$' -- "${cur#?(\\)$}" )); return 0; fi; _compopt_o_filenames; if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then _filedir -d; return 0; fi; local -r mark_dirs=$(_rl_enabled mark-directories && echo y); local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y); for i in ${CDPATH//:/' '}; do k="${#COMPREPLY[@]}"; for j in $( compgen -d $i/$cur ); do if [[ ( -n $mark_symdirs && -h $j || -n $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then j="${j}/"; fi; COMPREPLY[k++]=${j#$i/}; done; done; _filedir -d; if [[ ${#COMPREPLY[@]} -eq 1 ]]; then i=${COMPREPLY[0]}; if [[ "$i" == "$cur" && $i != "*/" ]]; then COMPREPLY[0]="${i}/"; fi; fi; return 0 } _cd_devices () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" )) } _cdrecord () { local cur prev i generic_options track_options track_mode; COMPREPLY=(); _get_comp_words_by_ref -n = cur prev; if [[ "$cur" == *=* ]]; then prev=${cur%%=*}; cur=${cur#*=}; case $prev in textfile | cuefile | msifile) compopt +o nospace &>/dev/null; _filedir ;; blank) compopt +o nospace &>/dev/null; COMPREPLY=($( compgen -W 'help all fast track unreserve trtail unclose session' -- "$cur" )) ;; driveropts) if [[ $cur == *=* ]]; then prev=${cur%%=*}; cur=${cur#*=}; case $prev in varirec) compopt +o nospace &>/dev/null; COMPREPLY=($( compgen -W "-2 -1 0 1 2" -- "$cur" )) ;; gigarec) compopt +o nospace &>/dev/null; COMPREPLY=($( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3 1.4" -- "$cur" )) ;; tattoofile) compopt +o nospace &>/dev/null; _filedir ;; esac; else COMPREPLY=($( compgen -W 'burnfree noburnfree varirec= gigarec= audiomaster forcespeed noforcespeed speedread nospeedread singlesession nosinglesession hidecdr nohidecdr tattooinfo tattoofile=' -- "$cur" )); [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && compopt +o nospace &>/dev/null; fi ;; driver) compopt +o nospace &>/dev/null; COMPREPLY=($( compgen -W "$( $1 driver=help 2>&1 | awk 'NR > 1 { print $1 }' ) help" -- "$cur" )) ;; minbuf) compopt +o nospace &>/dev/null; COMPREPLY=($( compgen -W "$( seq 25 95 2>/dev/null )" -- "$cur" )) ;; esac; return 0; fi; generic_options=(-version -v -V -d -silent -force -immed -dummy -clone -dao -sao -tao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive -prcap -inq -scanbus --devices -reset -abort -overburn -ignsize -useinfo -packet -noclose -text debug= kdebug= minbuf= msifile= speed= blank= fs= ts= dev= gracetime= timeout= driver= driveropts= defpregap= pktsize= mcn= textfile= cuefile=); track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi -isosize -pad -nopad -shorttrack -noshorttrack -preemp -nopreemp -copy -nocopy -scms isrc= index= padsize= pregap= tsize=); track_mode=0; if [ $COMP_CWORD -gt 1 ]; then if [ -f "$prev" ]; then track_mode=1; else for ((i=0; i < ${#track_options[@]}; i++ )) do if [[ "${track_options[i]}" == "$prev" ]]; then track_mode=1; break; fi; done; fi; fi; _filedir; COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- "$cur" )); if [ $track_mode -eq 0 ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${generic_options[@]}' -- "$cur" )); fi; [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && compopt +o nospace &>/dev/null } _chage () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -d | --lastday | -E | --expiredate | -h | --help | -I | --inactive | -m | --mindays | -M | --maxdays | -W | --warndays) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--lastday --expiredate --help --inactive \ --list --mindays --maxdays --warndays' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _chgrp () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; cur=${cur//\\\\/}; _split_longopt && split=true; if [[ "$prev" == --reference ]]; then _filedir; return 0; fi; $split && return 0; if [[ "$cur" == -* ]]; then local w opts; for w in "${COMP_WORDS[@]}"; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break; done; COMPREPLY=($( compgen -W '-c -h -f -R -v --changes --dereference \ --no-dereference --silent --quiet --reference --recursive \ --verbose --help --version $opts' -- "$cur" )); return 0; fi; if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then _allowed_groups; else _filedir || return 0; fi; return 0 } _chown () { local cur prev split=false; _get_comp_words_by_ref -n : cur prev; _split_longopt && split=true; case "$prev" in --from) _usergroup; return 0 ;; --reference) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then local w opts; for w in "${COMP_WORDS[@]}"; do [[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break; done; COMPREPLY=($( compgen -W '-c -h -f -R -v --changes --dereference \ --no-dereference --from --silent --quiet --reference --recursive \ --verbose --help --version $opts' -- "$cur" )); else local args; _count_args :; if [[ $args == 1 ]]; then _usergroup -u; else _filedir; fi; fi } _chpasswd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --crypt) COMPREPLY=($( compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur" )); return 0 ;; -s | --sha-rounds) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--crypt-method --encrypted \ --help --md5 --sha-rounds' -- "$cur" )); return 0; fi } _chsh () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --list-shells | --help | -v | --version) return 0 ;; -s | --shell) _shells; return 0 ;; esac; if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then COMPREPLY=($( compgen -W '--shell --list-shells --help --version' -- "$cur" )); else COMPREPLY=($( compgen -u -- "$cur" )); fi; return 0 } _ciptool () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -i) _bluetooth_devices; _bluetooth_adresses; return 0 ;; esac; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help -i' -- "$cur" )); else COMPREPLY=($( compgen -W 'show search connect release \ loopback' -- "$cur" )); fi; else case $arg in connect | release | loopback) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; fi ;; esac; fi } _command () { local offset i; offset=1; for ((i=1; i <= COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" != -* ]]; then offset=$i; break; fi; done; _command_offset $offset } _command_offset () { local cur func cline cspec noglob cmd i char_offset word_offset _COMMAND_FUNC _COMMAND_FUNC_ARGS; word_offset=$1; local first_word=${COMP_WORDS[$word_offset]}; for ((i=0; i <= ${#COMP_LINE}; i++ )) do if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then char_offset=$i; break; fi; done; COMP_LINE=${COMP_LINE:$char_offset}; COMP_POINT=$(( COMP_POINT - $char_offset )); for ((i=0; i <= COMP_CWORD - $word_offset; i++ )) do COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}; done; for ((i; i <= COMP_CWORD; i++ )) do unset COMP_WORDS[i]; done; COMP_CWORD=$(( $COMP_CWORD - $word_offset )); COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 0 ]]; then _compopt_o_filenames; COMPREPLY=($( compgen -c -- "$cur" )); else cmd=${COMP_WORDS[0]}; if complete -p ${cmd##*/} &>/dev/null; then cspec=$( complete -p ${cmd##*/} ); if [ "${cspec#* -F }" != "$cspec" ]; then func=${cspec#*-F }; func=${func%% *}; if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"; else $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"; fi; if [ "${cspec#*-o }" != "$cspec" ]; then cspec=${cspec#*-o }; cspec=${cspec%% *}; if [[ "$cspec" != @(dir|file)names ]]; then COMPREPLY=("${COMPREPLY[@]//\\\\:/:}"); else _compopt_o_filenames; fi; fi; else if [ -n "$cspec" ]; then cspec=${cspec#complete}; cspec=${cspec%%${cmd##*/}}; COMPREPLY=($( eval compgen "$cspec" -- "$cur" )); fi; fi; else if [ ${#COMPREPLY[@]} -eq 0 ]; then _filedir; fi; fi; fi } _comp_dpkg_installed_packages () { command grep -A 1 "Package: $1" /var/lib/dpkg/status | command grep -B 1 -Ee "ok installed|half-installed|unpacked| half-configured|config-files" -Ee "^Essential: yes" | command grep "Package: $1" | cut -d\ -f2 } _complete () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o) COMPREPLY=($( compgen -W 'bashdefault default dirnames filenames \ nospace plusdirs' -- "$cur" )); return 0 ;; -A) COMPREPLY=($( compgen -W 'alias arrayvar binding builtin command \ directory disabled enabled export file function group \ helptopic hostname job keyword running service setopt shopt \ signal stopped user variable' -- "$cur" )); return 0 ;; -C) COMPREPLY=($( compgen -A command -- "$cur" )); return 0 ;; -F) COMPREPLY=($( compgen -A function -- "$cur" )); return 0 ;; -p | -r) COMPREPLY=($( complete -p | sed -e 's|.* ||' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"; [[ $1 != compgen ]] && opts="$opts -F -C"; COMPREPLY=($( compgen -W "$opts" -- "$cur" )); else COMPREPLY=($( compgen -A command -- "$cur" )); fi } _complete_as_root () { [[ $EUID -eq 0 || -n ${root_command:-} ]] } _compopt_o_filenames () { type compopt &>/dev/null && compopt -o filenames 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null } _configure () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --*prefix | --*dir) _filedir -d ;; esac; $split && return 0; [[ "$cur" != -* ]] && return 0; if [ -n "$COMP_CONFIGURE_HINTS" ]; then COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" -- "$cur" )); else COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" -- "$cur" )); fi } _configured_interfaces () { if [ -f /etc/debian_version ]; then COMPREPLY=($( compgen -W "$( sed -ne 's|^iface \([^ ]\{1,\}\).*$|\1|p' /etc/network/interfaces )" -- "$cur" )); else if [ -f /etc/SuSE-release ]; then COMPREPLY=($( compgen -W "$( printf '%s\n' /etc/sysconfig/network/ifcfg-* | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); else if [ -f /etc/pld-release ]; then COMPREPLY=($( compgen -W "$( command ls -B /etc/sysconfig/interfaces | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); else COMPREPLY=($( compgen -W "$( printf '%s\n' /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's|.*ifcfg-\(.*\)|\1|p' )" -- "$cur" )); fi; fi; fi } _count_args () { local i cword words; __reassemble_comp_words_by_ref "$1" words cword; args=1; for i in "${words[@]:1:cword-1}"; do [[ "$i" != -* ]] && args=$(($args+1)); done } _cpan2dist () { local cur prev packagelist cpandirs; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --format) COMPREPLY=($( compgen -W '$(perl -MCPANPLUS::Dist -e \ "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" )); return 0 ;; --banlist | --ignorelist | --modulelist | --logfile) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --skiptest --force --install \ --verbose --keepsource --makefile --buildprereq \ --archive --flushcache --defaults --edit-metafile \ --format --ban --banlist --ignore --ignorelist \ --modulelist --logfile --timeout --set-config \ --set-program --dist-opts --default-banlist \ --default-ignorelist' -- $cur )); else cpandirs=("$HOME/.cpanplus/" "$HOME/.cpan/source/modules/"); for dir in ${cpandirs[@]}; do [[ -d "$dir" && -r "$dir/02packages.details.txt.gz" ]] && packagelist="$dir/02packages.details.txt.gz"; done; COMPREPLY=($( zgrep "^${cur//-/::}" $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' )); fi } _cpio () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _split_longopt && split=true; case $prev in -H | --format) _cpio_format; return 0 ;; -E | -F | -I | --file | --pattern-file) _filedir; return 0 ;; -R | --owner) _usergroup; return 0 ;; --rsh-command) _compopt_o_filenames; COMPREPLY=($( compgen -c -- "$cur" )); return 0 ;; esac; $split && return 0; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W '-o --create -i --extract -p --pass-through \ -? --help --license --usage --version' -- "$cur" )); else case ${COMP_WORDS[1]} in -o | --create) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-0 -a -c -v -A -B\ -L -V -C -H -M -O -F --file --format\ --message --null --reset-access-time\ --verbose --dot --append --block-size\ --dereference --io-size --quiet\ --force-local --rsh-command --help\ --version' -- "$cur" )); fi ;; -i | --extract) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -c -d -f -m -n -r\ -t -s -u -v -B -S -V -C -E -H -M -R -I\ -F --file --make-directories\ --nonmatching\ --preserve-modification-time\ --numeric-uid-gid --rename -t --list\ --swap-bytes --swap --dot\ --unconditional --verbose --block-size\ --swap-halfwords --io-size\ --pattern-file --format --owner\ --no-preserve-owner --message\ --force-local --no-absolute-filenames\ --sparse --only-verify-crc --quiet\ --rsh-command --help\ --to-stdout \ --version' -- "$cur" )); fi ;; -p | --pass-through) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-0 -a -d -l -m -u -v\ -L -V -R --null --reset-access-time\ --make-directories --link --quiet\ --preserve-modification-time\ --unconditional --verbose --dot\ --dereference --owner\ --no-preserve-owner --sparse --help\ --version' -- "$cur" )); else _filedir -d; fi ;; esac; fi } _cpio_format () { COMPREPLY=($( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" )) } _crontab () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -u) _allowed_users; return 0 ;; esac; local i opts=" -u -l -r -e"; [ "$(uname -s)" = Linux ] && opts="$opts -i"; [ -e /etc/selinux ] && opts="$opts -s"; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do case "${COMP_WORDS[i]}" in -l) opts=${opts// -l -r -e/}; opts=${opts// -i/}; opts=${opts// -s/} ;; -e) opts=${opts// -l -r -e/}; opts=${opts// -i/} ;; -r) opts=${opts// -l -r -e/} ;; -u) opts=${opts// -u/}; opts=${opts// -i/} ;; -i | -s) opts=${opts// ${COMP_WORDS[i]}/} ;; esac; done; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '$opts' -- "$cur" )); return 0; fi; [[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir } _cryptsetup_device () { cur=${cur:=/dev/}; _filedir } _cryptsetup_name () { COMPREPLY=($( compgen -X control -W '$( command ls /dev/mapper )' -- "$cur" )) } _dd () { local cur; COMPREPLY=(); _get_comp_words_by_ref -n = cur; case $cur in if=* | of=*) cur=${cur#*=}; _filedir; return 0 ;; conv=*) cur=${cur#*=}; COMPREPLY=($( compgen -W 'ascii ebcdic ibm block unblock lcase notrunc ucase swab noerror sync' -- "$cur" )); return 0 ;; esac; _expand || return 0; COMPREPLY=($( compgen -W '--help --version' -- "$cur" ) $( compgen -W 'bs cbs conv count ibs if obs of seek skip' -S '=' -- "$cur" )) } _debconf_show () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($( compgen -W '--listowners --listdbs --db=' -- $cur ) $( apt-cache pkgnames -- $cur )) } _desktop_file_validate () { COMPRELY=(); cur=${COMP_WORDS[COMP_CWORD]}; _filedir '@(desktop)' } _dfutool () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -d | --device) _bluetooth_devices; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --device' -- "$cur" )); else _count_args; case $args in 1) COMPREPLY=($( compgen -W 'verify modify \ upgrade archive' -- "$cur" )) ;; 2) _filedir ;; esac; fi } _dhclient () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -cf | -lf | -pf | -sf) _filedir; return 0 ;; -s) _known_hosts_real "$cur"; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-p -d -q -1 -r -lf -pf \ -cf -sf -s -g -n -nw -w' -- "$cur" )); else _available_interfaces; fi } _dkms () { local cur prev command module i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=($( compgen -W "add autoinstall remove build install uninstall match mkdriverdisk mktarball ldtarball mkrpm mkdeb mkdsc mkkmp status" -- $cur )); else prev=${COMP_WORDS[COMP_CWORD-1]}; command=${COMP_WORDS[1]}; case $prev in -m) if [ "$command" = 'add' ]; then _filename_parts '.*-.*' 1; else _subdirectories /var/lib/dkms; fi; return 0 ;; -v) for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -m ]]; then module=${COMP_WORDS[i+1]}; break; fi; done; if [ -n "$module" ]; then if [ "$command" = 'add' ]; then _filename_parts "$module-.*" 2; else _subdirectories /var/lib/dkms/$module; fi; return 0; fi ;; -k) _kernels; return 0 ;; -@\(c | -spec | -archive | -config\)) _filedir; return 0 ;; --kernelsourcedir) _filedir -d; return 0 ;; esac; if [[ "$cur" == -* ]]; then case $command in add) options='-c --rpm_safe_upgrade' ;; remove) options='--rpm_safe_upgrade' ;; build) options='--config' ;; mkdriverdisk) options='-d --distro -r --release --size' ;; ldtarball) options='--archive --force' ;; mktarball) options='--source-only --binaries-only' ;; mkrpm) options='--source-only' ;; mkkmp) options='--spec' ;; match) options='--templatekernel' ;; esac; options="$options -m -v -k -a --arch -q --quiet -V --version --all --no-prepare-kernel --no-clean-kernel --kernelsourcedir --directive"; COMPREPLY=($( compgen -W "$options" -- $cur )); fi; fi } _dpkg () { local cur prev i; COMPREPLY=(); _get_comp_words_by_ref cur prev; i=$COMP_CWORD; _expand || return 0; _split_longopt; if [[ $cur != -* ]]; then while [[ $prev != -* && $i != 1 ]]; do i=$((i-1)); prev=${COMP_WORDS[i-1]}; done; fi; case $prev in -c | -i | -A | -I | -f | -e | -x | -X | -W | --install | --unpack | --record-avail | --contents | --info | --fsys-tarfile | --field | --control | --extract | --show) _filedir '?(u)deb'; return 0 ;; -b | --build) _filedir -d; return 0 ;; -s | -p | -l | --status | --print-avail | --list) COMPREPLY=($( apt-cache pkgnames "$cur" 2>/dev/null )); return 0 ;; -S | --search) _filedir; return 0 ;; -r | -L | -P | --remove | --purge | --listfiles) COMPREPLY=($( _comp_dpkg_installed_packages "$cur" )); return 0 ;; *) COMPREPLY=($( compgen -W '-i --install --unpack -A --record-avail \ --configure -r --remove -P --purge --get-selections \ --set-selections --update-avail --merge-avail \ --clear-avail --command-fd --forget-old-unavail -s \ --status -p --print-avail -L --listfiles -l --list \ -S --search -C --audit --print-architecture \ --print-gnu-build-architecture \ --print-installation-architecture \ --compare-versions --help --version --force-help \ --force-all --force-auto-select --force-downgrade \ --force-configure-any --force-hold --force-bad-path \ --force-not-root --force-overwrite \ --force-overwrite-diverted --force-bad-verify \ --force-depends-version --force-depends \ --force-confnew --force-confold --force-confdef \ --force-confmiss --force-conflicts --force-architecture\ --force-overwrite-dir --force-remove-reinstreq \ --force-remove-essential -Dh \ --debug=help --licence --admindir --root --instdir \ -O --selected-only -E --skip-same-version \ -G --refuse-downgrade -B --auto-deconfigure \ --no-debsig --no-act -D --debug --status-fd \ -b --build -I --info -f --field -c --contents \ -x --extract -X --vextract --fsys-tarfile -e --control \ --ignore-depends --abort-after' -- "$cur" )) ;; esac } _dpkg_reconfigure () { local cur prev opt; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -f | --frontend) opt=($( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* )); opt=(${opt[@]##*/}); opt=(${opt[@]%.pm}); COMPREPLY=($( compgen -W '${opt[@]}' -- "$cur" )); return 0 ;; -p | --priority) COMPREPLY=($( compgen -W 'low medium high critical' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($(compgen -W '--frontend --priority --all --unseen-only \ --help --showold --force --terse' -- "$cur" )); else COMPREPLY=($( _comp_dpkg_installed_packages "$cur" )); fi } _dpkg_source () { local cur prev options work i action packopts unpackopts fields; packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP -sU -sR"; unpackopts="-sp -sn -su"; options="-x -b $packopts $unpackopts"; fields="Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files"; COMPREPLY=(); _get_comp_words_by_ref cur prev; action="options"; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[$i]} == "-x" ]]; then action=unpack; else if [[ ${COMP_WORDS[$i]} == "-b" ]]; then action=pack; else if [[ ${COMP_WORDS[$i]} == "-h" ]]; then action=help; fi; fi; fi; done; case $action in unpack) case $prev in -x) _filedir -d; _filedir 'dsc'; return 0 ;; *) COMPREPLY=($( compgen -W "$unpackopts" -- "$cur" )); _filedir -d; _filedir; return 0 ;; esac; return 0 ;; pack) case $prev in -b) _filedir -d; return 0 ;; -c | -l | -T | -i | -I) _filedir -d; _filedir; return 0 ;; -F) COMPREPLY=($( command ls /usr/lib/dpkg/parsechangelog )); return 0 ;; -V | -D) COMPREPLY=(); return 0 ;; -D) if [[ "$cur" == *=* ]]; then COMPREPLY=(); return 0; else COMPREPLY=($( compgen -W "$fields" -- "$cur" )); return 0; fi ;; -U) COMPREPLY=($( compgen -W "$fields" -- "$cur" )); return 0 ;; *) COMPREPLY=($( compgen -W "$packopts $unpackopts" -- "$cur" )); return 0 ;; esac; return 0 ;; *) COMPREPLY=($( compgen -W "$options" -- "$cur" )); return 0 ;; esac } _dumpe2fs () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -o | -V) return 0 ;; -i) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -o -f -h -i -x -V' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _dvd_devices () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" )) } _e2freefrag () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c | -h) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -h' -- "$cur" )); return 0; fi; cur=${cur:=/dev/}; _filedir } _e2label () { COMPREPLY=(); local cur cword; _get_comp_words_by_ref cur cword; if [ $cword -eq 1 ]; then cur=${cur:=/dev/}; _filedir; fi } _expand () { if [[ "$cur" == \~*/* ]]; then eval cur=$cur; else if [[ "$cur" == \~* ]]; then cur=${cur#\~}; COMPREPLY=($( compgen -P '~' -u "$cur" )); [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}; return ${#COMPREPLY[@]}; fi; fi } _export () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; case $COMP_LINE in *=\$*) COMPREPLY=($( compgen -v -P '$' -- "${cur#*=\$}" )) ;; *[^=]) COMPREPLY=($( compgen -v -S '=' -- "$cur" )) ;; *=) COMPREPLY=("$( eval echo -n \"$`echo ${cur%=}`\" | ( echo -n \' sed -e 's/'\''/'\''\\\'\'''\''/g' echo -n \' ) )") ;; esac } _faillog () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -h | --help | -l | --lock-time | -m | --maximum | -t | --time) return 0 ;; -u | --user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--all --help --lock-time \ --maximum --reset --time --user' -- "$cur" )); return 0; fi } _filedir () { local i IFS=' ' xspec; _tilde "$cur" || return 0; local -a toks; local quoted tmp; _quote_readline_by_ref "$cur" quoted; toks=(${toks[@]-} $( compgen -d -- "$quoted" | { while read -r tmp; do # TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..', # and everything works again. If this bug suddenly # appears again (i.e. "cd /b" becomes "cd /"), # remember to check for other similar conditionals (here # and _filedir_xspec()). --David printf '%s\n' $tmp done } )); if [[ "$1" != -d ]]; then [[ ${BASH_VERSINFO[0]} -ge 4 ]] && xspec=${1:+"!*.@($1|${1^^})"} || xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}; toks=(${toks[@]-} $( compgen -f -X "$xspec" -- $quoted)); fi; [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames; if [[ -n "$1" ]] && [[ "$1" != -d ]] && [[ ${#toks[@]} -lt 1 ]]; then toks=(${toks[@]-} $( compgen -f -X -- $quoted)); fi; COMPREPLY=("${COMPREPLY[@]}" "${toks[@]}") } _filedir_xspec () { local IFS cur xspec; IFS=' '; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" "$BASH_COMPLETION" ); xspec=${xspec#*-X }; xspec=${xspec%% *}; local -a toks; local tmp; toks=(${toks[@]-} $( compgen -d -- "$(quote_readline "$cur")" | { while read -r tmp; do # see long TODO comment in _filedir() --David printf '%s\n' $tmp done } )); eval xspec="${xspec}"; local matchop=!; if [[ $xspec == !* ]]; then xspec=${xspec#!}; matchop=@; fi; [[ ${BASH_VERSINFO[0]} -ge 4 ]] && xspec="$matchop($xspec|${xspec^^})" || xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"; toks=(${toks[@]-} $( eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [ -n $tmp ] && printf '%s\n' $tmp done } )); [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames; COMPREPLY=("${toks[@]}") } _filefrag () { COMPREPLY=(); local cur; _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-B -b -s -v -x' -- "$cur" )); return 0; fi; _filedir } _filename_parts () { COMPREPLY=($( command ls -F /usr/src/ 2>/dev/null | grep -E '^'$1'/$' | sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" )) } _find () { local cur prev i exprfound onlyonce; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -maxdepth | -mindepth) COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; -newer | -anewer | -cnewer | -fls | -fprint | -fprint0 | -fprintf | -name | -iname | -lname | -ilname | -wholename | -iwholename | -samefile) _filedir; return 0 ;; -fstype) _fstypes; if [[ "$( uname -s )" == *BSD ]]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'local rdonly' -- "$cur" )); fi; return 0 ;; -gid) _gids; return 0 ;; -group) COMPREPLY=($( compgen -g -- "$cur" 2>/dev/null)); return 0 ;; -xtype | -type) COMPREPLY=($( compgen -W 'b c d p f l s' -- "$cur" )); return 0 ;; -uid) _uids; return 0 ;; -user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; -exec | -execdir | -ok | -okdir) COMP_WORDS=(COMP_WORDS[0] "$cur"); COMP_CWORD=1; _command; return 0 ;; -[acm]min | -[acm]time | -iname | -lname | -wholename | -iwholename | -lwholename | -ilwholename | -inum | -path | -ipath | -regex | -iregex | -links | -perm | -size | -used | -printf | -context) return 0 ;; -regextype) COMPREPLY=($( compgen -W 'emacs posix-awk posix-basic \ posix-egrep posix-extended' -- "$cur" )); return 0 ;; esac; _expand || return 0; for i in ${COMP_WORDS[@]}; do [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break; done; if [[ "$exprfound" != 1 && "$cur" != [-\(\),\!]* ]]; then _filedir -d; return 0; fi; COMPREPLY=($( compgen -W '-daystart -depth -follow -help \ -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \ -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \ -xdev \ -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \ -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \ -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \ -readable -regex -samefile -size -true -type -uid -used -user \ -wholename -writable -xtype -context \ -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \ -print -print0 -printf -prune -quit' -- "$cur" )); onlyonce=' -daystart -depth -follow -help -ignore_readdir_race -maxdepth \ -mindepth -mount -noignore_readdir_race -noleaf -nowarn -regextype \ -version -warn -xdev '; COMPREPLY=($( (while read -d ' ' i; do [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word boundaries of # first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) done printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" )); _filedir; return 0 } _fstypes () { local fss; if [ -e /proc/filesystems ]; then fss="$( cut -d' ' -f2 /proc/filesystems ) $( awk '! /\*/ { print $NF }' /etc/filesystems 2>/dev/null )"; else fss="$( awk '/^[ \t]*[^#]/ { print $3 }' /etc/fstab 2>/dev/null ) $( awk '/^[ \t]*[^#]/ { print $3 }' /etc/mnttab 2>/dev/null ) $( awk '/^[ \t]*[^#]/ { print $4 }' /etc/vfstab 2>/dev/null ) $( awk '{ print $1 }' /etc/dfs/fstypes 2>/dev/null ) $( [ -d /etc/fs ] && command ls /etc/fs )"; fi; [ -n "$fss" ] && COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" )) } _function () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ $1 == @(declare|typeset) ]]; then if [ "$prev" = -f ]; then COMPREPLY=($( compgen -A function -- "$cur" )); else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -f -F -i -r -x -p' -- "$cur" )); fi; fi; else if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -A function -- "$cur" )); else COMPREPLY=("() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )"); fi; fi } _fusermount () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -h | -V | -o) return 0 ;; -u) COMPREPLY=($( compgen -W "$( awk '{ if ($3 ~ /^fuse\./) print $2 }' /etc/mtab 2>/dev/null )" -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-h -V -o -u -q -z' -- "$cur" )); else _filedir -d; fi } _gcc () { local cur cc backend; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; case $1 in gcj) backend=jc1 ;; gpc) backend=gpc1 ;; *77) backend=f771 ;; *) backend=cc1 ;; esac; if [[ "$cur" == -* ]]; then cc=$( $1 -print-prog-name=$backend ); COMPREPLY=($( compgen -W "$( $cc --help 2>/dev/null | tr '\t' ' ' | sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | sort -u )" -- "$cur" )); else _filedir; fi } _gdb () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [ $COMP_CWORD -eq 1 ]; then local IFS; _compopt_o_filenames; if [[ "$cur" == */* ]]; then IFS=' '; COMPREPLY=($( PATH="$PATH:." compgen -d -c -- "$cur" )); else IFS=":"; local path_array=($( sed -e 's/:\{2,\}/:/g' -e 's/^://' -e 's/:$//' <<<"$PATH" )); IFS=' '; COMPREPLY=($( compgen -d -W '$(find "${path_array[@]}" . \ -mindepth 1 -maxdepth 1 -not -type d -executable \ -printf "%f\\n" 2>/dev/null)' -- "$cur" )); fi; else if [ $COMP_CWORD -eq 2 ]; then prev=${prev##*/}; COMPREPLY=($( compgen -fW "$( command ps axo comm,pid | awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" )); fi; fi } _get_comp_words_by_ref () { local exclude flag i OPTIND=1; local cur cword words=(); local upargs=() upvars=() vcur vcword vprev vwords; while getopts "c:i:n:p:w:" flag "$@"; do case $flag in c) vcur=$OPTARG ;; i) vcword=$OPTARG ;; n) exclude=$OPTARG ;; p) vprev=$OPTARG ;; w) vwords=$OPTARG ;; esac; done; while [[ $# -ge $OPTIND ]]; do case ${!OPTIND} in cur) vcur=cur ;; prev) vprev=prev ;; cword) vcword=cword ;; words) vwords=words ;; *) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" 1>&2; return 1 ;; esac; let "OPTIND += 1"; done; __get_cword_at_cursor_by_ref "$exclude" words cword cur; [[ -n $vcur ]] && { upvars+=("$vcur"); upargs+=(-v $vcur "$cur") }; [[ -n $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword") }; [[ -n $vprev ]] && { upvars+=("$vprev"); upargs+=(-v $vprev "${words[cword - 1]}") }; [[ -n $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords "${words[@]}") }; (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}" } _get_cword () { local LC_CTYPE=C; local cword words; __reassemble_comp_words_by_ref "$1" words cword; if [[ -n ${2//[^0-9]/} ]]; then printf "%s" "${words[cword-$2]}"; else if [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then printf "%s" "${words[cword]}"; else local i; local cur="$COMP_LINE"; local index="$COMP_POINT"; for ((i = 0; i <= cword; ++i )) do while [[ "${#cur}" -ge ${#words[i]} && "${cur:0:${#words[i]}}" != "${words[i]}" ]]; do cur="${cur:1}"; ((index--)); done; if [[ "$i" -lt "$cword" ]]; then local old_size="${#cur}"; cur="${cur#${words[i]}}"; local new_size="${#cur}"; index=$(( index - old_size + new_size )); fi; done; if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then printf "%s" "${words[cword]}"; else printf "%s" "${cur:0:$index}"; fi; fi; fi } _get_first_arg () { local i; arg=; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" != -* ]]; then arg=${COMP_WORDS[i]}; break; fi; done } _get_pword () { if [ $COMP_CWORD -ge 1 ]; then _get_cword "${@:-}" 1; fi } _getent () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in passwd) COMPREPLY=($( compgen -u "$cur" )); return 0 ;; group) COMPREPLY=($( compgen -g "$cur" )); return 0 ;; services) COMPREPLY=($( compgen -s "$cur" )); return 0 ;; hosts) COMPREPLY=($( compgen -A hostname "$cur" )); return 0 ;; protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc) COMPREPLY=($( compgen -W "$( getent "$prev" | awk '{ print $1 }' )" -- "$cur" )); return 0 ;; aliases | shadow) COMPREPLY=($( compgen -W "$( getent "$prev" | cut -d: -f1 )" -- "$cur" )); return 0 ;; esac; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'passwd group hosts services protocols \ networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \ shadow' -- "$cur" )); fi } _gids () { if type getent &>/dev/null; then COMPREPLY=($( compgen -W '$( getent group | cut -d: -f3 )' -- "$cur" )); else if type perl &>/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" )); else COMPREPLY=($( compgen -W '$( cut -d: -f3 /etc/group )' -- "$cur" )); fi; fi } _git () { local i c=1 command __git_dir; if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash; setopt KSH_TYPESET; typeset -h words; fi; local cur words cword; _get_comp_words_by_ref -n =: cur words cword; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in --git-dir=*) __git_dir="${i#--git-dir=}" ;; --bare) __git_dir="." ;; --version | -p | --paginate) ;; --help) command="help"; break ;; *) command="$i"; break ;; esac; c=$((++c)); done; if [ -z "$command" ]; then case "$cur" in --*) __gitcomp " --paginate --no-pager --git-dir= --bare --version --exec-path --html-path --work-tree= --help " ;; *) __git_compute_porcelain_commands; __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;; esac; return; fi; local completion_func="_git_${command//-/_}"; declare -f $completion_func > /dev/null && $completion_func && return; local expansion=$(__git_aliased_command "$command"); if [ -n "$expansion" ]; then completion_func="_git_${expansion//-/_}"; declare -f $completion_func > /dev/null && $completion_func; fi } _git_add () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --interactive --refresh --patch --update --dry-run --ignore-errors --intent-to-add "; return ;; esac; COMPREPLY=() } _git_am () { local cur dir="$(__gitdir)"; _get_comp_words_by_ref -n =: cur; if [ -d "$dir"/rebase-apply ]; then __gitcomp "--skip --continue --resolved --abort"; return; fi; case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --*) __gitcomp " --3way --committer-date-is-author-date --ignore-date --ignore-whitespace --ignore-space-change --interactive --keep --no-utf8 --signoff --utf8 --whitespace= --scissors "; return ;; esac; COMPREPLY=() } _git_apply () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --*) __gitcomp " --stat --numstat --summary --check --index --cached --index-info --reverse --reject --unidiff-zero --apply --no-add --exclude= --ignore-whitespace --ignore-space-change --whitespace= --inaccurate-eof --verbose "; return ;; esac; COMPREPLY=() } _git_archive () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --format=*) __gitcomp "$(git archive --list)" "" "${cur##--format=}"; return ;; --remote=*) __gitcomp "$(__git_remotes)" "" "${cur##--remote=}"; return ;; --*) __gitcomp " --format= --list --verbose --prefix= --remote= --exec= "; return ;; esac; __git_complete_file } _git_bisect () { __git_has_doubledash && return; local subcommands="start bad good skip reset visualize replay log run"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then if [ -f "$(__gitdir)"/BISECT_START ]; then __gitcomp "$subcommands"; else __gitcomp "replay start"; fi; return; fi; case "$subcommand" in bad | good | reset | skip | start) __gitcomp "$(__git_refs)" ;; *) COMPREPLY=() ;; esac } _git_branch () { local i c=1 only_local_ref="n" has_r="n" cur words cword; _get_comp_words_by_ref -n =: cur words cword; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in -d | -m) only_local_ref="y" ;; -r) has_r="y" ;; esac; c=$((++c)); done; case "$cur" in --*) __gitcomp " --color --no-color --verbose --abbrev= --no-abbrev --track --no-track --contains --merged --no-merged --set-upstream " ;; *) if [ $only_local_ref = "y" -a $has_r = "n" ]; then __gitcomp "$(__git_heads)"; else __gitcomp "$(__git_refs)"; fi ;; esac } _git_bundle () { local words cword; _get_comp_words_by_ref -n =: words cword; local cmd="${words[2]}"; case "$cword" in 2) __gitcomp "create list-heads verify unbundle" ;; 3) ;; *) case "$cmd" in create) __git_complete_revlist ;; esac ;; esac } _git_checkout () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --conflict=*) __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) __gitcomp " --quiet --ours --theirs --track --no-track --merge --conflict= --orphan --patch " ;; *) local flags="--track --no-track --no-guess" track=1; if [ -n "$(__git_find_on_cmdline "$flags")" ]; then track=''; fi; __gitcomp "$(__git_refs '' $track)" ;; esac } _git_cherry () { __gitcomp "$(__git_refs)" } _git_cherry_pick () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--edit --no-commit" ;; *) __gitcomp "$(__git_refs)" ;; esac } _git_clean () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--dry-run --quiet"; return ;; esac; COMPREPLY=() } _git_clone () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --local --no-hardlinks --shared --reference --quiet --no-checkout --bare --mirror --origin --upload-pack --template= --depth "; return ;; esac; COMPREPLY=() } _git_commit () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --cleanup=*) __gitcomp "default strip verbatim whitespace " "" "${cur##--cleanup=}"; return ;; --reuse-message=*) __gitcomp "$(__git_refs)" "" "${cur##--reuse-message=}"; return ;; --reedit-message=*) __gitcomp "$(__git_refs)" "" "${cur##--reedit-message=}"; return ;; --untracked-files=*) __gitcomp "all no normal" "" "${cur##--untracked-files=}"; return ;; --*) __gitcomp " --all --author= --signoff --verify --no-verify --edit --amend --include --only --interactive --dry-run --reuse-message= --reedit-message= --reset-author --file= --message= --template= --cleanup= --untracked-files --untracked-files= --verbose --quiet "; return ;; esac; COMPREPLY=() } _git_config () { local cur prev; _get_comp_words_by_ref -n =: cur prev; case "$prev" in branch.*.remote) __gitcomp "$(__git_remotes)"; return ;; branch.*.merge) __gitcomp "$(__git_refs)"; return ;; remote.*.fetch) local remote="${prev#remote.}"; remote="${remote%.fetch}"; __gitcomp "$(__git_refs_remotes "$remote")"; return ;; remote.*.push) local remote="${prev#remote.}"; remote="${remote%.push}"; __gitcomp "$(git --git-dir="$(__gitdir)" for-each-ref --format='%(refname):%(refname)' refs/heads)"; return ;; pull.twohead | pull.octopus) __git_compute_merge_strategies; __gitcomp "$__git_merge_strategies"; return ;; color.branch | color.diff | color.interactive | color.showbranch | color.status | color.ui) __gitcomp "always never auto"; return ;; color.pager) __gitcomp "false true"; return ;; color.*.*) __gitcomp " normal black red green yellow blue magenta cyan white bold dim ul blink reverse "; return ;; help.format) __gitcomp "man info web html"; return ;; log.date) __gitcomp "$__git_log_date_formats"; return ;; sendemail.aliasesfiletype) __gitcomp "mutt mailrc pine elm gnus"; return ;; sendemail.confirm) __gitcomp "$__git_send_email_confirm_options"; return ;; sendemail.suppresscc) __gitcomp "$__git_send_email_suppresscc_options"; return ;; --get | --get-all | --unset | --unset-all) __gitcomp "$(__git_config_get_set_variables)"; return ;; *.*) COMPREPLY=(); return ;; esac; case "$cur" in --*) __gitcomp " --global --system --file= --list --replace-all --get --get-all --get-regexp --add --unset --unset-all --remove-section --rename-section "; return ;; branch.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp "remote merge mergeoptions rebase" "$pfx" "$cur"; return ;; branch.*) local pfx="${cur%.*}."; cur="${cur#*.}"; __gitcomp "$(__git_heads)" "$pfx" "$cur" "."; return ;; guitool.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp " argprompt cmd confirm needsfile noconsole norescan prompt revprompt revunmerged title " "$pfx" "$cur"; return ;; difftool.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp "cmd path" "$pfx" "$cur"; return ;; man.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp "cmd path" "$pfx" "$cur"; return ;; mergetool.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp "cmd path trustExitCode" "$pfx" "$cur"; return ;; pager.*) local pfx="${cur%.*}."; cur="${cur#*.}"; __git_compute_all_commands; __gitcomp "$__git_all_commands" "$pfx" "$cur"; return ;; remote.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp " url proxy fetch push mirror skipDefaultUpdate receivepack uploadpack tagopt pushurl " "$pfx" "$cur"; return ;; remote.*) local pfx="${cur%.*}."; cur="${cur#*.}"; __gitcomp "$(__git_remotes)" "$pfx" "$cur" "."; return ;; url.*.*) local pfx="${cur%.*}."; cur="${cur##*.}"; __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur"; return ;; esac; __gitcomp " add.ignoreErrors advice.commitBeforeMerge advice.detachedHead advice.implicitIdentity advice.pushNonFastForward advice.resolveConflict advice.statusHints alias. am.keepcr apply.ignorewhitespace apply.whitespace branch.autosetupmerge branch.autosetuprebase browser. clean.requireForce color.branch color.branch.current color.branch.local color.branch.plain color.branch.remote color.decorate.HEAD color.decorate.branch color.decorate.remoteBranch color.decorate.stash color.decorate.tag color.diff color.diff.commit color.diff.frag color.diff.func color.diff.meta color.diff.new color.diff.old color.diff.plain color.diff.whitespace color.grep color.grep.context color.grep.filename color.grep.function color.grep.linenumber color.grep.match color.grep.selected color.grep.separator color.interactive color.interactive.error color.interactive.header color.interactive.help color.interactive.prompt color.pager color.showbranch color.status color.status.added color.status.changed color.status.header color.status.nobranch color.status.untracked color.status.updated color.ui commit.status commit.template core.abbrevguard core.askpass core.attributesfile core.autocrlf core.bare core.bigFileThreshold core.compression core.createObject core.deltaBaseCacheLimit core.editor core.eol core.excludesfile core.fileMode core.fsyncobjectfiles core.gitProxy core.ignoreCygwinFSTricks core.ignoreStat core.ignorecase core.logAllRefUpdates core.loosecompression core.notesRef core.packedGitLimit core.packedGitWindowSize core.pager core.preferSymlinkRefs core.preloadindex core.quotepath core.repositoryFormatVersion core.safecrlf core.sharedRepository core.sparseCheckout core.symlinks core.trustctime core.warnAmbiguousRefs core.whitespace core.worktree diff.autorefreshindex diff.external diff.ignoreSubmodules diff.mnemonicprefix diff.noprefix diff.renameLimit diff.renames diff.suppressBlankEmpty diff.tool diff.wordRegex difftool. difftool.prompt fetch.recurseSubmodules fetch.unpackLimit format.attach format.cc format.headers format.numbered format.pretty format.signature format.signoff format.subjectprefix format.suffix format.thread format.to gc. gc.aggressiveWindow gc.auto gc.autopacklimit gc.packrefs gc.pruneexpire gc.reflogexpire gc.reflogexpireunreachable gc.rerereresolved gc.rerereunresolved gitcvs.allbinary gitcvs.commitmsgannotation gitcvs.dbTableNamePrefix gitcvs.dbdriver gitcvs.dbname gitcvs.dbpass gitcvs.dbuser gitcvs.enabled gitcvs.logfile gitcvs.usecrlfattr guitool. gui.blamehistoryctx gui.commitmsgwidth gui.copyblamethreshold gui.diffcontext gui.encoding gui.fastcopyblame gui.matchtrackingbranch gui.newbranchtemplate gui.pruneduringfetch gui.spellingdictionary gui.trustmtime help.autocorrect help.browser help.format http.lowSpeedLimit http.lowSpeedTime http.maxRequests http.minSessions http.noEPSV http.postBuffer http.proxy http.sslCAInfo http.sslCAPath http.sslCert http.sslCertPasswordProtected http.sslKey http.sslVerify http.useragent i18n.commitEncoding i18n.logOutputEncoding imap.authMethod imap.folder imap.host imap.pass imap.port imap.preformattedHTML imap.sslverify imap.tunnel imap.user init.templatedir instaweb.browser instaweb.httpd instaweb.local instaweb.modulepath instaweb.port interactive.singlekey log.date log.decorate log.showroot mailmap.file man. man.viewer merge. merge.conflictstyle merge.log merge.renameLimit merge.renormalize merge.stat merge.tool merge.verbosity mergetool. mergetool.keepBackup mergetool.keepTemporaries mergetool.prompt notes.displayRef notes.rewrite. notes.rewrite.amend notes.rewrite.rebase notes.rewriteMode notes.rewriteRef pack.compression pack.deltaCacheLimit pack.deltaCacheSize pack.depth pack.indexVersion pack.packSizeLimit pack.threads pack.window pack.windowMemory pager. pretty. pull.octopus pull.twohead push.default rebase.autosquash rebase.stat receive.autogc receive.denyCurrentBranch receive.denyDeleteCurrent receive.denyDeletes receive.denyNonFastForwards receive.fsckObjects receive.unpackLimit receive.updateserverinfo remotes. repack.usedeltabaseoffset rerere.autoupdate rerere.enabled sendemail. sendemail.aliasesfile sendemail.aliasfiletype sendemail.bcc sendemail.cc sendemail.cccmd sendemail.chainreplyto sendemail.confirm sendemail.envelopesender sendemail.from sendemail.identity sendemail.multiedit sendemail.signedoffbycc sendemail.smtpdomain sendemail.smtpencryption sendemail.smtppass sendemail.smtpserver sendemail.smtpserveroption sendemail.smtpserverport sendemail.smtpuser sendemail.suppresscc sendemail.suppressfrom sendemail.thread sendemail.to sendemail.validate showbranch.default status.relativePaths status.showUntrackedFiles status.submodulesummary submodule. tar.umask transfer.unpackLimit url. user.email user.name user.signingkey web.browser branch. remote. " } _git_describe () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --all --tags --contains --abbrev= --candidates= --exact-match --debug --long --match --always "; return ;; esac; __gitcomp "$(__git_refs)" } _git_diff () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index $__git_diff_common_options "; return ;; esac; __git_complete_revlist_file } _git_difftool () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"; return ;; --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-renames --diff-filter= --find-copies-harder --relative --ignore-submodules --tool="; return ;; esac; __git_complete_file } _git_fetch () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "$__git_fetch_options"; return ;; esac; __git_complete_remote_or_refspec } _git_format_patch () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --thread=*) __gitcomp " deep shallow " "" "${cur##--thread=}"; return ;; --*) __gitcomp " --stdout --attach --no-attach --thread --thread= --output-directory --numbered --start-number --numbered-files --keep-subject --signoff --signature --no-signature --in-reply-to= --cc= --full-index --binary --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix= --inline --suffix= --ignore-if-in-upstream --subject-prefix= "; return ;; esac; __git_complete_revlist } _git_fsck () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --tags --root --unreachable --cache --no-reflogs --full --strict --verbose --lost-found "; return ;; esac; COMPREPLY=() } _git_gc () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--prune --aggressive"; return ;; esac; COMPREPLY=() } _git_gitk () { _gitk } _git_grep () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --cached --text --ignore-case --word-regexp --invert-match --full-name --extended-regexp --basic-regexp --fixed-strings --files-with-matches --name-only --files-without-match --max-depth --count --and --or --not --all-match "; return ;; esac; __gitcomp "$(__git_refs)" } _git_help () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--all --info --man --web"; return ;; esac; __git_compute_all_commands; __gitcomp "$__git_all_commands $(__git_aliases) attributes cli core-tutorial cvs-migration diffcore gitk glossary hooks ignore modules repository-layout tutorial tutorial-2 workflows " } _git_init () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --shared=*) __gitcomp " false true umask group all world everybody " "" "${cur##--shared=}"; return ;; --*) __gitcomp "--quiet --bare --template= --shared --shared="; return ;; esac; COMPREPLY=() } _git_log () { __git_has_doubledash && return; local g="$(git rev-parse --git-dir 2>/dev/null)"; local merge=""; if [ -f "$g/MERGE_HEAD" ]; then merge="--merge"; fi; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --pretty=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur##--pretty=}"; return ;; --format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur##--format=}"; return ;; --date=*) __gitcomp "$__git_log_date_formats" "" "${cur##--date=}"; return ;; --decorate=*) __gitcomp "long short" "" "${cur##--decorate=}"; return ;; --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options $__git_log_gitk_options --root --topo-order --date-order --reverse --follow --full-diff --abbrev-commit --abbrev= --relative-date --date= --pretty= --format= --oneline --cherry-pick --graph --decorate --decorate= --walk-reflogs --parents --children $merge $__git_diff_common_options --pickaxe-all --pickaxe-regex "; return ;; esac; __git_complete_revlist } _git_ls_files () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--cached --deleted --modified --others --ignored --stage --directory --no-empty-directory --unmerged --killed --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --error-unmatch --with-tree= --full-name --abbrev --ignored --exclude-per-directory "; return ;; esac; COMPREPLY=() } _git_ls_remote () { __gitcomp "$(__git_remotes)" } _git_ls_tree () { __git_complete_file } _git_merge () { __git_complete_strategy && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "$__git_merge_options"; return ;; esac; __gitcomp "$(__git_refs)" } _git_merge_base () { __gitcomp "$(__git_refs)" } _git_mergetool () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --tool=*) __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"; return ;; --*) __gitcomp "--tool="; return ;; esac; COMPREPLY=() } _git_mv () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--dry-run"; return ;; esac; COMPREPLY=() } _git_name_rev () { __gitcomp "--tags --all --stdin" } _git_notes () { local subcommands='add append copy edit list prune remove show'; local subcommand="$(__git_find_on_cmdline "$subcommands")"; local cur words cword; _get_comp_words_by_ref -n =: cur words cword; case "$subcommand,$cur" in ,--*) __gitcomp '--ref' ;; ,*) case "${words[cword-1]}" in --ref) __gitcomp "$(__git_refs)" ;; *) __gitcomp "$subcommands --ref" ;; esac ;; add,--reuse-message=* | append,--reuse-message=*) __gitcomp "$(__git_refs)" "" "${cur##--reuse-message=}" ;; add,--reedit-message=* | append,--reedit-message=*) __gitcomp "$(__git_refs)" "" "${cur##--reedit-message=}" ;; add,--* | append,--*) __gitcomp '--file= --message= --reedit-message= --reuse-message=' ;; copy,--*) __gitcomp '--stdin' ;; prune,--*) __gitcomp '--dry-run --verbose' ;; prune,*) ;; *) case "${words[cword-1]}" in -m | -F) ;; *) __gitcomp "$(__git_refs)" ;; esac ;; esac } _git_pull () { __git_complete_strategy && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --rebase --no-rebase $__git_merge_options $__git_fetch_options "; return ;; esac; __git_complete_remote_or_refspec } _git_push () { local cur prev; _get_comp_words_by_ref -n =: cur prev; case "$prev" in --repo) __gitcomp "$(__git_remotes)"; return ;; esac; case "$cur" in --repo=*) __gitcomp "$(__git_remotes)" "" "${cur##--repo=}"; return ;; --*) __gitcomp " --all --mirror --tags --dry-run --force --verbose --receive-pack= --repo= "; return ;; esac; __git_complete_remote_or_refspec } _git_rebase () { local dir="$(__gitdir)"; local cur; _get_comp_words_by_ref -n =: cur; if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then __gitcomp "--continue --skip --abort"; return; fi; __git_complete_strategy && return; case "$cur" in --whitespace=*) __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"; return ;; --*) __gitcomp " --onto --merge --strategy --interactive --preserve-merges --stat --no-stat --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= --autosquash "; return ;; esac; __gitcomp "$(__git_refs)" } _git_reflog () { local subcommands="show delete expire"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; else __gitcomp "$(__git_refs)"; fi } _git_remote () { local subcommands="add rename rm show prune update set-head"; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; return; fi; case "$subcommand" in rename | rm | show | prune) __gitcomp "$(__git_remotes)" ;; update) local i c='' IFS=' '; for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do i="${i#remotes.}"; c="$c ${i/ */}"; done; __gitcomp "$c" ;; *) COMPREPLY=() ;; esac } _git_replace () { __gitcomp "$(__git_refs)" } _git_reset () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--merge --mixed --hard --soft --patch"; return ;; esac; __gitcomp "$(__git_refs)" } _git_revert () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--edit --mainline --no-edit --no-commit --signoff"; return ;; esac; __gitcomp "$(__git_refs)" } _git_rm () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--cached --dry-run --ignore-unmatch --quiet"; return ;; esac; COMPREPLY=() } _git_send_email () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --confirm=*) __gitcomp " $__git_send_email_confirm_options " "" "${cur##--confirm=}"; return ;; --suppress-cc=*) __gitcomp " $__git_send_email_suppresscc_options " "" "${cur##--suppress-cc=}"; return ;; --smtp-encryption=*) __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"; return ;; --*) __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender --from --identity --in-reply-to --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port --smtp-encryption= --smtp-user --subject --suppress-cc= --suppress-from --thread --to --validate --no-validate"; return ;; esac; COMPREPLY=() } _git_shortlog () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_shortlog_options --numbered --summary "; return ;; esac; __git_complete_revlist } _git_show () { __git_has_doubledash && return; local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --pretty=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur##--pretty=}"; return ;; --format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) " "" "${cur##--format=}"; return ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --oneline $__git_diff_common_options "; return ;; esac; __git_complete_file } _git_show_branch () { local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " --all --remotes --topo-order --current --more= --list --independent --merge-base --no-name --color --no-color --sha1-name --sparse --topics --reflog "; return ;; esac; __git_complete_revlist } _git_stage () { _git_add } _git_stash () { local cur; _get_comp_words_by_ref -n =: cur; local save_opts='--keep-index --no-keep-index --quiet --patch'; local subcommands='save list show apply clear drop pop create branch'; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "$save_opts" ;; *) if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then __gitcomp "$subcommands"; else COMPREPLY=(); fi ;; esac; else case "$subcommand,$cur" in save,--*) __gitcomp "$save_opts" ;; apply,--* | pop,--*) __gitcomp "--index --quiet" ;; show,--* | drop,--* | branch,--*) COMPREPLY=() ;; show,* | apply,* | drop,* | pop,* | branch,*) __gitcomp "$(git --git-dir="$(__gitdir)" stash list | sed -n -e 's/:.*//p')" ;; *) COMPREPLY=() ;; esac; fi } _git_submodule () { __git_has_doubledash && return; local subcommands="add status init update summary foreach sync"; if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then local cur; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp "--quiet --cached" ;; *) __gitcomp "$subcommands" ;; esac; return; fi } _git_svn () { local subcommands=" init fetch clone rebase dcommit log find-rev set-tree commit-diff info create-ignore propget proplist show-ignore show-externals branch tag blame migrate mkdirs reset gc "; local subcommand="$(__git_find_on_cmdline "$subcommands")"; if [ -z "$subcommand" ]; then __gitcomp "$subcommands"; else local remote_opts="--username= --config-dir= --no-auth-cache"; local fc_opts=" --follow-parent --authors-file= --repack= --no-metadata --use-svm-props --use-svnsync-props --log-window-size= --no-checkout --quiet --repack-flags --use-log-author --localtime --ignore-paths= $remote_opts "; local init_opts=" --template= --shared= --trunk= --tags= --branches= --stdlayout --minimize-url --no-metadata --use-svm-props --use-svnsync-props --rewrite-root= --prefix= --use-log-author --add-author-from $remote_opts "; local cmt_opts=" --edit --rmdir --find-copies-harder --copy-similarity= "; local cur; _get_comp_words_by_ref -n =: cur; case "$subcommand,$cur" in fetch,--*) __gitcomp "--revision= --fetch-all $fc_opts" ;; clone,--*) __gitcomp "--revision= $fc_opts $init_opts" ;; init,--*) __gitcomp "$init_opts" ;; dcommit,--*) __gitcomp " --merge --strategy= --verbose --dry-run --fetch-all --no-rebase --commit-url --revision $cmt_opts $fc_opts " ;; set-tree,--*) __gitcomp "--stdin $cmt_opts $fc_opts" ;; create-ignore,--* | propget,--* | proplist,--* | show-ignore,--* | show-externals,--* | mkdirs,--*) __gitcomp "--revision=" ;; log,--*) __gitcomp " --limit= --revision= --verbose --incremental --oneline --show-commit --non-recursive --authors-file= --color " ;; rebase,--*) __gitcomp " --merge --verbose --strategy= --local --fetch-all --dry-run $fc_opts " ;; commit-diff,--*) __gitcomp "--message= --file= --revision= $cmt_opts" ;; info,--*) __gitcomp "--url" ;; branch,--*) __gitcomp "--dry-run --message --tag" ;; tag,--*) __gitcomp "--dry-run --message" ;; blame,--*) __gitcomp "--git-format" ;; migrate,--*) __gitcomp " --config-dir= --ignore-paths= --minimize --no-auth-cache --username= " ;; reset,--*) __gitcomp "--revision= --parent" ;; *) COMPREPLY=() ;; esac; fi } _git_tag () { local i c=1 f=0; local words cword prev; _get_comp_words_by_ref -n =: words cword prev; while [ $c -lt $cword ]; do i="${words[c]}"; case "$i" in -d | -v) __gitcomp "$(__git_tags)"; return ;; -f) f=1 ;; esac; c=$((++c)); done; case "$prev" in -m | -F) COMPREPLY=() ;; -* | tag) if [ $f = 1 ]; then __gitcomp "$(__git_tags)"; else COMPREPLY=(); fi ;; *) __gitcomp "$(__git_refs)" ;; esac } _git_whatchanged () { _git_log } _gitk () { if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash; setopt KSH_TYPESET; typeset -h words; fi; __git_has_doubledash && return; local cur; local g="$(__gitdir)"; local merge=""; if [ -f "$g/MERGE_HEAD" ]; then merge="--merge"; fi; _get_comp_words_by_ref -n =: cur; case "$cur" in --*) __gitcomp " $__git_log_common_options $__git_log_gitk_options $merge "; return ;; esac; __git_complete_revlist } _gpasswd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -a | -d | -A | -M) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -d -r -R -A -M' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -g -- "$cur" )) } _gpg () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -s | --sign | --clearsign | --decrypt-files | --load-extension) _filedir; return 0 ;; --export | --sign-key | --lsignkey | --nrsignkey | --nrlsignkey | --editkey) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" )); return 0 ;; -r | --recipient) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )); if [ -e ~/.gnupg/gpg.conf ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur")); fi; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '$(gpg --dump-options)' -- "$cur" )); fi } _groupadd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -g | --gid | -K | --key | -p | --password) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--force --gid --help \ --key --non-unique --password --system' -- "$cur" )); return 0; fi } _groupmod () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -g | --gid | -h | --help | -n | --new-name | -p | --password) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--gid --help --new-name \ --non-unique --password' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -g -- "$cur" )) } _growisofs () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -version | -speed) return 0 ;; -Z | -M) compopt -o nospace &>/dev/null; _dvd_devices; return 0 ;; /?(r)dev/*) if [[ $cur == =* ]]; then cur="${cur#=}"; _filedir; return 0; fi ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-dvd-compat -overburn -speed= -Z -M' -- "$cur" )); [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null; return 0; fi; _filedir } _grpck () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r -s' -- "$cur" )); return 0; fi; _filedir } _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_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; _filedir; fi } _grub_mkconfig () { local cur prev; COMPREPLY=(); cur=`_get_cword`; if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)"; else _filedir; fi } _grub_mkfont () { local cur; COMPREPLY=(); cur=`_get_cword`; if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)"; else _filedir; fi } _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) 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 _filedir; fi } _grub_mkpasswd-pbkdf2 () { local cur; COMPREPLY=(); cur=`_get_cword`; if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)"; else _filedir; fi } _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; _filedir; fi } _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) 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 _filedir; fi } _grub_script-check () { local cur; COMPREPLY=(); cur=`_get_cword`; if [[ "$cur" == -* ]]; then __grubcomp "$(__grub_get_options_from_help)"; else _filedir; fi } _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 __grub_list_menuentries; fi } _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 _filedir; fi } _gzip () { local cur prev xspec helpopts; COMPREPLY=(); _get_comp_words_by_ref cur prev; helpopts=`_parse_help ${COMP_WORDS[0]}`; case $prev in -b | --blocksize | -p | --processes | -S | --suffix | -h | --help | -V | --version) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" -- "$cur" )); return 0; fi; local IFS=' '; xspec="*.@(gz|t[ag]z)"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --force ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec; [[ "$prev" == -*f* ]] && xspec=; else if [[ "$prev" == '>' || "$prev" == '>>' ]]; then xspec=; else if [ "$prev" = '<' ]; then xspec=; fi; fi; fi; fi; _expand || return 0; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _hciattach () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-n -p -t -b -s -l' -- "$cur" )); else _count_args; case $args in 1) COMPREPLY=($( printf '%s\n' /dev/tty* )); COMPREPLY=($( compgen -W '${COMPREPLY[@]} \ ${COMPREPLY[@]#/dev/}' -- "$cur" )) ;; 2) COMPREPLY=($( compgen -W 'any ericsson digi \ xircom csr bboxes swave bcsp 0x0105 \ 0x080a 0x0160 0x0002' -- "$cur" )) ;; 3) COMPREPLY=($( compgen -W '9600 19200 38400 \ 57600 115200 230400 460800 921600' -- "$cur" )) ;; 4) COMPREPLY=($( compgen -W 'flow noflow' -- "$cur" )) ;; 5) _bluetooth_adresses ;; esac; fi } _hciconfig () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --all' -- "$cur" )); else COMPREPLY=($( compgen -W 'up down reset rstat auth \ noauth encrypt noencrypt secmgr nosecmgr \ piscan noscan iscan pscan ptype name class \ voice iac inqmode inqdata inqtype inqparams \ pageparms pageto afhmode aclmtu scomtu putkey \ delkey commands features version revision lm' -- "$cur" )); fi; else case $arg in putkey | delkey) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; fi ;; lm) _count_args; if [ $args -eq 2 ]; then COMPREPLY=($( compgen -W 'MASTER \ SLAVE NONE ACCEPT' -- "$cur" )); fi ;; ptype) _count_args; if [ $args -eq 2 ]; then _bluetooth_packet_types; fi ;; esac; fi } _hcitool () { local cur prev split=false arg; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -i) _bluetooth_devices; return 0 ;; --role) COMPREPLY=($( compgen -W 'm s' -- "$cur" )); return 0 ;; --pkt-type) _bluetooth_packet_types; return 0 ;; esac; $split && return 0; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help -i' -- "$cur" )); else COMPREPLY=($( compgen -W 'dev inq scan name info \ spinq epinq cmd con cc dc sr cpt rssi lq tpl \ afh lst auth enc key clkoff clock' -- "$cur" )); fi; else case $arg in name | info | dc | rssi | lq | afh | auth | key | clkoff | lst) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; fi ;; cc) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--role --pkt-type' -- "$cur" )); else _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; fi; fi ;; sr) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; else COMPREPLY=($( compgen -W 'master slave' -- "$cur" )); fi ;; cpt) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; else _bluetooth_packet_types; fi ;; tpl | enc | clock) _count_args; if [ $args -eq 2 ]; then _bluetooth_adresses; else COMPREPLY=($( compgen -W '0 1' -- "$cur" )); fi ;; esac; fi } _hid2hci () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help --quiet -0 --tohci -1 \ --tohid' -- "$cur" )); fi } _iconv () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -'?' | --help | --usage | -V | --version | --unicode-subst | --byte-subst | --widechar-subst) return 0 ;; -f | --from-code | -t | --to-code) COMPREPLY=($( compgen -W '$( iconv -l | \ sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" )); return 0 ;; -o | --output) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W '--from-code --to-code --list -c --unicode-subst --byte-subst --widechar-subst --output --silent --verbose --help --usage --version' -- "$cur" )); return 0; fi } _id () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -g --group -G --groups -n --name\ -r --real -u --user --help --version' -- "$cur" )); else COMPREPLY=($( compgen -u "$cur" )); fi } _ifupdown () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then _configured_interfaces; COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur")); fi; return 0 } _info () { local cur i infopath; COMPREPLY=(); _get_comp_words_by_ref cur; _expand || return 0; if [[ "$cur" == */* ]]; then _filedir; return 0; fi; infopath='/usr/share/info'; if [ "${INFOPATH: -1:1}" == ':' ]; then infopath=${INFOPATH}${infopath}; else if [ ${INFOPATH:+set} ]; then infopath=$INFOPATH; fi; fi; infopath=$infopath:; if [ -n "$cur" ]; then infopath="${infopath//://$cur* }"; else infopath="${infopath//:// }"; fi; COMPREPLY=($( eval command ls "$infopath" 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]##*/?(:)}); for ((i=0 ; i < ${#COMPREPLY[@]} ; ++i )) do if [ "${COMPREPLY[$i]}" == 'dir' ]; then unset COMPREPLY[$i]; fi; done; COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|xz|lzma)}); COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" )); return 0 } _insmod () { local cur prev modpath; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then _installed_modules "$cur"; return 0; fi; if [[ "$cur" == */* ]]; then _filedir '@(?(k)o?(.gz))'; return 0; fi; if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then COMPREPLY=($( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | cut -d: -f1 )" -- "$cur" )); else _modules $(uname -r); fi; return 0 } _installed_alternatives () { local admindir; for i in alternatives dpkg/alternatives rpm/alternatives; do [ -d /var/lib/$i ] && admindir=/var/lib/$i && break; done; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == --admindir ]]; then admindir=${COMP_WORDS[i+1]}; break; fi; done; COMPREPLY=($( compgen -W '$( command ls $admindir )' -- "$cur" )) } _installed_modules () { COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}' )" -- "$1" )) } _invoke_rc_d () { local cur prev sysvdir services options valid_options; _get_comp_words_by_ref cur prev; [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; services=($( printf '%s ' $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save)) )); services=(${services[@]#$sysvdir/}); options=(--help --quiet --force --try-anyway --disclose-deny --query --no-fallback); if [[ ( $COMP_CWORD -eq 1 ) || ( "$prev" == --* ) ]]; then valid_options=($( tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" | sed -ne "/$( sed "s/ /\\\\|/g" <<<"${options[@]}" )/p" | sort | uniq -u )); COMPREPLY=($( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" )); else if [ -x $sysvdir/$prev ]; then COMPREPLY=($( compgen -W '`sed -e "y/|/ /" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ $sysvdir/$prev`' -- "$cur" )); else COMPREPLY=(); fi; fi; return 0 } _ip () { COMPREPLY=(); local cur prev words cword; _get_comp_words_by_ref cur prev words cword; case $prev in -V | -Version | -rc | -rcvbuf) return 0 ;; -f | -family) COMPREPLY=($( compgen -W 'inet inet6 ipx dnet link' -- "$cur" )); return 0 ;; -b | -batch) _filedir; return 0 ;; -force) COMPREPLY=($( compgen -W '-batch' -- "$cur" )); return 0 ;; esac; 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]} != -@(f?(amily)|rc?(vbuf)) ]] && cmd=${words[subcword]}; done; if [[ -z $cmd ]]; then case $cur in -*) local c="-Version -statistics -details -resolve -family -oneline -timestamp -batch -rcvbuf"; [[ $cword -eq 1 ]] && c="$c -force"; COMPREPLY=($( compgen -W "$c" -- "$cur" )); return 0 ;; *) COMPREPLY=($( compgen -W "help $( ip help 2>&1 | sed -e '/OBJECT := /,/}/!d' -e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" )); return 0 ;; esac; fi; [[ $subcmd == help ]] && return 0; case $cmd in link) case $subcmd in add) ;; delete) case $(($cword-$subcword)) in 1) _available_interfaces ;; 2) COMPREPLY=($( compgen -W 'type' -- "$cur" )) ;; 3) [[ $prev == type ]] && COMPREPLY=($( compgen -W 'vlan veth vcan dummy ifb macvlan can' -- "$cur" )) ;; esac ;; set) if [[ $cword-$subcword -eq 1 ]]; then _available_interfaces; else case $prev in arp | dynamic | multicast | allmulticast | promisc | trailers) COMPREPLY=($( compgen -W 'on off' -- "$cur" )) ;; txqueuelen | name | address | broadcast | mtu | netns | alias) ;; *) local c="arp dynamic multicast allmulticast promisc trailers txqueuelen name address broadcast mtu netns alias"; [[ $prev != @(up|down) ]] && c="$c up down"; COMPREPLY=($( compgen -W "$c" -- "$cur" )) ;; esac; fi ;; show) [[ $cword -eq $subcword+1 ]] && _available_interfaces ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add delete set show' -- "$cur" )) ;; esac ;; addr) case $subcmd in add | change | replace) ;; del) ;; show | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add change replace del show flush' -- "$cur" )) ;; esac ;; addrlabel) case $subcmd in list | add | del | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list add del flush' -- "$cur" )) ;; esac ;; route) case $subcmd in list | flush) ;; get) ;; add | del | change | append | replace | monitor) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list flush get add del change append replace monitor' -- "$cur" )) ;; esac ;; rule) case $subcmd in list | add | del | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help list add del flush' -- "$cur" )) ;; esac ;; neigh) case $subcmd in add | del | change | replace) ;; show | flush) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add del change replace show flush' -- "$cur" )) ;; esac ;; ntable) case $subcmd in change) ;; show) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help change show' -- "$cur" )) ;; esac ;; tunnel) case $subcmd in add | change | del | show | prl | 6rd) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add change del show prl 6rd' -- "$cur" )) ;; esac ;; maddr) case $subcmd in add | del) ;; show) if [[ $cword -eq $subcword+1 || $prev == dev ]]; then _available_interfaces; [[ $prev != dev ]] && COMPREPLY=($( compgen -W '${COMPREPLY[@]} dev' -- "$cur" )); fi ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help add del show' -- "$cur" )) ;; esac ;; mroute) case $subcmd in show) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help show' -- "$cur" )) ;; esac ;; monitor) case $subcmd in all) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'help all' -- "$cur" )) ;; esac ;; xfrm) case $subcmd in state | policy | monitor) ;; *) [[ $cword -eq $subcword ]] && COMPREPLY=($( compgen -W 'state policy monitor' -- "$cur" )) ;; esac ;; esac } _iptables () { local cur prev table chain; COMPREPLY=(); _get_comp_words_by_ref cur prev; chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'; if [[ $COMP_LINE == *-t\ *filter* ]]; then table="-t filter"; else if [[ $COMP_LINE == *-t\ *nat* ]]; then table="-t nat"; else if [[ $COMP_LINE == *-t\ *mangle* ]]; then table="-t mangle"; fi; fi; fi; _split_longopt; case $prev in -*[AIDRPFXLZ]) COMPREPLY=($( compgen -W '`iptables $table -nL | \ sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" )) ;; -*t) COMPREPLY=($( compgen -W 'nat filter mangle' -- "$cur" )) ;; -j) if [[ "$table" == "-t filter" || -z "$table" ]]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- "$cur" )); else if [ "$table" = "-t nat" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' -- "$cur" )); else if [ "$table" = "-t mangle" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MARK TOS `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- "$cur" )); fi; fi; fi ;; *) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--in-interface --out-interface --source \ --destination --protocol --fragment --match --append \ --delete --insert --replace --list --flush --zero --new \ --delete-chain --policy --rename-chain --proto --source \ --destination --in-interface --jump --match --numeric \ --out-interface --table --verbose --line-numbers --exact \ --fragment --modprobe --set-counters --version' -- "$cur")); fi ;; esac } _iwconfig () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; 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[@]}" $( compgen -W "$( iwlist ${COMP_WORDS[1]} scan | awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" )); fi; return 0 ;; nwid) COMPREPLY=($( compgen -W 'on off' -- "$cur" )); return 0 ;; channel) COMPREPLY=($( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | awk '/^[ \t]*Channel/ {print $2}' )" -- "$cur" )); return 0 ;; freq) COMPREPLY=($( compgen -W "$( iwlist ${COMP_WORDS[1]} channel | awk '/^[ \t]*Channel/ {print $4"G"}')" -- "$cur" )); return 0 ;; ap) COMPREPLY=($( compgen -W 'on off any' -- "$cur" )); if [ -n "${COMP_IWLIST_SCAN:-}" ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( iwlist ${COMP_WORDS[1]} scan | awk -F ': ' '/Address/ {print $2}' )" -- "$cur" )); fi; return 0 ;; rate) COMPREPLY=($( compgen -W 'auto fixed' -- "$cur" )); COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( iwlist ${COMP_WORDS[1]} rate | awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" )); return 0 ;; rts | frag) COMPREPLY=($( compgen -W 'auto fixed off' -- "$cur" )); return 0 ;; key | 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 } _iwlist () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; 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 } _iwpriv () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; 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 } _iwspy () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; 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 } _java () { local cur prev words cword i; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev words cword; for ((i=1; i < $cword; i++)) do case ${words[$i]} in -cp | -classpath) ((i++)) ;; -*) ;; *) _filedir; return 0 ;; esac; done; case $cur in -verbose:*) COMPREPLY=($( compgen -W 'class gc jni' -- "${cur#*:}" )); return 0 ;; -javaagent:*) cur=${cur#*:}; _filedir '@(jar|zip)'; return 0 ;; -agentpath:*) cur=${cur#*:}; _filedir so; return 0 ;; -splash:*) cur=${cur#*:}; _filedir '@(gif|jp?(e)g|png)'; return 0 ;; -Xbootclasspath*:*) _java_path; return 0 ;; -Xcheck:*) COMPREPLY=($( compgen -W 'jni' -- "${cur#*:}" )); return 0 ;; -Xgc:*) COMPREPLY=($( compgen -W 'singlecon gencon singlepar genpar' -- "${cur#*:}" )); return 0 ;; -Xgcprio:*) COMPREPLY=($( compgen -W 'throughput pausetime deterministic' -- "${cur#*:}" )); return 0 ;; -Xloggc:* | -Xverboselog:*) cur=${cur#*:}; _filedir; return 0 ;; -Xshare:*) COMPREPLY=($( compgen -W 'auto off on' -- "${cur#*:}" )); return 0 ;; -Xverbose:*) COMPREPLY=($( compgen -W 'memory load jni cpuinfo codegen opt gcpause gcreport' -- "${cur#*:}" )); return 0 ;; -Xverify:*) COMPREPLY=($( compgen -W 'all none remote' -- "${cur#*:}" )); return 0 ;; -D* | -*:*) return 0 ;; esac; case $prev in -cp | -classpath) _java_path; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-client -server -agentlib: -agentpath: -classpath -D -d32 -d64 -enableassertions -disableassertions -enablesystemassertions -disablesystemassertions -jar -javaagent: -verbose -verbose -version -showversion -help -X' -- "$cur" )); else if [[ "$prev" == -jar ]]; then _filedir jar; else _java_classes; fi; fi; [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && type compopt &>/dev/null && compopt -o nospace; __ltrim_colon_completions "$cur" } _java_classes () { local classpath i; _java_find_classpath; cur=${cur//.//}; for i in ${classpath//:/ }; do if [[ "$i" == *.@(jar|zip) && -r $i ]]; then if type zipinfo &>/dev/null; then COMPREPLY=("${COMPREPLY[@]}" $( zipinfo -1 "$i" "$cur*" 2>/dev/null | command grep '^[^$]*\.class$' )); else COMPREPLY=("${COMPREPLY[@]}" $( jar tf "$i" "$cur" | command grep '^[^$]*\.class$' )); fi; else if [ -d $i ]; then COMPREPLY=("${COMPREPLY[@]}" $( command ls $i/$cur*.class 2>/dev/null | sed -ne '/\$/d' -e "s|^$i//*||p" )); fi; fi; done; COMPREPLY=(${COMPREPLY[@]%.class}); COMPREPLY=(${COMPREPLY[@]//\//.}) } _java_find_classpath () { local i; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then classpath=${COMP_WORDS[i+1]}; break; fi; done; [ -z "$classpath" ] && classpath=$CLASSPATH; [ -z "$classpath" ] && classpath=. } _java_find_sourcepath () { local i; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then sourcepath=${COMP_WORDS[i+1]}; break; fi; done; if [ -z "$sourcepath" ]; then _java_find_classpath; sourcepath=$classpath; fi } _java_packages () { local sourcepath i; _java_find_sourcepath; cur=${cur//.//}; for i in ${sourcepath//:/ }; do if [ -d $i ]; then COMPREPLY=("${COMPREPLY[@]}" $( command ls -F -d $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' )); fi; done; COMPREPLY=($( tr " " "\n" <<<"${COMPREPLY[@]}" | command grep "/$" )); COMPREPLY=(${COMPREPLY[@]%/}); cur=${COMPREPLY[@]//\//.} } _java_path () { cur=${cur##*:}; _filedir '@(jar|zip)' } _javaws () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -help | -license | -about | -viewer | -arg | -param | -property | -update | -umask) return 0 ;; -basedir | -codebase) _filedir -d; return 0 ;; -uninstall | -import) _filedir jnlp; return 0 ;; esac; if [[ $cur == -* ]]; then COMPREPLY=($( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" )); return 0; fi; _filedir jnlp } _kernel_versions () { COMPREPLY=($( compgen -W '$( command ls /lib/modules )' -- "$cur" )) } _kernels () { COMPREPLY=($( cd /lib/modules && compgen -d -- "$cur" )) } _kill () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then _signals; else _pids; fi } _killall () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then _signals; else _pnames; fi; return 0 } _known_hosts () { local options; COMPREPLY=(); [[ "$1" == -a || "$2" == -a ]] && options=-a; [[ "$1" == -c || "$2" == -c ]] && options="$options -c"; _known_hosts_real $options "$(_get_cword :)" } _known_hosts_real () { local configfile flag prefix; local cur curd awkcur user suffix aliases i host; local -a kh khd config; local OPTIND=1; while getopts "acF:p:" flag "$@"; do case $flag in a) aliases='yes' ;; c) suffix=':' ;; F) configfile=$OPTARG ;; p) prefix=$OPTARG ;; esac; done; [ $# -lt $OPTIND ] && echo "error: $FUNCNAME: missing mandatory argument CWORD"; cur=${!OPTIND}; let "OPTIND += 1"; [ $# -ge $OPTIND ] && echo "error: $FUNCNAME("$@"): unprocessed arguments:" $(while [ $# -ge $OPTIND ]; do printf '%s\n' ${!OPTIND}; shift; done); [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}; kh=(); if [ -n "$configfile" ]; then [ -r "$configfile" ] && config=("${config[@]}" "$configfile"); else for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" "${HOME}/.ssh2/config"; do [ -r $i ] && config=("${config[@]}" "$i"); done; fi; if [ ${#config[@]} -gt 0 ]; then local OIFS=$IFS IFS=' '; local -a tmpkh; tmpkh=($( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u )); for i in "${tmpkh[@]}"; do i=${i//\"}; __expand_tilde_by_ref i; [ -r "$i" ] && kh=("${kh[@]}" "$i"); done; IFS=$OIFS; fi; if [ -z "$configfile" ]; then for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts ~/.ssh/known_hosts2; do [ -r $i ] && kh=("${kh[@]}" $i); done; for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do [ -d $i ] && khd=("${khd[@]}" $i/*pub); done; fi; if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then awkcur=${cur//\//\\\/}; awkcur=${awkcur//\./\\\.}; curd=$awkcur; if [[ "$awkcur" == [0-9]*[.:]* ]]; then awkcur="^$awkcur[.:]*"; else if [[ "$awkcur" == [0-9]* ]]; then awkcur="^$awkcur.*[.:]"; else if [ -z "$awkcur" ]; then awkcur="[a-z.:]"; else awkcur="^$awkcur"; fi; fi; fi; if [ ${#kh[@]} -gt 0 ]; then COMPREPLY=("${COMPREPLY[@]}" $( awk 'BEGIN {FS=","} /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ sub(" .*$", "", $i); \ sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ if ($i ~ /'"$awkcur"'/) {print $i} \ }}' "${kh[@]}" 2>/dev/null )); fi; if [ ${#khd[@]} -gt 0 ]; then for i in "${khd[@]}"; do if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then host=${i/#*key_22_/}; host=${host/%.pub/}; COMPREPLY=("${COMPREPLY[@]}" $host); fi; done; fi; for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix; done; fi; if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ); COMPREPLY=("${COMPREPLY[@]}" $( compgen -P "$prefix$user" -S "$suffix" -W "$hosts" -- "$cur" )); fi; if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then COMPREPLY=("${COMPREPLY[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" )); fi; __ltrim_colon_completions "$prefix$user$cur"; return 0 } _l2ping () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -i) _bluetooth_devices; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-i -s -c -t -f -r' -- "$cur" )); else _bluetooth_adresses; fi } _lastlog () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -b | --before | -h | --help | -t | --time) return 0 ;; -u | --user) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--before --help --time --user' -- "$cur" )); return 0; fi } _lftp () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -f) _filedir; return 0 ;; -c | -h | --help | -v | --version | -e | -u | -p) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-f -c --help --version -e -u -p' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -W '$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" )); _known_hosts_real "$cur" } _lftpget () { COMPREPLY=(); local cur; _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -d -v' -- "$cur" )); fi } _linux_fstab () { COMPREPLY=(); local fs_spec fs_file fs_other; local oldifs="$IFS"; while read -r fs_spec fs_file fs_other; do if [[ $fs_spec = [#]* ]]; then continue; fi; if [[ $1 == -L ]]; then local fs_label=${fs_spec/#LABEL=}; if [[ $fs_label != "$fs_spec" ]]; then __linux_fstab_unescape fs_label; IFS=''; COMPREPLY+=("$fs_label"); IFS=$oldifs; fi; else __linux_fstab_unescape fs_spec; __linux_fstab_unescape fs_file; IFS=''; [[ $fs_spec = */* ]] && COMPREPLY+=("$fs_spec"); [[ $fs_file = */* ]] && COMPREPLY+=("$fs_file"); IFS=$oldifs; fi; done; _reply_compgen_array } _loexp_ () { local c=${COMP_WORDS[COMP_CWORD]}; local a="${COMP_LINE}"; local e s g=0 cd dc t=""; local IFS; shopt -q extglob && g=1; test $g -eq 0 && shopt -s extglob; cd='*-?(c)d*'; dc='*-d?(c)*'; case "${1##*/}" in lobase) e='!*.+(odb|ODB)' ;; lofromtemplate) e='!*.+(stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX)' ;; lodraw) e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG)' ;; localc) e='!*.+(sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX)' ;; lomath) e='!*.+(sxm|SXM|smf|SMF|mml|MML|odf|ODF)' ;; loweb) e='!*.+(htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)' ;; libreoffice) e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG|doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxm|SXM|smf|SMF|mml|MML|odf|ODF|sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX|odb|ODB|sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX|sxg|SXG|odm|ODM|sgl|SGL|stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX|htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)' ;; lowriter) e='!*.+(doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxg|SXG|odm|ODM|sgl|SGL)' ;; loimpress) e='!*.+(sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX)' ;; unopkg) e='!*.+(oxt|OXT)' ;; *) e='!*' ;; esac; case "$(complete -p ${1##*/} 2> /dev/null)" in *-d*) ;; *) s="-S/" ;; esac; IFS=' '; case "$c" in \$\(*\)) eval COMPREPLY=\(${c}\) ;; \$\(*) COMPREPLY=($(compgen -c -P '$(' -S ')' -- ${c#??})) ;; \`*\`) eval COMPREPLY=\(${c}\) ;; \`*) COMPREPLY=($(compgen -c -P '\`' -S '\`' -- ${c#?})) ;; \$\{*\}) eval COMPREPLY=\(${c}\) ;; \$\{*) COMPREPLY=($(compgen -v -P '${' -S '}' -- ${c#??})) ;; \$*) COMPREPLY=($(compgen -v -P '$' -- ${c#?})) ;; \~*/*) COMPREPLY=($(compgen -f -X "$e" -- ${c})) ;; \~*) COMPREPLY=($(compgen -u ${s} -- ${c})) ;; *@*) COMPREPLY=($(compgen -A hostname -P '@' -S ':' -- ${c#*@})) ;; *[*?[]*) COMPREPLY=($(compgen -G "${c}")) ;; *[?*+\!@]\(*\)*) if test $g -eq 0; then COMPREPLY=($(compgen -f -X "$e" -- $c)); test $g -eq 0 && shopt -u extglob; return; fi; COMPREPLY=($(compgen -G "${c}")) ;; *) if test "$c" = ".."; then COMPREPLY=($(compgen -d -X "$e" -S / ${_nosp} -- $c)); else for s in $(compgen -f -X "$e" -- $c); do if test -d $s; then COMPREPLY=(${COMPREPLY[@]} $(compgen -f -X "$e" -S / -- $s)); else if test -z "$t"; then COMPREPLY=(${COMPREPLY[@]} $s); else case "$(file -b $s 2> /dev/null)" in $t) COMPREPLY=(${COMPREPLY[@]} $s) ;; esac; fi; fi; done; fi ;; esac; test $g -eq 0 && shopt -u extglob } _longopt () { local cur prev split=false; _get_comp_words_by_ref -n = cur prev; _split_longopt && split=true; case "$prev" in --*[Dd][Ii][Rr]*) _filedir -d; return 0 ;; --*[Ff][Ii][Ll][Ee]* | --*[Pp][Aa][Tt][Hh]*) _filedir; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" -- "$cur" )); else if [[ "$1" == @(mk|rm)dir ]]; then _filedir -d; else _filedir; fi; fi } _look () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD = 1 ]; then COMPREPLY=($( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" )); fi } _lsof () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -'?' | -h | +c | -c | -d | -F | -i | +r | -r | -s | -S | -T) return 0 ;; -A | -k | -m | +m | -o) _filedir; return 0 ;; +d | +D) _filedir -d; return 0 ;; -D) COMPREPLY=($( compgen -W '? b i r u' -- "$cur" )); return 0 ;; -f) COMPREPLY=($( compgen -W 'c f g G n' -- "$cur" )); return 0 ;; -g) _pgids; return 0 ;; -p) _pids; return 0 ;; -u) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; esac; if [[ "$cur" == [-+]* ]]; then COMPREPLY=($( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g -i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t -u -U -v -V +w -w -x -X -z -Z' -- "$cur" )); return 0; fi; _filedir } _lzma () { local cur prev xspec; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \ --help --decompress --compress --keep --force --suffix \ --test --stdout --quiet --verbose --license --list \ --version --small --fast --best --text' -- "$cur" )); return 0; fi; local IFS=' '; xspec="*.@(lzma|tlz)"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --compress ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec; [[ "$prev" == -*z* ]] && xspec=; fi; fi; _expand || return 0; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _mac_addresses () { local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'; local PATH="$PATH:/sbin:/usr/sbin"; COMPREPLY=("${COMPREPLY[@]}" $( ifconfig -a 2>/dev/null | sed -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" )); COMPREPLY=("${COMPREPLY[@]}" $( arp -an 2>/dev/null | sed -ne "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" )); COMPREPLY=("${COMPREPLY[@]}" $( sed -ne "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); __ltrim_colon_completions "$cur" } _make () { local file makef makef_dir="." makef_inc cur prev i split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -f | -o | -W | --file | --makefile | --old-file | --new-file | --assume-old | --assume-new | --what-if) _filedir; return 0 ;; -I | -C | --directory | --include-dir) _filedir -d; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -m -B -C -d -e -f -h -i -I\ -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \ --always-make --directory --debug \ --environment-overrides --file --makefile --help \ --ignore-errors --include-dir --jobs --load-average \ --max-load --keep-going --just-print --dry-run \ --recon --old-file --assume-old --print-data-base \ --question --no-builtin-rules --no-builtin-variables \ --silent --quiet --no-keep-goind --stop --touch \ --version --print-directory --no-print-directory \ --what-if --new-file --assume-new \ --warn-undefined-variables' -- "$cur" )); else for ((i=0; i < ${#COMP_WORDS[@]}; i++ )) do if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then eval makef_dir=${COMP_WORDS[i+1]}; break; fi; done; for ((i=0; i < ${#COMP_WORDS[@]}; i++ )) do if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then eval makef=${COMP_WORDS[i+1]}; break; fi; done; [ -n "$makef" ] && makef="-f ${makef}"; [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"; COMPREPLY=($( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ {split($1,A,/ /);for(i in A)print A[i]}' )" -- "$cur" )); fi } _man () { local cur i prev sect manpath manext mansect uname; manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"; mansect="@([0-9lnp]|[0-9][px]|3pm)"; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; if [[ "$prev" == -l ]]; then _filedir $manext; return 0; fi; _expand || return 0; if [[ "$cur" == */* ]]; then _filedir $manext; return 0; fi; uname=$( uname -s ); if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then manpath=$( manpath 2>/dev/null || command man --path ); else manpath=$MANPATH; fi; if [ -z "$manpath" ]; then COMPREPLY=($( compgen -c -- "$cur" )); return 0; fi; [[ "$prev" == $mansect ]] && sect=$prev || sect='*'; manpath=$manpath:; if [ -n "$cur" ]; then manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"; else manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"; fi; COMPREPLY=($( eval command ls "$manpath" 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]##*/?(:)}); COMPREPLY=(${COMPREPLY[@]%.@([gx]z|bz2|lzma|Z)}); COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" )); if [[ "$prev" != $mansect ]]; then local start=${#COMPREPLY[@]}; _filedir $manext; for ((i=$start; i < ${#COMPREPLY[@]}; i++ )) do [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}; done; fi; __ltrim_colon_completions "$cur"; return 0 } _mii_tool () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -F | --force) COMPREPLY=($( compgen -W '100baseTx-FD 100baseTx-HD \ 10baseT-FD 10baseT-HD' -- "$cur" )); return 0 ;; -A | --advertise) COMPREPLY=($( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ 10baseT-FD 10baseT-HD' -- "$cur" )); return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--verbose --version --reset --restart \ --watch --log --advertise --force' -- "$cur" )); else _available_interfaces -a; fi } _mkisofs () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -o | -abstract | -biblio | -check-session | -copyright | -log-file | -root-info | -prep-boot | -*-list) _filedir; return 0 ;; -*-charset) COMPREPLY=($( compgen -W '$( mkisofs -input-charset \ help 2>&1 | tail -n +3 )' -- "$cur" )); return 0 ;; -uid) _uids; return 0 ;; -gid) _gids; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-abstract -appid -allow-lowercase \ -allow-multidot -biblio -cache-inodes -no-cache-inodes \ -eltorito-boot -eltorito-alt-boot -sparc-boot -generic-boot \ -hard-disk-boot -no-emul-boot -no-boot -boot-load-seg \ -boot-load-size -boot-info-table -cdrecord-params \ -eltorito-catalog -check-oldname -check-session -copyright \ -omit-period -disable-deep-relocation -dir-mode -dvd-video \ -follow-links -file-mode -gid -gui -graft-points -hide -hide-list \ -hidden -hidden-list -hide-joliet -hide-joliet-list \ -hide-joliet-trans-tbl -hide-rr-moved -input-charset \ -output-charset -iso-level -joliet -joliet-long -jcharset \ -full-iso9660-filenames -allow-leading-dots -log-file -exclude \ -exclude-list -max-iso9660-filenames -prev-session \ -omit-version-number -new-dir-mode -nobak -no-bak -force-rr -no-rr \ -no-split-symlink-components -no-split-symlink-fields -output -pad \ -no-pad -path-list -publisher -preparer -print-size -quiet -rock -rational-rock -relaxed-filenames -sort -split-output \ -stream-media-size -stream-file-name -sysid -translation-table \ -table-name -ucs-level -udf -uid -use-fileversion \ -untranslated-filenames -no-iso-translate -volid -volset \ -volset-size -volset-seqno -verbose -old-exclude \ -transparent-compression -hfs -apple -map -magic -hfs-creator \ -hfs-type -probe -no-desktop -mac-name \ -boot-hfs-file -part -auto -cluster-size \ -hide-hfs -hide-hfs-list -hfs-volid \ -icon-position -root-info -prep-boot \ -input-hfs-charset -output-hfs-charset \ -hfs-unlock -hfs-bless -hfs-parms --cap \ --netatalk --double --ethershare --ushare \ --exchange --sgi --xinet --macbin --single \ --dave --sfm --osx-double --osx-hfs' -- "$cur" )); else _filedir; fi } _mktemp () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | --version | --suffix) return 0 ;; --tmpdir | -p) _filedir -d; return 0 ;; esac; $split && return 0; [[ "$cur" == -* ]] && COMPREPLY=($( compgen -W '-d -u -q -p -t' -- "$cur" )) } _modules () { local modpath; modpath=/lib/modules/$1; COMPREPLY=($( compgen -W "$( command ls -R $modpath | sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.gz\)\{0,1\}$/\1/p' )" -- "$cur" )) } _mount () { local cur sm host prev; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; case $prev in -t | --types) _fstypes; return 0 ;; esac; [[ "$cur" == \\ ]] && cur="/"; if [[ "$cur" == *:* ]]; then for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do [ -x "$sm" ] || continue; COMPREPLY=($( compgen -W "$( "$sm" -e ${cur%%:*} | awk 'NR>1 {print $1}' )" -- "${cur#*:}" )); return 0; done; fi; if [[ "$cur" == //* ]]; then host=${cur#//}; host=${host%%/*}; if [ -n "$host" ]; then COMPREPLY=($( compgen -P "//$host" -W "$( smbclient -d 0 -NL $host 2>/dev/null | sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' | sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" -- "${cur#//$host}" )); fi; else if [ -r /etc/vfstab ]; then COMPREPLY=($( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" )); else if [ ! -e /etc/fstab ]; then COMPREPLY=($( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" )); else if [ "$prev" = -L ]; then _linux_fstab -L < /etc/fstab; else if [ "$prev" = -U ]; then COMPREPLY=($( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" )); else _linux_fstab < /etc/fstab; fi; fi; fi; fi; fi; return 0 } _newgrp () { COMPREPLY=(); if [[ "`_get_cword`" == "-" ]]; then COMPREPLY=(-); else _allowed_groups; fi } _newusers () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --crypt) COMPREPLY=($( compgen -W 'DES MD5 NONE SHA256 SHA512' -- "$cur" )); return 0 ;; -s | --sha-rounds) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--crypt-method --help --system \ --sha-rounds' -- "$cur" )); return 0; fi; _filedir } _nslookup () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; COMPREPLY=($( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \ defname search port= querytype= type= recurse retry root timeout vc \ ignoretc' -- "$cur" )) } _ntpdate () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -k) _filedir; return 0 ;; -U) COMPREPLY=($( compgen -u "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\ -e -k -p -o -r -t' -- "$cur" )); else _known_hosts_real "$cur"; fi } _openssl () { local cur prev commands command options formats; COMPREPLY=(); _get_comp_words_by_ref cur prev; commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \ dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \ nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa \ rsautl s_client s_server s_time sess_id smime speed spkac \ verify version x509 md2 md4 md5 rmd160 sha sha1 aes-128-cbc \ aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb \ base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc \ camellia-128-ecb camellia-192-cbc camellia-192-ecb \ camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc \ cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb \ des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 \ des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \ rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \ rc4-40'; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W "$commands" -- "$cur" )); else command=${COMP_WORDS[1]}; case $prev in -CA | -CAfile | -CAkey | -CAserial | -cert | -certfile | -config | -content | -dcert | -dkey | -dhparam | -extfile | -in | -inkey | -kfile | -key | -keyout | -out | -oid | -prvrify | -rand | -recip | -revoke | -sess_in | -sess_out | -spkac | -sign | -signkey | -signer | -signature | -ss_cert | -untrusted | -verify) _filedir; return 0 ;; -outdir | -CApath) _filedir -d; return 0 ;; -name | -crlexts | -extensions) _openssl_sections; return 0 ;; -inform | -outform | -keyform | -certform | -CAform | -CAkeyform | -dkeyform | -dcertform) formats='DER PEM'; case $command in x509) formats="$formats NET" ;; smime) formats="$formats SMIME" ;; esac; COMPREPLY=($( compgen -W "$formats" -- "$cur" )); return 0 ;; -connect) _known_hosts_real "$cur"; return 0 ;; -starttls) COMPREPLY=($( compgen -W 'smtp pop3 imap ftp' -- "$cur" )); return 0 ;; -cipher) COMPREPLY=($( compgen -W "$(openssl ciphers | tr ':' '\n')" -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then case $command in asn1parse) options='-inform -in -out -noout -offset -length -i -oid \ -strparse' ;; ca) options='-verbose -config -name -gencrl -revoke \ -crl_reason -crl_hold -crl_compromise \ -crl_CA_compromise -crldays -crlhours -crlexts \ -startdate -enddate -days -md -policy -keyfile -key \ -passin -cert -selfsig -in -out -notext -outdir \ -infiles -spkac -ss_cert -preserveDN -noemailDN \ -batch -msie_hack -extensions -extfile -engine \ -subj -utf8 -multivalue-rdn' ;; ciphers) options='-v -ssl2 -ssl3 -tls1' ;; crl) options='-inform -outform -text -in -out -noout -hash \ -issuer -lastupdate -nextupdate -CAfile -CApath' ;; crl2pkcs7) options='-inform -outform -in -out -print_certs' ;; dgst) options='-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \ -c -d -hex -binary -out -sign -verify -prverify \ -signature' ;; dsa) options='-inform -outform -in -passin -out -passout -des \ -des3 -idea -text -noout -modulus -pubin -pubout' ;; dsaparam) options='-inform -outform -in -out -noout -text -C -rand \ -genkey' ;; enc) options='-ciphername -in -out -pass -e -d -a -A -k -kfile \ -S -K -iv -p -P -bufsize -debug' ;; dhparam) options='-inform -outform -in -out -dsaparam -noout -text \ -C -2 -5 -rand' ;; gendsa) options='-out -des -des3 -idea -rand' ;; genrsa) options='-out -passout -des -des3 -idea -f4 -3 -rand' ;; pkcs7) options='-inform -outform -in -out -print_certs -text \ -noout' ;; rand) options='-out -rand -base64' ;; req) options='-inform -outform -in -passin -out -passout -text \ -noout -verify -modulus -new -rand -newkey -newkey \ -nodes -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \ -config -x509 -days -asn1-kludge -newhdr -extensions \ -reqexts section' ;; rsa) options='-inform -outform -in -passin -out -passout \ -sgckey -des -des3 -idea -text -noout -modulus -check \ -pubin -pubout -engine' ;; rsautl) options='-in -out -inkey -pubin -certin -sign -verify \ -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' ;; s_client) options='-connect -verify -cert -certform -key -keyform \ -pass -CApath -CAfile -reconnect -pause -showcerts \ -debug -msg -nbio_test -state -nbio -crlf -ign_eof \ -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \ -bugs -cipher -starttls -engine -tlsextdebug \ -no_ticket -sess_out -sess_in -rand' ;; s_server) options='-accept -context -verify -Verify -crl_check \ -crl_check_all -cert -certform -key -keyform -pass \ -dcert -dcertform -dkey -dkeyform -dpass -dhparam \ -nbio -nbio_test -crlf -debug -msg -state -CApath \ -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 \ -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 -no_dhe \ -bugs -hack -www -WWW -HTTP -engine -tlsextdebug \ -no_ticket -id_prefix -rand' ;; s_time) options='-connect -www -cert -key -CApath -CAfile -reuse \ -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' ;; sess_id) options='-inform -outform -in -out -text -noout -context \ ID' ;; smime) options='-encrypt -decrypt -sign -verify -pk7out -des \ -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 \ -in -certfile -signer -recip -inform -passin -inkey \ -out -outform -content -to -from -subject -text -rand' ;; speed) options='-engine' ;; verify) options='-CApath -CAfile -purpose -untrusted -help \ -issuer_checks -verbose -certificates' ;; x509) options='-inform -outform -keyform -CAform -CAkeyform -in \ -out -serial -hash -subject_hash -issuer_hash -subject \ -issuer -nameopt -email -startdate -enddate -purpose \ -dates -modulus -fingerprint -alias -noout -trustout \ -clrtrust -clrreject -addtrust -addreject -setalias \ -days -set_serial -signkey -x509toreq -req -CA -CAkey \ -CAcreateserial -CAserial -text -C -md2 -md5 -sha1 \ -mdc2 -clrext -extfile -extensions -engine' ;; md5 | md4 | md2 | sha1 | sha | mdc2 | ripemd160) options='-c -d' ;; esac; COMPREPLY=($( compgen -W "$options" -- "$cur" )); else if [[ "$command" == speed ]]; then COMPREPLY=($( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 \ idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 \ rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea \ rc2 des rsa blowfish' -- "$cur" )); else _filedir; fi; fi; fi } _openssl_sections () { local config f; for ((i=2; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -config ]]; then config=${COMP_WORDS[i+1]}; break; fi; done; if [ -z "$config" ]; then for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf /usr/share/ssl/openssl.cnf; do [ -f $f ] && config=$f && break; done; fi; [ ! -f "$config" ] && return 0; COMPREPLY=($( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" -- "$cur" )) } _pack200 () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -S | --segment-limit | -P | --pass-file | -C | --class-attribute | -F | --field-attribute | -M | --method-attribute | -D | --code-attribute | '-?' | -h | --help | -V | --version | -J) return 0 ;; -E | --effort) COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; -H | --deflate-hint) COMPREPLY=($( compgen -W 'true false keep' -- "$cur" )); return 0 ;; -m | --modification-time) COMPREPLY=($( compgen -W 'latest keep' -- "$cur" )); return 0 ;; -U | --unknown-attribute) COMPREPLY=($( compgen -W 'error strip pass' -- "$cur" )); return 0 ;; -f | --config-file) _filedir properties; return 0 ;; -l | --log-file) COMPREPLY=($( compgen -W '-' -- "$cur" )); _filedir log; return 0 ;; -r | --repack) _filedir jar; return 0 ;; esac; local i pack=false jar=false; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do case ${COMP_WORDS[i]} in *.pack | *.pack.gz) pack=true ;; *.jar) jar=true ;; esac; done; if ! $pack; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--no-gzip --gzip --strip-debug \ --no-keep-file-order --segment-limit= --effort= \ --deflate-hint= --modification-time= --pass-file= \ --unknown-attribute= --class-attribute= --field-attribute= \ --method-attribute= --code-attribute= --config-file= \ --verbose --quiet --log-file= --help --version -J \ --repack' -- "$cur" )); [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && type compopt &>/dev/null && compopt -o nospace; else _filedir 'pack?(.gz)'; fi; else if ! $jar; then _filedir jar; fi; fi } _parse_help () { $1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|[<=].*||' } _passwd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -n | -x | -w | -i | -\? | --help | --usage) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \ -? --help --usage' -- "$cur" )); return 0; fi; _allowed_users } _pci_ids () { COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" )) } _perl () { local cur prev prefix temp; local optPrefix optSuffix; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; optPrefix=-P$prev; optSuffix=-S/; prefix=$prev; fi; case $prev in -D | -e | -E | -i | -F | -l) return 0 ;; -I | -x) local IFS=' '; _compopt_o_filenames; COMPREPLY=($( compgen -d $optPrefix $optSuffix -- "$cur" )); return 0 ;; -m | -M) temp="${cur#-}"; prefix="$prefix${cur%$temp}"; cur="$temp"; _perlmodules $1; return 0 ;; -V) if [[ $cur == :* ]]; then temp="${cur##+(:)}"; prefix="$prefix${cur%$temp}"; local IFS=' '; COMPREPLY=($( compgen -P "$prefix" -W '$( $1 -MConfig -e "print join \"\\n\", keys %Config::Config" 2>/dev/null )' -- "$temp" )); __ltrim_colon_completions "$prefix$temp"; fi; return 0 ;; -d | -dt) if [[ $cur == :* ]]; then temp="${cur#:}"; prefix="$prefix${cur%$temp}"; cur="Devel::$temp"; _perlmodules $1; fi; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \ -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" )); else _filedir; fi } _perldoc () { local cur prev prefix temp; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; prefix=$prev; fi; case $prev in -f) _perlfunctions "$cur"; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" )); else if [[ "$cur" != */* ]]; then _perlmodules; COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( MANPAGER=/bin/cat PAGER=/bin/cat man perl | \ sed -ne "/perl.*Perl overview/,/perlwin32/p" | \ awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" )); fi; _filedir 'p@(l|m|od)'; fi } _perlfunctions () { COMPREPLY=($( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" -- "$cur" )) } _perlmodules () { COMPREPLY=($( compgen -P "$prefix" -W "$( $1 ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" -- "$cur" )); __ltrim_colon_completions "$prefix$cur" } _pgids () { COMPREPLY=($( compgen -W '$( command ps axo pgid= )' -- "$cur" )) } _pgrep () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; _pnames; return 0 } _pids () { COMPREPLY=($( compgen -W '$( command ps axo pid= )' -- "$cur" )) } _pkg_config () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --variable | --define-variable | --atleast-version | --atleast-pkgconfig-version | --exact-version | --max-version) return 0 ;; -\? | --help | --version | --usage) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version --modversion \ --atleast-pkgconfig-version --libs --static \ --short-errors --libs-only-l --libs-only-other \ --libs-only-L --cflags --cflags-only-I \ --cflags-only-other --variable --define-variable \ --exists --uninstalled --atleast-version \ --exact-version --max-version --list-all --debug \ --print-errors --silence-errors --errors-to-stdout \ --print-provides --print-requires --help --usage' -- "$cur")); else COMPREPLY=($( compgen -W "$( pkg-config --list-all 2>/dev/null | awk '{print $1}' )" -- "$cur" )); fi } _pm_action () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "--help $( _parse_help "$1" )" -- "$cur" )) } _pm_is_supported () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W '--help --suspend --hibernate --suspend-hybrid' -- "$cur" )) } _pm_powersave () { local cur; _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "true false" -- "$cur" )) } _pnames () { COMPREPLY=($( compgen -X '' -W '$( command ps axo command= | \ sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \ -e "s/[])]$//" | sort -u )' -- "$cur" )) } _poff () { local prev cur conns; [ -r /etc/ppp/peers/ ] || return 0; COMPREPLY=(); prev=${COMP_WORDS[COMP_CWORD-1]}; cur=${COMP_WORDS[COMP_CWORD]}; conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$'); if [[ "$cur" == -* ]]; then COMPREPLY=($(compgen -W '-r -d -c -a -h -v' -- $cur)); return 0; fi; if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]]; then COMPREPLY=($(compgen -o filenames -W "$conns" $cur)); fi; return 0 } _pon () { local cur conns; [ -r /etc/ppp/peers/ ] || return 0; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$'); if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($(compgen -o filenames -W "$conns" $cur)); fi; return 0 } _pwck () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-q -r -s' -- "$cur" )); return 0; fi; _filedir } _python () { local prev cur i; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -'?' | -h | --help | -V | --version | -c | -m) return 0 ;; -Q) COMPREPLY=($( compgen -W "old new warn warnall" -- "$cur" )); return 0 ;; -W) COMPREPLY=($( compgen -W "ignore default all module once error" -- "$cur" )); return 0 ;; !(?(*/)python*([0-9.])|-?)) [[ $COMP_CWORD -lt 2 || ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir ;; esac; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do if [[ ${COMP_WORDS[i]} == -c ]]; then _filedir; fi; done; if [[ "$cur" != -* ]]; then _filedir 'py?([co])'; else COMPREPLY=($( compgen -W "$( _parse_help $1 -h )" -- "$cur" )); fi; return 0 } _qdbus () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; [ -n "$cur" ] && unset COMP_WORDS[${#COMP_WORDS[@]}-1]; COMPREPLY=($( compgen -W '$( command ${COMP_WORDS[@]} 2>/dev/null | \ sed s/\(.*\)// )' -- "$cur" )) } _quote_readline_by_ref () { if [[ ${1:0:1} == "'" ]]; then if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then printf -v $2 %s "${1:1}"; else printf -v $2 %q "${1:1}"; printf -v $2 %q ${!2}; fi; else if [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then printf -v $2 %q "${1:1}"; else printf -v $2 %q "$1"; fi; fi; [[ ${!2:0:1} == '$' ]] && eval $2=${!2} } _rdesktop () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -k) COMPREPLY=($( command ls /usr/share/rdesktop/keymaps 2>/dev/null | command grep -E -v '(common|modifiers)' )); COMPREPLY=(${COMPREPLY[@]:-} $( command ls $HOME/.rdesktop/keymaps 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]:-} $( command ls ./keymaps 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; -a) COMPREPLY=($( compgen -W '8 15 16 24' -- "$cur" )); return 0 ;; -x) COMPREPLY=($( compgen -W 'b broadband m modem l lan' -- $cur )); return 0 ;; -r) COMPREPLY=($( compgen -W 'comport: disk: lptport: \ printer: sound: lspci scard' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \ -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \ -0 -4 -5' -- "$cur" )); else _known_hosts_real "$cur"; fi } _realcommand () { type -P "$1" > /dev/null && { if type -p realpath > /dev/null; then realpath "$(type -P "$1")"; else if type -p readlink > /dev/null; then readlink -f "$(type -P "$1")"; else type -P "$1"; fi; fi } } _renice () { local command cur curopt i; COMPREPLY=(); _get_comp_words_by_ref cur; command=$1; i=0; while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do curopt=${COMP_WORDS[COMP_CWORD-$i]}; case "$curopt" in -u) _allowed_users ;; -g) _pgids ;; -p | $command) _pids ;; esac; i=$(( ++i )); done } _reply_compgen_array () { local i wlist; for i in ${!COMPREPLY[*]}; do local q=$(quote "$(printf %q "${COMPREPLY[$i]}")"); wlist+=$q' '; done; local ecur="$cur"; ecur="${ecur//\\/\\\\}"; ecur="${ecur//\'/\'}"; local oldifs=$IFS; IFS=' ' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'; IFS=$oldifs } _rfcomm () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -f | --config) _filedir; return 0 ;; -i) _bluetooth_devices; _bluetooth_adresses; return 0 ;; esac; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help -a --raw \ --config -i --auth --encrypt --secure --master' -- "$cur" )); else COMPREPLY=($( compgen -W 'show connect listen watch \ bind release' -- "$cur" )); fi; else _count_args; if [ $args -eq 2 ]; then _bluetooth_devices; else case $arg in connect | bind) if [ $args -eq 3 ]; then _bluetooth_adresses; fi ;; esac; fi; fi } _rfkill () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--version' -- "$cur" )); else case $COMP_CWORD in 1) COMPREPLY=($( compgen -W "help event list block unblock" -- "$cur" )) ;; 2) if [[ $prev == block || $prev == unblock ]]; then COMPREPLY=($( compgen -W "$(rfkill list | awk -F: '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax wwan gps" -- "$cur" )); fi ;; esac; fi } _rl_enabled () { [[ "$( bind -v )" = *$1+([[:space:]])on* ]] } _rmmod () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; _installed_modules "$cur"; return 0 } _root_command () { local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin; local root_command=$1; _command $1 $2 $3 } _route () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; if [ "$prev" = dev ]; then _available_interfaces; return 0; fi; local i found; for opt in add del -host -net netmask metric mss window irtt reject mod dyn reinstate dev default gw; do found=false; for ((i=1; i < ${#COMP_WORDS[@]}-1; i++ )) do [ "${COMP_WORDS[i]}" = "$opt" ] && found=true && break; done; $found || COMPREPLY[${#COMPREPLY[@]}]="$opt"; done; COMPREPLY=($( compgen -W '"${COMPREPLY[@]}"' -- "$cur" )) } _rsync () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref -n : cur prev; _expand || return 0; case $prev in --config | --password-file | --include-from | --exclude-from) _filedir; return 0 ;; -T | --temp-dir | --compare-dest) _filedir -d; return 0 ;; -e | --rsh) COMPREPLY=($( compgen -W 'rsh ssh' -- "$cur" )); return 0 ;; --compress-level) COMPREPLY=($( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" )); return 0 ;; esac; case $cur in -*) COMPREPLY=($( compgen -W '--verbose --quiet --no-motd --checksum \ --archive --recursive --relative --no-implied-dirs \ --backup --backup-dir --suffix= --update --inplace --append \ --append-verify --dirs --old-dirs --links --copy-links \ --copy-unsafe-links --safe-links --copy-dirlinks \ --keep-dirlinks --hard-links --perms --executability --chmod= \ --acls --xattrs --owner --group --devices --copy-devices \ --specials --times --omit-dir-times --super --fake-super \ --sparse --dry-run --whole-file --no-whole-file \ --one-file-system --block-size= --rsh= --rsync-path= \ --existing --ignore-existing --remove-source-files --delete \ --delete-before --delete-during --delete-delay --delete-after \ --delete-excluded --ignore-errors --force --max-delete= \ --max-size= --min-size= --partial --partial-dir= \ --delay-updates --prune-empty-dirs --numeric-ids --timeout= \ --contimeout= --ignore-times --size-only --modify-window= \ --temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest= \ --compress --compress-level= --skip-compress= --cvs-exclude \ --filter= --exclude= --exclude-from= --include= \ --include-from= --files-from= --from0 --protect-args \ --address= --port= --sockopts= --blocking-io --no-blocking-io \ --stats --8-bit-output --human-readable --progress \ --itemize-changes --out-format= --log-file= \ --log-file-format= --password-file= --list-only --bwlimit= \ --write-batch= --only-write-batch= --read-batch= --protocol= \ --iconv= --ipv4 --ipv6 --version --help --daemon --config= \ --no-detach' -- "$cur" )) ;; *:*) if type _scp_remote_files &>/dev/null; then local i shell=ssh; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then shell=${COMP_WORDS[i+1]}; break; fi; done; [ "$shell" = ssh ] && _scp_remote_files; fi ;; *) _known_hosts_real -c -a "$cur"; type _scp_local_files &>/dev/null && _scp_local_files || _filedir ;; esac; return 0 } _rtcwake () { COMPREPLY=(); local cur prev split=false; _get_comp_words_by_ref cur prev; _split_longopt && split=true; case "$prev" in --help | -h | --version | -V | --seconds | -s | --time | -t) return 0 ;; --mode | -m) COMPREPLY=($( compgen -W 'standby mem disk on no off' -- "$cur" )); return 0 ;; --device | -d) COMPREPLY=($( command ls -d /dev/rtc?* 2>/dev/null )); COMPREPLY=($( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" )); return 0 ;; esac; $split && return 0; COMPREPLY=($( compgen -W '--device --local --mode --seconds --time --utc \ --verbose --version --help' -- "$cur" )) } _samba_debuglevel () { COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" )) } _samba_domains () { if [ -n "${COMP_SAMBA_SCAN:-}" ]; then COMPREPLY=($( compgen -W '$( smbtree -N -D )' -- "$cur" )); fi } _samba_hosts () { if [ -n "${COMP_SAMBA_SCAN:-}" ]; then COMPREPLY=($( compgen -W "$( smbtree -N -S | sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' )" -- $cur )); fi } _samba_resolve_order () { COMPREPLY=($( compgen -W 'lmhosts host wins bcast' -- "$cur" )) } _scp () { local configfile cur prev prefix; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _ssh_suboption_check && { COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 }; case $prev in -l | -P) return 0 ;; -F | -i | -S) _filedir; type compopt &>/dev/null && compopt +o nospace; return 0 ;; -c) _ssh_ciphers; COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 ;; -o) _ssh_options; return 0 ;; esac; _expand || return 0; if [[ "$cur" == *:* ]]; then _scp_remote_files; return 0; fi; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; prefix=-F; else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; case $cur in -*) COMPREPLY=($( compgen -W '-1 -2 -4 -6 -B -C -c -F -i -l -o \ -P -p -q -r -S -v' -- "$cur" )); COMPREPLY=("${COMPREPLY[@]/%/ }"); return 0 ;; */*) ;; *) _known_hosts_real -c -a -F "$configfile" "$cur" ;; esac; fi; _scp_local_files "$prefix"; return 0 } _scp_local_files () { local IFS=' '; local dirsonly=false; if [ "$1" = -d ]; then dirsonly=true; shift; fi; if $dirsonly; then COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/")); else COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$1/")); fi } _scp_remote_files () { local IFS=' '; cur=${cur/\\:/:}; local userhost=${cur%%?(\\):*}; local path=${cur#*:}; path=$( sed -e 's/\\\\\\\('$_scp_path_esc'\)/\\\1/g' <<<"$path" ); if [ -z "$path" ]; then path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null); fi; local files; if [ "$1" = -d ]; then files=$( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e '/[^\/]$/d' ); else files=$( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ); fi; COMPREPLY=("${COMPREPLY[@]}" $files) } _screen () { local cur prev words cword; COMPREPLY=(); _get_comp_words_by_ref cur prev words cword; if ((cword > 2)); then case ${words[cword-2]} in -[dD]) _screen_sessions; return 0 ;; esac; fi; case $prev in -[rR]) _screen_sessions 'Detached'; return 0 ;; -[dD]) _screen_sessions 'Attached'; return 0 ;; -x) _screen_sessions; return 0 ;; -s) _shells; return 0 ;; -c) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln \ -list -L -m -O -p -q -r -R -s -S -t -U -v -wipe -x -X --help \ --version' -- "$cur" )); fi } _screen_sessions () { COMPREPLY=($( compgen -W "$( command screen -ls | sed -ne 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" -- "$cur" )) } _sdptool () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in --bdaddr) _bluetooth_adresses; return 0 ;; esac; $split && return 0; _get_first_arg; if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--help' -- "$cur" )); else COMPREPLY=($( compgen -W 'search browse records add \ del get setattr setseq' -- "$cur" )); fi; else case $arg in search) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--bdaddr \ --tree --raw --xml' -- "$cur" )); else _bluetooth_services; fi ;; browse | records) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--tree --raw --xml' -- "$cur" )); else _bluetooth_adresses; fi ;; add) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--handle --channel' -- "$cur" )); else _bluetooth_services; fi ;; get) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--bdaddr \ --tree --raw --xml' -- "$cur" )); fi ;; esac; fi } _service () { local cur prev sysvdir; COMPREPLY=(); _get_comp_words_by_ref cur prev; [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0; [ $COMP_CWORD -gt 2 ] && return 0; if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then _services; else [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; COMPREPLY=($( compgen -W '`sed -e "y/|/ /" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" )); fi; return 0 } _services () { local sysvdir famdir; [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; famdir=/etc/xinetd.d; COMPREPLY=($( printf '%s\n' $sysvdir/!(*.rpm@(orig|new|save)|*~|functions) )); if [ -d $famdir ]; then COMPREPLY=("${COMPREPLY[@]}" $( printf '%s\n' $famdir/!(*.rpm@(orig|new|save)|*~) )); fi; COMPREPLY=($( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" )) } _sftp () { local cur prev configfile; COMPREPLY=(); _get_comp_words_by_ref cur prev; _ssh_suboption_check && return 0; case $prev in -b | -F | -P) _filedir; return 0 ;; -o) _ssh_options; return 0 ;; esac; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; _filedir; COMPREPLY=("${COMPREPLY[@]/#/-F}"); cur=-F$cur; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' -- "$cur" )); else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; _known_hosts_real -a -F "$configfile" "$cur"; fi; fi; return 0 } _sh () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c) return 0 ;; -o | +o) COMPREPLY=($( compgen -W 'allexport errexit ignoreeof monitor noclobber noglob noexec nolog notify nounset verbose vi xtrace' -- "$cur" )); return 0 ;; esac; local opts="-a -b -C -e -f -h -i -m -n -o -u -v -x"; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W "$opts -c -s" -- "$cur" )); return 0; else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W "${opts//-/+}" -- "$cur" )); return 0; fi; fi; _filedir sh } _shells () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' -- "$cur" )) } _signals () { local i; COMPREPLY=($( compgen -A signal SIG${cur#-} )); for ((i=0; i < ${#COMPREPLY[@]}; i++ )) do COMPREPLY[i]=-${COMPREPLY[i]#SIG}; done } _smbcacls () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -M -D -S -U -C -G --numeric -t \ -h --help -V -s -d --debuglevel -l --log-basename' -- "$cur" )); fi } _smbclient () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -R) _samba_resolve_order; return 0 ;; -t) COMPREPLY=($( compgen -W 'SJIS EUC JIS7 JIS8 JUNET HEX CAP' -- "$cur" )); return 0 ;; -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename | -D) _filedir -d; return 0 ;; -O) COMPREPLY=($( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \ SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \ IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \ SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" )); return 0 ;; -T) COMPREPLY=($( compgen -W 'c x I X F b g q r N a' -- "$cur" )); return 0 ;; -W | --workgroup) _samba_domains; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; -p | --port | -M | -I | -b | -U | --user | -n | -i | -T | -c) return 0 ;; -\? | --help | -V | --version) return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \ -p -R -s -k -P -c -D -W -l -E --debuglevel \ --log-basename --workgroup' -- "$cur" )); fi } _smbcquotas () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-u -L -F -S -n -t -v -h --help -V \ -s --debuglevel --log-basename -N -k \ --authentication-file --user' -- "$cur" )); fi } _smbget () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -o | -f | --outputfile | --rcfile) _filedir; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a --guest -r --resume -R --recursive -u \ --username -p --password -w --workgroup -n --nonprompt -d \ --debuglevel -D --dots -P --keep-permissions -o --outputfile -f \ --rcfile -q --quiet -v --verbose -b --blocksize -? --help --usage' -- "$cur" )); fi } _smbpasswd () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r) _samba_hosts; return 0 ;; -R) _samba_resolve_order; return 0 ;; -c) _filedir; return 0 ;; -D) _samba_debuglevel; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \ -s -w -W -i -L' -- "$cur" )); fi } _smbtar () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r | -t) _filedir tar; return 0 ;; -s) _samba_hosts; return 0 ;; -l) _samba_debuglevel; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l -u -t' -- "$cur" )); fi } _smbtree () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -s | -A | --authentication-file) _filedir; return 0 ;; -l | --log-basename) _filedir -d; return 0 ;; -d | --debuglevel) _samba_debuglevel; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -D -S -V -s -d --debuglevel -l \ --log-basename -N -k -A --authentication-file -U --user\ -h --help' -- "$cur" )); fi } _split_longopt () { if [[ "$cur" == --?*=* ]]; then prev="${cur%%?(\\)=*}"; cur="${cur#*=}"; return 0; fi; return 1 } _ssh () { local cur prev configfile; local -a config; COMPREPLY=(); _get_comp_words_by_ref -n : cur prev; _ssh_suboption_check && return 0; case $prev in -F | -i | -S) _filedir; return 0 ;; -c) _ssh_ciphers; return 0 ;; -m) _ssh_macs; return 0 ;; -l) COMPREPLY=($( compgen -u -- "$cur" )); return 0 ;; -o) _ssh_options; return 0 ;; -w) _available_interfaces; return 0 ;; -b) _ssh_bindaddress; return 0 ;; esac; if [[ "$cur" == -F* ]]; then cur=${cur#-F}; _filedir; COMPREPLY=("${COMPREPLY[@]/#/-F}"); cur=-F$cur; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \ -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \ -i -L -l -m -O -o -p -R -S -w' -- "$cur" )); else set -- "${COMP_WORDS[@]}"; while [ $# -gt 0 ]; do if [ "${1:0:2}" = -F ]; then if [ ${#1} -gt 2 ]; then configfile="$(dequote "${1:2}")"; else shift; [ "$1" ] && configfile="$(dequote "$1")"; fi; break; fi; shift; done; _known_hosts_real -a -F "$configfile" "$cur"; if [ $COMP_CWORD -ne 1 ]; then _compopt_o_filenames; COMPREPLY=("${COMPREPLY[@]}" $( compgen -c -- "$cur" )); fi; fi; fi; return 0 } _ssh_bindaddress () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( PATH="$PATH:/sbin" ifconfig -a | sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" -- "$cur" )) } _ssh_ciphers () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \ aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \ arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" )) } _ssh_copy_id () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -i) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-i' -- "$cur" )); else _known_hosts_real -a "$cur"; fi; return 0 } _ssh_macs () { COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \ umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' -- "$cur" )) } _ssh_options () { type compopt &>/dev/null && compopt -o nospace; COMPREPLY=($( compgen -S = -W 'AddressFamily BatchMode BindAddress \ ChallengeResponseAuthentication CheckHostIP Cipher Ciphers \ ClearAllForwardings Compression CompressionLevel ConnectionAttempts \ ConnectTimeout ControlMaster ControlPath DynamicForward EscapeChar \ ExitOnForwardFailure ForwardAgent ForwardX11 ForwardX11Trusted \ GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication \ GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAuthentication \ HostKeyAlgorithms HostKeyAlias HostName IdentityFile IdentitiesOnly \ KbdInteractiveDevices LocalCommand LocalForward LogLevel MACs \ NoHostAuthenticationForLocalhost NumberOfPasswordPrompts \ PasswordAuthentication PermitLocalCommand Port \ PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication \ RekeyLimit RemoteForward RhostsRSAAuthentication RSAAuthentication \ SendEnv ServerAliveInterval ServerAliveCountMax SmartcardDevice \ StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \ UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \ VisualHostKey XAuthLocation' -- "$cur" )) } _ssh_suboption () { local prev=${1%%=*} cur=${1#*=}; case $prev in BatchMode | ChallengeResponseAuthentication | CheckHostIP | ClearAllForwardings | Compression | ExitOnForwardFailure | ForwardAgent | ForwardX11 | ForwardX11Trusted | GatewayPorts | GSSAPIAuthentication | GSSAPIKeyExchange | GSSAPIDelegateCredentials | GSSAPITrustDns | HashKnownHosts | HostbasedAuthentication | IdentitiesOnly | KbdInteractiveAuthentication | KbdInteractiveDevices | NoHostAuthenticationForLocalhost | PasswordAuthentication | PubkeyAuthentication | RhostsRSAAuthentication | RSAAuthentication | StrictHostKeyChecking | TCPKeepAlive | UsePrivilegedPort | VerifyHostKeyDNS | VisualHostKey) COMPREPLY=($( compgen -W 'yes no' -- "$cur")) ;; AddressFamily) COMPREPLY=($( compgen -W 'any inet inet6' -- "$cur" )) ;; BindAddress) _ssh_bindaddress ;; Cipher) COMPREPLY=($( compgen -W 'blowfish des 3des' -- "$cur" )) ;; Protocol) COMPREPLY=($( compgen -W '1 2 1,2 2,1' -- "$cur" )) ;; Tunnel) COMPREPLY=($( compgen -W 'yes no point-to-point ethernet' -- "$cur" )) ;; PreferredAuthentications) COMPREPLY=($( compgen -W 'gssapi-with-mic host-based \ publickey keyboard-interactive password' -- "$cur" )) ;; MACs) _ssh_macs ;; Ciphers) _ssh_ciphers ;; esac; return 0 } _ssh_suboption_check () { local cureq=`_get_cword :=` preveq=`_get_pword :=`; if [[ $cureq == *=* && $preveq == -o ]]; then _ssh_suboption $cureq; return $?; fi; return 1 } _strace () { local cur prev offset i syscalls arch unistd; offset=0; for ((i=1; i <= COMP_CWORD; i++ )) do case ${COMP_WORDS[$i]} in -o | -e | -p) i=$((i+1)); continue ;; -*) continue ;; esac; offset=$i; break; done; if [ $offset -gt 0 ]; then _command_offset $offset; else COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -e) if [[ "$cur" == *=* ]]; then prev=${cur/=*/}; cur=${cur/*=/}; arch=$(command uname -m); syscalls=$(awk '/^#define __NR/ {print $2}' /usr/include/asm/unistd.h | sed -e 's/__NR_//'); if [ -z "$syscalls" ]; then if [[ "$arch" == *86 ]]; then unistd=/usr/include/asm/unistd_32.h; else unistd=/usr/include/asm/unistd_64.h; fi; syscalls=$(awk '/^#define __NR/ {print $2}' $unistd | sed -e 's/__NR_//'); fi; case $prev in trace) COMPREPLY=($( compgen -W "$syscalls file process network signal ipc desc all none" -- "$cur")); return 0 ;; esac; else COMPREPLY=($( compgen -S"=" -W 'trace abbrev verbose raw signal read write' -- "$cur" )); fi; return 0 ;; -o) _filedir; return 0 ;; -p) _pids; return 0 ;; -S) COMPREPLY=($( compgen -W 'time calls name nothing' -- "$cur" )); return 0 ;; -u) _allowed_users; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -d -f -ff -F --help -i -q \ -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p \ -s -S -u -E' -- "$cur" )); else COMPREPLY=($( compgen -c -- "$cur" )); fi; fi } _subdirectories () { COMPREPLY=($( cd $1 && compgen -d -- "$cur" )) } _sysctl () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" )); return 0 } _tar () { local cur ext regex tar untar; COMPREPLY=(); _get_comp_words_by_ref cur; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'c t x u r d A' -- "$cur" )); return 0; fi; case ${COMP_WORDS[1]} in ?(-)[cr]*f) _filedir; return 0 ;; +([^IZzJjy])f) ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'; regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz?(2)\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)' ;; *[Zz]*f) ext='@(t?(ar.)|gem.|spkg.)@(gz|Z)'; regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(gz\|Z\)' ;; *[Ijy]*f) ext='@(@(t?(ar.)|gem.)bz?(2)|spkg)'; regex='\(\(t\(ar\.\)\?\|gem\.\)bz2\?\|spkg\)' ;; *[J]*f) ext='@(t?(ar.)|gem.|spkg.)@(lz?(ma)|xz)'; regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(lzma\|xz\)\?' ;; *) _filedir; return 0 ;; esac; if [[ "$COMP_LINE" == *$ext' ' ]]; then tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" ); untar=t${COMP_WORDS[1]//[^Izjyf]/}; local IFS=' '; COMPREPLY=($( compgen -W "$( printf '%s\n' $( tar $untar $tar 2>/dev/null ) )" -- "$cur" )); return 0; fi; _filedir "$ext"; return 0 } _tcpdump () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -r | -w | -F) _filedir; return 0 ;; -i) _available_interfaces -a; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -d -e -f -l -n -N -O -p \ -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" )); fi } _tilde () { local result=0; if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then _compopt_o_filenames; COMPREPLY=($( compgen -P '~' -u "${1#\~}" )); result=${#COMPREPLY[@]}; fi; return $result } _tune2fs () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -c | -C | -E | -i | -J | -L | -m | -r | -T) return 0 ;; -e) COMPREPLY=($( compgen -W 'continue remount-ro panic' -- "$cur" )); return 0 ;; -g) _gids; COMPREPLY=($( compgen -g -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; -M) _filedir -d ;; -o) local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16 ^journal_data ^journal_data_ordered ^journal_data_writeback); COMPREPLY=($( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" )); return 0 ;; -O) local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode ^sparse_super ^uninit_bg); COMPREPLY=($( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" )); return 0 ;; -u) _uids; COMPREPLY=($( compgen -u -W '${COMPREPLY[@]}' -- "$cur" )); return 0 ;; -U) COMPREPLY=($( compgen -W 'clear random time' -- "$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o -O -r -T -u -U' -- "$cur" )); fi; cur=${cur:=/dev/}; _filedir } _ufw () { cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W "$(_ufw_commands)" $cur )); else if [ $COMP_CWORD -eq 2 ]; then case "$prev" in app) COMPREPLY=($( compgen -W "$(_ufw_app_commands)" $cur )) ;; status) COMPREPLY=($( compgen -W "$(_ufw_status_commands)" $cur )) ;; delete) COMPREPLY=($( compgen -W "$(_ufw_rule_commands)" $cur )) ;; logging) COMPREPLY=($( compgen -W "$(_ufw_logging_commands)" $cur )) ;; show) COMPREPLY=($( compgen -W "$(_ufw_show_commands)" $cur )) ;; default) COMPREPLY=($( compgen -W "$(_ufw_default_commands)" $cur )) ;; esac; fi; fi } _ufw_app_commands () { ufw --help | sed -e '1,/^Application profile commands:/d' -e '/^ [^ ]/!d' -e 's/[ \t]\+app[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g' } _ufw_commands () { commands=$(ufw --help | sed -e '1,/^Commands:/d' -e '/^Application profile commands:/Q' -e 's/^[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g' -e 's/|/ /g' | uniq); echo "$commands app" } _ufw_default_commands () { echo "allow deny reject" } _ufw_logging_commands () { echo "off on low medium high full" } _ufw_rule_commands () { echo "`_ufw_default_commands` limit" } _ufw_show_commands () { echo "raw" } _ufw_status_commands () { echo "numbered verbose" } _uids () { if type getent &>/dev/null; then COMPREPLY=($( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" )); else if type perl &>/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" )); else COMPREPLY=($( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" )); fi; fi } _umount () { local cur; _get_comp_words_by_ref cur; COMPREPLY=(); if [[ $(uname -s) = Linux && -r /proc/mounts ]]; then _linux_fstab < /proc/mounts; else local IFS=' '; COMPREPLY=($( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" )); fi; return 0 } _unpack200 () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in '-?' | -h | --help | -V | --version | -J) return 0 ;; -H | --deflate-hint) COMPREPLY=($( compgen -W 'true false keep' -- "$cur" )); return 0 ;; -l | --log-file) COMPREPLY=($( compgen -W '-' -- "$cur" )); _filedir log; return 0 ;; esac; local i pack=false jar=false; for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) do case ${COMP_WORDS[i]} in *.pack | *.pack.gz) pack=true ;; *.jar) jar=true ;; esac; done; if ! $pack; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--deflate-hint= --remove-pack-file \ --verbose --quiet --log-file= --help --version' -- "$cur" )); [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && type compopt &>/dev/null && compopt -o nospace; else _filedir 'pack?(.gz)'; fi; else if ! $jar; then _filedir jar; fi; fi } _update_alternatives () { local cur prev mode args i; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --altdir | --admindir) _filedir -d; return 0 ;; --help | --usage | --version) return 0 ;; esac; for ((i=1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all|set) ]]; then mode=${COMP_WORDS[i]}; args=$(($COMP_CWORD - i)); break; fi; done; case $mode in --install) case $args in 1 | 3) _filedir ;; 2) _installed_alternatives ;; 4) ;; *) case $((args % 4)) in 0 | 2) _filedir ;; 1) COMPREPLY=($( compgen -W '--slave' -- "$cur" )) ;; 3) _installed_alternatives ;; esac ;; esac ;; --remove | --set) case $args in 1) _installed_alternatives ;; 2) _filedir ;; esac ;; --auto | --remove-all | --display | --config) _installed_alternatives ;; *) COMPREPLY=($( compgen -W '--verbose --quiet --help --version \ --altdir --admindir --install --remove --auto --display \ --config --set' -- "$cur" )) ;; esac } _update_initramfs () { local cur prev valid_options; cur=$(_get_cword); prev=${COMP_WORDS[COMP_CWORD-1]}; if [[ "$prev" == '-k' ]]; then _kernel_versions; COMPREPLY=($( compgen -W '${COMPREPLY[@]} all' -- "$cur" )); return; fi; valid_options=$( update-initramfs -h 2>&1 | sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' ); COMPREPLY=($( compgen -W "$valid_options" -- $cur )) } _update_rc_d () { local cur prev sysvdir services options valid_options; _get_comp_words_by_ref cur prev; [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; services=($(printf '%s ' $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save)))); services=(${services[@]#$sysvdir/}); options=(-f -n); if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then valid_options=($( tr " " "\n" <<<"${COMP_WORDS[@]} ${options[@]}" | sed -ne "/$( sed "s/ /\\|/g" <<<"${options[@]}" )/p" | sort | uniq -u )); COMPREPLY=($( compgen -W '${options[@]} ${services[@]}' -X '$( tr " " "|" <<<${COMP_WORDS[@]} )' -- "$cur" )); else if [[ "$prev" == ?($( tr " " "|" <<<${services[@]} )) ]]; then COMPREPLY=($( compgen -W 'remove defaults start stop' -- "$cur" )); else if [[ "$prev" == defaults && "$cur" == [0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9); else if [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9); else if [[ "$prev" == defaults && -z "$cur" ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9 s k); else if [[ "$prev" == ?(start|stop) ]]; then if [[ "$cur" == [0-9] || -z "$cur" ]]; then COMPREPLY=(0 1 2 3 4 5 6 7 8 9); else if [[ "$cur" == [0-9][0-9] ]]; then COMPREPLY=($cur); else COMPREPLY=(); fi; fi; else if [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then if [[ -z "$cur" ]]; then if [[ $prev == [0-9][0-9] ]]; then COMPREPLY=(0 1 2 3 4 5 6 S); else COMPREPLY=(0 1 2 3 4 5 6 S .); fi; else if [[ "$cur" == [0-6S.] ]]; then COMPREPLY=($cur); else COMPREPLY=(); fi; fi; else if [[ "$prev" == "." ]]; then COMPREPLY=($(compgen -W "start stop" -- "$cur")); else COMPREPLY=(); fi; fi; fi; fi; fi; fi; fi; fi; return 0 } _upstart_events () { ( cd /etc/init && egrep --color=auto '^[[:space:]]*emits ' *.conf | cut -d: -f2- | sed 's/^[[:space:]]*emits //g' | tr ' ' '\n' | awk '{print $NF}' | grep --color=auto -v ^$ | sort -u ) } _upstart_initctl () { _get_comp_words_by_ref cur prev; COMPREPLY=(); case "$prev" in start) COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_startable_jobs)" -- ${cur})); return 0 ;; stop) COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_stoppable_jobs)" -- ${cur})); return 0 ;; emit) COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_events)" -- ${cur})); return 0 ;; -i | --ignore-events) for cmd in check-config; do cwords=${COMP_WORDS[@]##}; filtered_cwords=${COMP_WORDS[@]##${cmd}}; if [ "$filtered_cwords" != "$cwords" ]; then COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur})); return 0; fi; done ;; -e | --enumerate) for cmd in show-config; do cwords=${COMP_WORDS[@]##}; filtered_cwords=${COMP_WORDS[@]##${cmd}}; if [ "$filtered_cwords" != "$cwords" ]; then COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur})); return 0; fi; done ;; reload | restart) COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_stoppable_jobs)" -- ${cur})); return 0 ;; status) COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur})); return 0 ;; check-config) COMPREPLY=($(compgen -W "-w --warn -i --ignore-events= $(_upstart_jobs)" -- ${cur})); return 0 ;; show-config) COMPREPLY=($(compgen -W "-e --enumerate $(_upstart_jobs)" -- ${cur})); return 0 ;; -n | --no-wait) for cmd in start stop restart emit; do cwords=${COMP_WORDS[@]##}; filtered_cwords=${COMP_WORDS[@]##${cmd}}; if [ "$filtered_cwords" != "$cwords" ]; then case "$cmd" in start) COMPREPLY=($(compgen -W "$(_upstart_startable_jobs)" -- ${cur})) ;; stop) COMPREPLY=($(compgen -W "$(_upstart_stoppable_jobs)" -- ${cur})) ;; restart) COMPREPLY=($(compgen -W "$(_upstart_stoppable_jobs)" -- ${cur})) ;; emit) COMPREPLY=($(compgen -W "$(_upstart_events)" -- ${cur})) ;; esac; return 0; fi; done ;; --help | --version) COMPREPLY=(); return 0 ;; esac; opts="--help --version -q --quiet -v --verbose --session --system --dest="; cmds=$(initctl help|grep "^ [^ ]"|awk '{print $1}'); COMPREPLY=($(compgen -W "${opts} ${cmds}" -- ${cur})) } _upstart_jobs () { initctl list | awk '{print $1}' | sort -u } _upstart_reload () { COMPREPLY=(); _get_comp_words_by_ref cur prev; opts="--help --version -q --quiet -v --verbose --session --system --dest="; case "$prev" in --help | --version) COMPREPLY=(); return 0 ;; esac; COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur})); return 0 } _upstart_restart () { COMPREPLY=(); _get_comp_words_by_ref cur prev; opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait"; case "$prev" in --help | --version) COMPREPLY=(); return 0 ;; esac; COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur})); return 0 } _upstart_start () { COMPREPLY=(); _get_comp_words_by_ref cur prev; opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait"; case "$prev" in --help | --version) COMPREPLY=(); return 0 ;; esac; COMPREPLY=($(compgen -W "$opts $(_upstart_startable_jobs)" -- ${cur})); return 0 } _upstart_startable_jobs () { initctl list | cut -d\, -f1 | awk '$2 == "stop/waiting" {print $1}' } _upstart_status () { COMPREPLY=(); _get_comp_words_by_ref cur prev; opts="--help --version -q -d --detail -e --enumerate --quiet -v --verbose --session --system --dest="; case "$prev" in --help | --version) COMPREPLY=(); return 0 ;; esac; COMPREPLY=($(compgen -W "$opts $(_upstart_jobs)" -- ${cur})); return 0 } _upstart_stop () { COMPREPLY=(); _get_comp_words_by_ref cur prev; opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait"; case "$prev" in --help | --version) COMPREPLY=(); return 0 ;; esac; COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur})); return 0 } _upstart_stoppable_jobs () { initctl list | cut -d\, -f1 | awk '$2 == "start/running" {print $1}' } _upvar () { if unset -v "$1"; then if (( $# == 2 )); then eval $1=\"\$2\"; else eval $1=\(\"\${@:2}\"\); fi; fi } _upvars () { if ! (( $# )); then echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname" "value] | [-aN varname [value ...]] ..." 1>&2; return 2; fi; while (( $# )); do case $1 in -a*) [[ -n ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing" "number specifier" 1>&2; return 1 }; printf %d "${1#-a}" &>/dev/null || { echo "bash:" "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2; return 1 }; [[ -n "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:" "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1 } ;; -v) [[ -n "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing" "argument(s)" 1>&2; return 1 } ;; *) echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2; return 1 ;; esac; done } _usb_ids () { COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" )) } _user_at_host () { local cur; COMPREPLY=(); _get_comp_words_by_ref -n : cur; if [[ $cur == *@* ]]; then _known_hosts_real "$cur"; else COMPREPLY=($( compgen -u -- "$cur" )); fi; return 0 } _useradd () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --comment | -h | --help | -e | --expiredate | -f | --inactive | -k | --key | -p | --password | -u | --uid | -Z | --selinux-user) return 0 ;; -b | --base-dir | -d | --home | -k | --skel) _filedir -d; return 0 ;; -g | --gid) _gids; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $( compgen -g )' -- "$cur" )); return 0 ;; -G | --groups) COMPREPLY=($( compgen -g -- "$cur" )); return 0 ;; -s | --shell) _shells; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--base-dir --comment --home-dir --defaults \ --expiredate --inactive --gid --groups --help --skel --key \ --no-log-init --create-home --no-create-home --no-user-group \ --non-unique --password --system --shell --uid --user-group \ --selinux-user' -- "$cur" )); return 0; fi } _userdel () { local cur; COMPREPLY=(); _get_comp_words_by_ref cur; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--force --help --remove' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _usergroup () { if [[ $cur = *\\\\* || $cur = *:*:* ]]; then return; else if [[ $cur = *\\:* ]]; then local prefix; prefix=${cur%%*([^:])}; prefix=${prefix//\\}; local mycur="${cur#*[:]}"; if [[ $1 == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($( compgen -g -- "$mycur" )); fi; COMPREPLY=($( compgen -P "$prefix" -W "${COMPREPLY[@]}" )); else if [[ $cur = *:* ]]; then local mycur="${cur#*:}"; if [[ $1 == -u ]]; then _allowed_groups "$mycur"; else local IFS=' '; COMPREPLY=($( compgen -g -- "$mycur" )); fi; else if [[ $1 == -u ]]; then _allowed_users "$cur"; else local IFS=' '; COMPREPLY=($( compgen -u -- "$cur" )); fi; fi; fi; fi } _usermod () { local cur prev split=false; COMPREPLY=(); _get_comp_words_by_ref cur prev; _split_longopt && split=true; case $prev in -c | --comment | -d | --home | -e | --expiredate | -f | --inactive | -h | --help | -l | --login | -p | --password | -u | --uid | -Z | --selinux-user) return 0 ;; -g | --gid) _gids; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $( compgen -g )' -- "$cur" )); return 0 ;; -G | --groups) COMPREPLY=($( compgen -g -- "$cur" )); return 0 ;; -s | --shell) _shells; return 0 ;; esac; $split && return 0; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--append --comment --home --expiredate \ --inactive --gid --groups --help --login --lock --move-home \ --non-unique --password --shell --uid --unlock --selinux-user' -- "$cur" )); return 0; fi; COMPREPLY=($( compgen -u -- "$cur" )) } _vipw () { local cur prev; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in -h | --help) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--group --help --passwd \ --quiet --shadow' -- "$cur" )); return 0; fi } _xhost () { local cur; _get_comp_words_by_ref cur; case $cur in +*) _known_hosts_real -p+ "${cur:1}" ;; -*) _known_hosts_real -p- "${cur:1}" ;; *) _known_hosts_real "$cur" ;; esac; return 0 } _xmodmap () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -display | -e) return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-display -help -grammar -verbose -quiet -n -e -pm -pk -pke -pp' -- "$cur" )); return 0; fi; _filedir } _xrandr () { local cur prev output modes; COMPREPLY=(); _get_comp_words_by_ref cur prev; case $prev in --output) local outputs=$(xrandr|awk '/connected/ {print $1}'); COMPREPLY=($(compgen -W "$outputs" -- "$cur")); return 0 ;; --mode) for ((i = 1; i < COMP_CWORD; i++ )) do if [[ "${COMP_WORDS[i]}" == "--output" ]]; then output=${COMP_WORDS[i+1]}; break; fi; done; modes=$(xrandr|sed -e "1,/$output/ d" -e "/connected/,$ d"|awk '{print $1}'); COMPREPLY=($( compgen -W "$modes" -- "$cur")); return 0 ;; esac; case $cur in *) COMPREPLY=($(compgen -W '-display -help --orientation --query \ --size --rate --version -x -y --screen --verbose --dryrun \ --prop --fb --fbmm --dpi --output --auto --mode --preferred \ --pos --reflect --rotate --left-of --right-of --above --below \ --same-as --set --off --crtc --newmode --rmmode --addmode \ --delmode' -- "$cur")); return 0 ;; esac; return 0 } _xrdb () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; case $prev in -backup | -display | -help) return 0 ;; -cpp | -edit) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-help -display -all -global -screen -screens -n -quiet -cpp -nocpp -symbols -query -load -override -merge -remove -retain -edit -backup' -- "$cur" )); return 0; fi; _filedir } _xz () { COMPREPLY=(); local cur prev; _get_comp_words_by_ref cur prev; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--compress --decompress --test --list \ --keep --force --stdout --suffix --files --files0 --format --check \ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 --fast --best --extreme --memory \ --lzma1 --lzma2 --x86 --powerpc --ia64 --arm --armthumb --sparc \ --delta --quiet --verbose --no-warn --help --long-help --version' -- "$cur" )); return 0; fi; local split=false; _split_longopt && split=true; local xspec="*.@(xz|lzma|txz|tlz)"; case $prev in --decompress | --list | --test | -!(-*)[dlt]*) xspec="!"$xspec ;; --files | --files0) _filedir; return 0 ;; -C | --check) COMPREPLY=($( compgen -W 'crc32 crc64 sha256' -- "$cur" )); return 0 ;; -F | --format) COMPREPLY=($( compgen -W 'auto xz lzma raw' -- "$cur" )); return 0 ;; -M | --memory | -S | --suffix | --delta | --lzma1 | --lzma2) return 0 ;; -h | --help | -H | --long-help | -V | --version) return 0 ;; esac; $split && return 0; _expand || return 0; local IFS=' '; _compopt_o_filenames; COMPREPLY=($( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _zeitgeist_daemon () { local cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($(compgen -W "`zeitgeist-daemon --shell-completion`" -- $cur)) } command_not_found_handle () { if [ -x /usr/lib/command-not-found ]; then /usr/bin/python /usr/lib/command-not-found -- "$1"; return $?; else if [ -x /usr/share/command-not-found ]; then /usr/bin/python /usr/share/command-not-found -- "$1"; return $?; else return 127; fi; fi } dequote () { eval echo "$1" 2> /dev/null } quote () { echo \'${1//\'/\'\\\'\'}\' } quote_readline () { local quoted; _quote_readline_by_ref "$1" ret; printf %s "$ret" }