Last active
August 29, 2015 14:02
-
-
Save bulkan/9d3f06313eb7582ef5f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[~]: brew outdated | |
Error: undefined method `new' for Zlib:Module | |
Please report this bug: | |
https://github.com/Homebrew/homebrew/wiki/troubleshooting | |
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula' | |
/usr/local/Library/Homebrew/formulary.rb:194:in `factory' | |
/usr/local/Library/Homebrew/formula.rb:377:in `block in installed' | |
/usr/local/Library/Homebrew/formula.rb:375:in `map' | |
/usr/local/Library/Homebrew/formula.rb:375:in `installed' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:16:in `outdated_brews' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:6:in `outdated' | |
/usr/local/Library/brew.rb:106:in `<main>' | |
[~]: brew doctor | |
Warning: Broken symlinks were found. Remove them with `brew prune`: | |
/usr/local/lib/python2.7/site-packages/site-packages | |
Error: Failed to import: zlib | |
undefined method `new' for Zlib:Module | |
Warning: Some keg-only formula are linked into the Cellar. | |
Linking a keg-only formula, such as gettext, into the cellar with | |
`brew link <formula>` will cause other formulae to detect them during | |
the `./configure` step. This may cause problems when compiling those | |
other formulae. | |
Binaries provided by keg-only formulae may override system binaries | |
with other strange results. | |
You may wish to `brew unlink` these brews: | |
icu4c | |
Error: undefined method `new' for Zlib:Module | |
Please report this bug: | |
https://github.com/Homebrew/homebrew/wiki/troubleshooting | |
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula' | |
/usr/local/Library/Homebrew/formulary.rb:194:in `factory' | |
/usr/local/Library/Homebrew/formula.rb:397:in `factory' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1068:in `block in check_for_unlinked_but_not_keg_only' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1063:in `reject' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1063:in `check_for_unlinked_but_not_keg_only' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1145:in `block in doctor' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1144:in `each' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1144:in `doctor' | |
/usr/local/Library/brew.rb:106:in `<main>' | |
[~]: brew prune | |
Pruned 0 dead formulae | |
Tapped 41 formulae | |
Pruned 1 symbolic links and 4 directories from /usr/local | |
[~]: brew outdated | |
Error: undefined method `new' for Zlib:Module | |
Please report this bug: | |
https://github.com/Homebrew/homebrew/wiki/troubleshooting | |
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula' | |
/usr/local/Library/Homebrew/formulary.rb:194:in `factory' | |
/usr/local/Library/Homebrew/formula.rb:377:in `block in installed' | |
/usr/local/Library/Homebrew/formula.rb:375:in `map' | |
/usr/local/Library/Homebrew/formula.rb:375:in `installed' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:16:in `outdated_brews' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:6:in `outdated' | |
/usr/local/Library/brew.rb:106:in `<main>' | |
[~]: brew doctor | |
Error: Failed to import: zlib | |
undefined method `new' for Zlib:Module | |
Warning: Some keg-only formula are linked into the Cellar. | |
Linking a keg-only formula, such as gettext, into the cellar with | |
`brew link <formula>` will cause other formulae to detect them during | |
the `./configure` step. This may cause problems when compiling those | |
other formulae. | |
Binaries provided by keg-only formulae may override system binaries | |
with other strange results. | |
You may wish to `brew unlink` these brews: | |
icu4c | |
Error: undefined method `new' for Zlib:Module | |
Please report this bug: | |
https://github.com/Homebrew/homebrew/wiki/troubleshooting | |
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula' | |
/usr/local/Library/Homebrew/formulary.rb:194:in `factory' | |
/usr/local/Library/Homebrew/formula.rb:397:in `factory' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1068:in `block in check_for_unlinked_but_not_keg_only' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1063:in `reject' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1063:in `check_for_unlinked_but_not_keg_only' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1145:in `block in doctor' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1144:in `each' | |
/usr/local/Library/Homebrew/cmd/doctor.rb:1144:in `doctor' | |
/usr/local/Library/brew.rb:106:in `<main>' | |
[~]: brew up | |
Already up-to-date. | |
[~]: brew outdated | |
Error: undefined method `new' for Zlib:Module | |
Please report this bug: | |
https://github.com/Homebrew/homebrew/wiki/troubleshooting | |
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula' | |
/usr/local/Library/Homebrew/formulary.rb:194:in `factory' | |
/usr/local/Library/Homebrew/formula.rb:377:in `block in installed' | |
/usr/local/Library/Homebrew/formula.rb:375:in `map' | |
/usr/local/Library/Homebrew/formula.rb:375:in `installed' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:16:in `outdated_brews' | |
/usr/local/Library/Homebrew/cmd/outdated.rb:6:in `outdated' | |
/usr/local/Library/brew.rb:106:in `<main>' | |
[~]: brew --config | |
HOMEBREW_VERSION: 0.9.5 | |
ORIGIN: https://github.com/Homebrew/homebrew.git | |
HEAD: 92710b962b4f3fbb5c0ffaf73317ad77e39e73d0 | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: quad-core 64-bit haswell | |
OS X: 10.9.3-x86_64 | |
Xcode: 5.1.1 | |
CLT: 5.1.0.0.1.1396320587 | |
Clang: 5.1 build 503 | |
X11: N/A | |
System Ruby: 2.0.0-451 | |
Perl: /usr/bin/perl | |
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7 | |
Ruby: /Users/bulkan/.rbenv/shims/ruby | |
[~]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Apple_PubSub_Socket_Render=/tmp/launch-TMJdla/Render | |
BASH=/bin/bash | |
BASH_ARGC=() | |
BASH_ARGV=() | |
BASH_COMPLETION=/usr/local/etc/bash_completion | |
BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d | |
BASH_COMPLETION_DIR=/usr/local/etc/bash_completion.d | |
BASH_LINENO=() | |
BASH_SOURCE=() | |
BASH_VERSINFO=([0]="3" [1]="2" [2]="51" [3]="1" [4]="release" [5]="x86_64-apple-darwin13") | |
BASH_VERSION='3.2.51(1)-release' | |
COLORFGBG='7;0' | |
COLUMNS=203 | |
COMP_WORDBREAKS=$' \t\n"\'><=;|&(:' | |
DIRSTACK=() | |
EUID=501 | |
GOPATH=/Users/bulkan/src/go | |
GROUPS=() | |
HISTFILE=/Users/bulkan/.bash_history | |
HISTFILESIZE=500 | |
HISTSIZE=500 | |
HOME=/Users/bulkan | |
HOSTNAME=joser-pc.impos.com.au | |
HOSTTYPE=x86_64 | |
IFS=$' \t\n' | |
ITERM_PROFILE='Solarized Dark' | |
ITERM_SESSION_ID=w0t2p0 | |
LANG=en_AU.UTF-8 | |
LINES=59 | |
LOGNAME=bulkan | |
MACHTYPE=x86_64-apple-darwin13 | |
MAILCHECK=60 | |
OPTERR=1 | |
OPTIND=1 | |
OSTYPE=darwin13 | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/local/heroku/bin:/Users/bulkan/.bin:/Users/bulkan/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/Users/bulkan/src/go/bin | |
PIPESTATUS=([0]="0") | |
PPID=557 | |
PROJECT_HOME=/Users/bulkan/src/python | |
PROMPT_COMMAND='PS1="\[\033[36m\]$(_venv)\[\033[0m\][\[\033[0m\]\w]\[\033[36m\]$(parse_git_branch):\[\033[0m\] "' | |
PS1='\[\033[36m\]\[\033[0m\][\[\033[0m\]\w]\[\033[36m\]:\[\033[0m\] ' | |
PS2='> ' | |
PS4='+ ' | |
PWD=/Users/bulkan | |
RC=0 | |
SHELL=/bin/bash | |
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor | |
SHLVL=1 | |
SSH_AUTH_SOCK=/tmp/launch-3tw6z9/Listeners | |
TERM=screen-256color | |
TERM_PROGRAM=iTerm.app | |
TMPDIR=/var/folders/49/30k39lp17mz4_sdyz_0wcdb00000gn/T/ | |
UID=501 | |
USER=bulkan | |
VIRTUALENVWRAPPER_ENV_BIN_DIR=bin | |
VIRTUALENVWRAPPER_HOOK_DIR=/Users/bulkan/src/python | |
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project | |
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python | |
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh | |
VIRTUALENVWRAPPER_VIRTUALENV=virtualenv | |
VIRTUALENVWRAPPER_VIRTUALENV_CLONE=virtualenv-clone | |
WORKON_HOME=/Users/bulkan/src/python | |
_=declare | |
__CF_USER_TEXT_ENCODING=0x1F5:0:0 | |
__CHECKFIX1436934=1 | |
__git_all_commands= | |
__git_diff_algorithms='myers minimal patience histogram' | |
__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 --histogram --minimal\n\t\t\t--raw --word-diff\n\t\t\t--dirstat --dirstat= --dirstat-by-file\n\t\t\t--dirstat-by-file= --cumulative\n\t\t\t--diff-algorithm=\n' | |
__git_fetch_options=$'\n\t--quiet --verbose --append --upload-pack --force --keep --depth=\n\t--tags --no-tags --all --prune --dry-run --recurse-submodules=\n' | |
__git_fetch_recurse_submodules='yes on-demand no' | |
__git_format_patch_options=$'\n\t--stdout --attach --no-attach --thread --thread= --no-thread\n\t--numbered --start-number --numbered-files --keep-subject --signoff\n\t--signature --no-signature --in-reply-to= --cc= --full-index --binary\n\t--not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=\n\t--inline --suffix= --ignore-if-in-upstream --subject-prefix=\n\t--output-directory --reroll-count --to= --quiet --notes\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 --notes --no-notes\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 --edit --no-edit\n' | |
__git_merge_strategies= | |
__git_mergetools_common=$'diffuse diffmerge ecmerge emerge kdiff3 meld opendiff\n\t\t\ttkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare\n' | |
__git_porcelain_commands= | |
__git_printf_supports_v=yes | |
__git_push_recurse_submodules='check on-demand' | |
__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' | |
_scp_path_esc='[][(){}<>",:;^&!$=?`|\\'\''[:space:]]' | |
_ImageMagick () | |
{ | |
local cur prev; | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-channel) | |
COMPREPLY=($( compgen -W 'Red Green Blue Opacity \ | |
Matte Cyan Magenta Yellow Black' -- "$cur" )); | |
return 0 | |
;; | |
-colormap) | |
COMPREPLY=($( compgen -W 'shared private' -- "$cur" )); | |
return 0 | |
;; | |
-colorspace) | |
COMPREPLY=($( compgen -W 'GRAY OHTA RGB Transparent \ | |
XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" )); | |
return 0 | |
;; | |
-compose) | |
COMPREPLY=($( compgen -W 'Over In Out Atop Xor Plus \ | |
Minus Add Subtract Difference Multiply Bumpmap\ | |
Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" )); | |
return 0 | |
;; | |
-compress) | |
COMPREPLY=($( compgen -W 'None BZip Fax Group4 JPEG \ | |
Lossless LZW RLE Zip' -- "$cur" )); | |
return 0 | |
;; | |
-dispose) | |
COMPREPLY=($( compgen -W 'Undefined None Background Previous' -- "$cur" )); | |
return 0 | |
;; | |
-encoding) | |
COMPREPLY=($( compgen -W 'AdobeCustom AdobeExpert \ | |
AdobeStandard AppleRoman BIG5 GB2312 Latin2 \ | |
None SJIScode Symbol Unicode Wansung' -- "$cur")); | |
return 0 | |
;; | |
-endian) | |
COMPREPLY=($( compgen -W 'MSB LSB' -- "$cur" )); | |
return 0 | |
;; | |
-filter) | |
COMPREPLY=($( compgen -W 'Point Box Triangle Hermite \ | |
Hanning Hamming Blackman Gaussian Quadratic \ | |
Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" )); | |
return 0 | |
;; | |
-format) | |
COMPREPLY=($( compgen -W "$( convert -list format | awk '/ [r-][w-][+-] / {print $1}' | tr -d '*' | tr [:upper:] [:lower:] )" -- "$cur" )); | |
return 0 | |
;; | |
-gravity) | |
COMPREPLY=($( compgen -W 'Northwest North NorthEast \ | |
West Center East SouthWest South SouthEast' -- "$cur" )); | |
return 0 | |
;; | |
-intent) | |
COMPREPLY=($( compgen -W 'Absolute Perceptual \ | |
Relative Saturation' -- "$cur" )); | |
return 0 | |
;; | |
-interlace) | |
COMPREPLY=($( compgen -W 'None Line Plane Partition' -- "$cur" )); | |
return 0 | |
;; | |
-limit) | |
COMPREPLY=($( compgen -W 'Disk File Map Memory' -- "$cur" )); | |
return 0 | |
;; | |
-list) | |
COMPREPLY=($( compgen -W 'Delegate Format Magic Module Resource \ | |
Type' -- "$cur" )); | |
return 0 | |
;; | |
-map) | |
COMPREPLY=($( compgen -W 'best default gray red green blue' -- "$cur" )); | |
_filedir; | |
return 0 | |
;; | |
-noise) | |
COMPREPLY=($( compgen -W 'Uniform Gaussian Multiplicative \ | |
Impulse Laplacian Poisson' -- "$cur" )); | |
return 0 | |
;; | |
-preview) | |
COMPREPLY=($( compgen -W 'Rotate Shear Roll Hue \ | |
Saturation Brightness Gamma Spiff \ | |
Dull Grayscale Quantize Despeckle \ | |
ReduceNoise AddNoise Sharpen Blur \ | |
Treshold EdgeDetect Spread Shade \ | |
Raise Segment Solarize Swirl Implode \ | |
Wave OilPaint CharcoalDrawing JPEG' -- "$cur" )); | |
return 0 | |
;; | |
-mask | -profile | -texture | -tile | -write) | |
_filedir; | |
return 0 | |
;; | |
-type) | |
COMPREPLY=($( compgen -W 'Bilevel Grayscale Palette PaletteMatte \ | |
TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte \ | |
Optimize' -- "$cur" )); | |
return 0 | |
;; | |
-units) | |
COMPREPLY=($( compgen -W 'Undefined PixelsPerInch \ | |
PixelsPerCentimeter' -- "$cur" )); | |
return 0 | |
;; | |
-virtual-pixel) | |
COMPREPLY=($( compgen -W 'Constant Edge mirror tile' -- "$cur" )); | |
return 0 | |
;; | |
-visual) | |
COMPREPLY=($( compgen -W 'StaticGray GrayScale StaticColor \ | |
PseudoColor TrueColor DirectColor defaut visualid' -- "$cur" )); | |
return 0 | |
;; | |
esac | |
} | |
__brew_complete_formulae () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local lib=$(brew --repository)/Library; | |
local taps=${lib}/Taps; | |
local ff=$(\ls ${lib}/Formula 2>/dev/null | sed 's/\.rb//g'); | |
local af=$(\ls ${lib}/Aliases 2>/dev/null); | |
local tf file; | |
for file in ${taps}/*/*/*.rb ${taps}/*/*/Formula/*.rb ${taps}/*/*/HomebrewFormula/*.rb; | |
do | |
[ -f "$file" ] || continue; | |
file=${file/"Formula/"/}; | |
file=${file/"HomebrewFormula/"/}; | |
file=${file#${lib}/Taps/}; | |
file=${file%.rb}; | |
file=${file/homebrew-/}; | |
tf="${tf} ${file}"; | |
done; | |
COMPREPLY=($(compgen -W "$ff $af $tf" -- "$cur")) | |
} | |
__brew_complete_installed () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local inst=$(\ls $(brew --cellar)); | |
COMPREPLY=($(compgen -W "$inst" -- "$cur")) | |
} | |
__brew_complete_outdated () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local od=$(brew outdated --quiet); | |
COMPREPLY=($(compgen -W "$od" -- "$cur")) | |
} | |
__brew_complete_tapped () | |
{ | |
local taplib=$(brew --repository)/Library/Taps; | |
local dir taps; | |
for dir in ${taplib}/*/*; | |
do | |
[ -d "$dir" ] || continue; | |
dir=${dir#${taplib}/}; | |
dir=${dir/homebrew-/}; | |
taps="$taps $dir"; | |
done; | |
__brewcomp "$taps" | |
} | |
__brew_complete_versions () | |
{ | |
local formula="$1"; | |
local versions=$(brew list --versions "$formula"); | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
COMPREPLY=($(compgen -W "$versions" -X "$formula" -- "$cur")) | |
} | |
__brewcomp () | |
{ | |
local list s sep=' | |
' IFS=' '' '' | |
'; | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
for s in $1; | |
do | |
__brewcomp_words_include "$s" && continue; | |
list="$list$s$sep"; | |
done; | |
IFS=$sep; | |
COMPREPLY=($(compgen -W "$list" -- "$cur")) | |
} | |
__brewcomp_prev () | |
{ | |
local idx=$((COMP_CWORD - 1)); | |
local prv="${COMP_WORDS[idx]}"; | |
while [[ $prv == -* ]]; do | |
idx=$((--idx)); | |
prv="${COMP_WORDS[idx]}"; | |
done; | |
echo "$prv" | |
} | |
__brewcomp_words_include () | |
{ | |
local i=1; | |
while [[ $i -lt $COMP_CWORD ]]; do | |
if [[ "${COMP_WORDS[i]}" = "$1" ]]; then | |
return 0; | |
fi; | |
i=$((++i)); | |
done; | |
return 1 | |
} | |
__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_commands () | |
{ | |
if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"; then | |
printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"; | |
else | |
git help -a | egrep '^ [a-zA-Z0-9]'; | |
fi | |
} | |
__git_complete () | |
{ | |
local wrapper="__git_wrap${2}"; | |
eval "$wrapper () { __git_func_wrap $2 ; }"; | |
complete -o bashdefault -o default -o nospace -F $wrapper $1 2> /dev/null || complete -o default -o nospace -F $wrapper $1 | |
} | |
__git_complete_file () | |
{ | |
__git_complete_revlist_file | |
} | |
__git_complete_index_file () | |
{ | |
local pfx="" cur_="$cur"; | |
case "$cur_" in | |
?*/*) | |
pfx="${cur_%/*}"; | |
cur_="${cur_##*/}"; | |
pfx="${pfx}/" | |
;; | |
esac; | |
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_" | |
} | |
__git_complete_remote_or_refspec () | |
{ | |
local cur_="$cur" cmd="${words[1]}"; | |
local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0; | |
if [ "$cmd" = "remote" ]; then | |
((c++)); | |
fi; | |
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) | |
return | |
;; | |
*) | |
;; | |
esac | |
;; | |
-*) | |
;; | |
*) | |
remote="$i"; | |
break | |
;; | |
esac; | |
((c++)); | |
done; | |
if [ -z "$remote" ]; then | |
__gitcomp_nl "$(__git_remotes)"; | |
return; | |
fi; | |
if [ $no_complete_refspec = 1 ]; then | |
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_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_"; | |
else | |
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"; | |
fi | |
;; | |
pull | remote) | |
if [ $lhs = 1 ]; then | |
__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"; | |
else | |
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"; | |
fi | |
;; | |
push) | |
if [ $lhs = 1 ]; then | |
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"; | |
else | |
__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"; | |
fi | |
;; | |
esac | |
} | |
__git_complete_revlist () | |
{ | |
__git_complete_revlist_file | |
} | |
__git_complete_revlist_file () | |
{ | |
local pfx ls ref cur_="$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; | |
__gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null | sed '/^100... blob /{ | |
s,^.* ,, | |
s,$, , | |
} | |
/^120000 blob /{ | |
s,^.* ,, | |
s,$, , | |
} | |
/^040000 tree /{ | |
s,^.* ,, | |
s,$,/, | |
} | |
s/^.* //')" "$pfx" "$cur_" "" | |
;; | |
*...*) | |
pfx="${cur_%...*}..."; | |
cur_="${cur_#*...}"; | |
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" | |
;; | |
*..*) | |
pfx="${cur_%..*}.."; | |
cur_="${cur_#*..}"; | |
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" | |
;; | |
*) | |
__gitcomp_nl "$(__git_refs)" | |
;; | |
esac | |
} | |
__git_complete_strategy () | |
{ | |
__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 () | |
{ | |
test -n "$__git_all_commands" || __git_all_commands=$(__git_list_all_commands) | |
} | |
__git_compute_merge_strategies () | |
{ | |
test -n "$__git_merge_strategies" || __git_merge_strategies=$(__git_list_merge_strategies) | |
} | |
__git_compute_porcelain_commands () | |
{ | |
__git_compute_all_commands; | |
test -n "$__git_porcelain_commands" || __git_porcelain_commands=$(__git_list_porcelain_commands) | |
} | |
__git_config_get_set_variables () | |
{ | |
local prevword word config_file= c=$cword; | |
while [ $c -gt 1 ]; do | |
word="${words[c]}"; | |
case "$word" in | |
--system | --global | --local | --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 -r line; do | |
case "$line" in | |
*.*=*) | |
echo "${line/=*/}" | |
;; | |
esac; | |
done | |
} | |
__git_count_arguments () | |
{ | |
local word i c=0; | |
for ((i=1; i < ${#words[@]}; i++)) | |
do | |
word="${words[i]}"; | |
case "$word" in | |
--) | |
((c = 0)) | |
;; | |
"$1") | |
((c = 0)) | |
;; | |
?*) | |
((c++)) | |
;; | |
esac; | |
done; | |
printf "%d" $c | |
} | |
__git_eread () | |
{ | |
f="$1"; | |
shift; | |
test -r "$f" && read "$@" < "$f" | |
} | |
__git_extras_workflow () | |
{ | |
__gitcomp "$(__git_heads | grep ^$1/ | sed s/^$1\\///g) finish" | |
} | |
__git_find_on_cmdline () | |
{ | |
local word subcommand c=1; | |
while [ $c -lt $cword ]; do | |
word="${words[c]}"; | |
for subcommand in $1; | |
do | |
if [ "$subcommand" = "$word" ]; then | |
echo "$subcommand"; | |
return; | |
fi; | |
done; | |
((c++)); | |
done | |
} | |
__git_func_wrap () | |
{ | |
local cur words cword prev; | |
_get_comp_words_by_ref -n =: cur words cword prev; | |
$1 | |
} | |
__git_has_doubledash () | |
{ | |
local c=1; | |
while [ $c -lt $cword ]; do | |
if [ "--" = "${words[c]}" ]; then | |
return 0; | |
fi; | |
((c++)); | |
done; | |
return 1 | |
} | |
__git_heads () | |
{ | |
local dir="$(__gitdir)"; | |
if [ -d "$dir" ]; then | |
git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/heads; | |
return; | |
fi | |
} | |
__git_index_files () | |
{ | |
local dir="$(__gitdir)" root="${2-.}" file; | |
if [ -d "$dir" ]; then | |
__git_ls_files_helper "$root" "$1" | while read -r file; do | |
case "$file" in | |
?*/*) | |
echo "${file%%/*}" | |
;; | |
*) | |
echo "$file" | |
;; | |
esac; | |
done | sort | uniq; | |
fi | |
} | |
__git_list_all_commands () | |
{ | |
local i IFS=" "' | |
'; | |
for i in $(__git_commands); | |
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 $__git_all_commands; | |
do | |
case $i in | |
*--*) | |
: helper pattern | |
;; | |
applymbox) | |
: ask gittus | |
;; | |
applypatch) | |
: ask gittus | |
;; | |
archimport) | |
: import | |
;; | |
cat-file) | |
: plumbing | |
;; | |
check-attr) | |
: plumbing | |
;; | |
check-ignore) | |
: plumbing | |
;; | |
check-mailmap) | |
: plumbing | |
;; | |
check-ref-format) | |
: plumbing | |
;; | |
checkout-index) | |
: plumbing | |
;; | |
commit-tree) | |
: plumbing | |
;; | |
count-objects) | |
: infrequent | |
;; | |
credential-cache) | |
: credentials helper | |
;; | |
credential-store) | |
: credentials helper | |
;; | |
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 | |
;; | |
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 | |
;; | |
prune) | |
: plumbing | |
;; | |
prune-packed) | |
: plumbing | |
;; | |
quiltimport) | |
: import | |
;; | |
read-tree) | |
: plumbing | |
;; | |
receive-pack) | |
: plumbing | |
;; | |
remote-*) | |
: transport | |
;; | |
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 | |
;; | |
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_ls_files_helper () | |
{ | |
( test -n "${CDPATH+set}" && unset CDPATH; | |
cd "$1"; | |
if [ "$2" == "--committable" ]; then | |
git diff-index --name-only --relative HEAD; | |
else | |
git ls-files --exclude-standard $2; | |
fi ) 2> /dev/null | |
} | |
__git_main () | |
{ | |
local i c=1 command __git_dir; | |
while [ $c -lt $cword ]; do | |
i="${words[c]}"; | |
case "$i" in | |
--git-dir=*) | |
__git_dir="${i#--git-dir=}" | |
;; | |
--git-dir) | |
((c++)); | |
__git_dir="${words[c]}" | |
;; | |
--bare) | |
__git_dir="." | |
;; | |
--help) | |
command="help"; | |
break | |
;; | |
-c | --work-tree | --namespace) | |
((c++)) | |
;; | |
-*) | |
;; | |
*) | |
command="$i"; | |
break | |
;; | |
esac; | |
((c++)); | |
done; | |
if [ -z "$command" ]; then | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--paginate | |
--no-pager | |
--git-dir= | |
--bare | |
--version | |
--exec-path | |
--exec-path= | |
--html-path | |
--man-path | |
--info-path | |
--work-tree= | |
--namespace= | |
--no-replace-objects | |
--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 | |
words[1]=$expansion; | |
completion_func="_git_${expansion//-/_}"; | |
declare -f $completion_func > /dev/null && $completion_func; | |
fi | |
} | |
__git_match_ctag () | |
{ | |
awk "/^${1////\\/}/ { print \$1 }" "$2" | |
} | |
__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 pcmode=no; | |
local detached=no; | |
local ps1pc_start='\u@\h:\w '; | |
local ps1pc_end='\$ '; | |
local printf_format=' (%s)'; | |
case "$#" in | |
2 | 3) | |
pcmode=yes; | |
ps1pc_start="$1"; | |
ps1pc_end="$2"; | |
printf_format="${3:-$printf_format}" | |
;; | |
0 | 1) | |
printf_format="${1:-$printf_format}" | |
;; | |
*) | |
return | |
;; | |
esac; | |
local ps1_expanded=yes; | |
[ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no; | |
[ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no; | |
local repo_info rev_parse_exit_code; | |
repo_info="$(git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD 2>/dev/null)"; | |
rev_parse_exit_code="$?"; | |
if [ -z "$repo_info" ]; then | |
if [ $pcmode = yes ]; then | |
PS1="$ps1pc_start$ps1pc_end"; | |
fi; | |
return; | |
fi; | |
local short_sha; | |
if [ "$rev_parse_exit_code" = "0" ]; then | |
short_sha="${repo_info##* | |
}"; | |
repo_info="${repo_info% | |
*}"; | |
fi; | |
local inside_worktree="${repo_info##* | |
}"; | |
repo_info="${repo_info% | |
*}"; | |
local bare_repo="${repo_info##* | |
}"; | |
repo_info="${repo_info% | |
*}"; | |
local inside_gitdir="${repo_info##* | |
}"; | |
local g="${repo_info% | |
*}"; | |
local r=""; | |
local b=""; | |
local step=""; | |
local total=""; | |
if [ -d "$g/rebase-merge" ]; then | |
__git_eread "$g/rebase-merge/head-name" b; | |
__git_eread "$g/rebase-merge/msgnum" step; | |
__git_eread "$g/rebase-merge/end" total; | |
if [ -f "$g/rebase-merge/interactive" ]; then | |
r="|REBASE-i"; | |
else | |
r="|REBASE-m"; | |
fi; | |
else | |
if [ -d "$g/rebase-apply" ]; then | |
__git_eread "$g/rebase-apply/next" step; | |
__git_eread "$g/rebase-apply/last" total; | |
if [ -f "$g/rebase-apply/rebasing" ]; then | |
__git_eread "$g/rebase-apply/head-name" b; | |
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/REVERT_HEAD" ]; then | |
r="|REVERTING"; | |
else | |
if [ -f "$g/BISECT_LOG" ]; then | |
r="|BISECTING"; | |
fi; | |
fi; | |
fi; | |
fi; | |
fi; | |
if [ -n "$b" ]; then | |
:; | |
else | |
if [ -h "$g/HEAD" ]; then | |
b="$(git symbolic-ref HEAD 2>/dev/null)"; | |
else | |
local head=""; | |
if ! __git_eread "$g/HEAD" head; then | |
if [ $pcmode = yes ]; then | |
PS1="$ps1pc_start$ps1pc_end"; | |
fi; | |
return; | |
fi; | |
b="${head#ref: }"; | |
if [ "$head" = "$b" ]; then | |
detached=yes; | |
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="$short_sha..."; | |
b="($b)"; | |
fi; | |
fi; | |
fi; | |
fi; | |
if [ -n "$step" ] && [ -n "$total" ]; then | |
r="$r $step/$total"; | |
fi; | |
local w=""; | |
local i=""; | |
local s=""; | |
local u=""; | |
local c=""; | |
local p=""; | |
if [ "true" = "$inside_gitdir" ]; then | |
if [ "true" = "$bare_repo" ]; then | |
c="BARE:"; | |
else | |
b="GIT_DIR!"; | |
fi; | |
else | |
if [ "true" = "$inside_worktree" ]; then | |
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && [ "$(git config --bool bash.showDirtyState)" != "false" ]; then | |
git diff --no-ext-diff --quiet --exit-code || w="*"; | |
if [ -n "$short_sha" ]; then | |
git diff-index --cached --quiet HEAD -- || i="+"; | |
else | |
i="#"; | |
fi; | |
fi; | |
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && [ -r "$g/refs/stash" ]; then | |
s="$"; | |
fi; | |
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && git ls-files --others --exclude-standard --error-unmatch -- '*' > /dev/null 2> /dev/null; then | |
u="%${ZSH_VERSION+%}"; | |
fi; | |
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then | |
__git_ps1_show_upstream; | |
fi; | |
fi; | |
fi; | |
local z="${GIT_PS1_STATESEPARATOR-" "}"; | |
if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then | |
__git_ps1_colorize_gitstring; | |
fi; | |
b=${b##refs/heads/}; | |
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then | |
__git_ps1_branch_name=$b; | |
b="\${__git_ps1_branch_name}"; | |
fi; | |
local f="$w$i$s$u"; | |
local gitstring="$c$b${f:+$z$f}$r$p"; | |
if [ $pcmode = yes ]; then | |
if [ "${__git_printf_supports_v-}" != yes ]; then | |
gitstring=$(printf -- "$printf_format" "$gitstring"); | |
else | |
printf -v gitstring -- "$printf_format" "$gitstring"; | |
fi; | |
PS1="$ps1pc_start$gitstring$ps1pc_end"; | |
else | |
printf -- "$printf_format" "$gitstring"; | |
fi | |
} | |
__git_ps1_colorize_gitstring () | |
{ | |
if [[ -n ${ZSH_VERSION-} ]]; then | |
local c_red='%F{red}'; | |
local c_green='%F{green}'; | |
local c_lblue='%F{blue}'; | |
local c_clear='%f'; | |
else | |
local c_red='\[\e[31m\]'; | |
local c_green='\[\e[32m\]'; | |
local c_lblue='\[\e[1;34m\]'; | |
local c_clear='\[\e[0m\]'; | |
fi; | |
local bad_color=$c_red; | |
local ok_color=$c_green; | |
local flags_color="$c_lblue"; | |
local branch_color=""; | |
if [ $detached = no ]; then | |
branch_color="$ok_color"; | |
else | |
branch_color="$bad_color"; | |
fi; | |
c="$branch_color$c"; | |
z="$c_clear$z"; | |
if [ "$w" = "*" ]; then | |
w="$bad_color$w"; | |
fi; | |
if [ -n "$i" ]; then | |
i="$ok_color$i"; | |
fi; | |
if [ -n "$s" ]; then | |
s="$flags_color$s"; | |
fi; | |
if [ -n "$u" ]; then | |
u="$bad_color$u"; | |
fi; | |
r="$c_clear$r" | |
} | |
__git_ps1_show_upstream () | |
{ | |
local key value; | |
local svn_remote svn_url_pattern count n; | |
local upstream=git legacy="" verbose="" name=""; | |
svn_remote=(); | |
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"; | |
while read -r 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="$svn_url_pattern\\|$value"; | |
upstream=svn+git | |
;; | |
esac; | |
done <<< "$output"; | |
for option in ${GIT_PS1_SHOWUPSTREAM}; | |
do | |
case "$option" in | |
git | svn) | |
upstream="$option" | |
;; | |
verbose) | |
verbose=1 | |
;; | |
legacy) | |
legacy=1 | |
;; | |
name) | |
name=1 | |
;; | |
esac; | |
done; | |
case "$upstream" in | |
git) | |
upstream="@{upstream}" | |
;; | |
svn*) | |
local -a svn_upstream; | |
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 | |
"<"*) | |
((behind++)) | |
;; | |
*) | |
((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; | |
if [[ -n "$count" && -n "$name" ]]; then | |
__git_ps1_upstream_name=$(git rev-parse --abbrev-ref "$upstream" 2>/dev/null); | |
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then | |
p="$p \${__git_ps1_upstream_name}"; | |
else | |
p="$p ${__git_ps1_upstream_name}"; | |
unset __git_ps1_upstream_name; | |
fi; | |
fi; | |
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 hash dir="$(__gitdir "${1-}")" track="${2-}"; | |
local format refs; | |
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 -r entry; do | |
eval "$entry"; | |
ref="${ref#*/}"; | |
if [[ "$ref" == "$cur"* ]]; then | |
echo "$ref"; | |
fi; | |
done | sort | uniq -u; | |
fi; | |
return; | |
fi; | |
case "$cur" in | |
refs | refs/*) | |
git ls-remote "$dir" "$cur*" 2> /dev/null | while read -r hash i; do | |
case "$i" in | |
*^{}) | |
;; | |
*) | |
echo "$i" | |
;; | |
esac; | |
done | |
;; | |
*) | |
echo "HEAD"; | |
git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##" | |
;; | |
esac | |
} | |
__git_refs2 () | |
{ | |
local i; | |
for i in $(__git_refs "$1"); | |
do | |
echo "$i:$i"; | |
done | |
} | |
__git_refs_remotes () | |
{ | |
local i hash; | |
git ls-remote "$1" 'refs/heads/*' 2> /dev/null | while read -r hash i; do | |
echo "$i:refs/remotes/$1/${i#refs/heads/}"; | |
done | |
} | |
__git_remotes () | |
{ | |
local i IFS=' | |
' d="$(__gitdir)"; | |
test -d "$d/remotes" && ls -1 "$d/remotes"; | |
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 dir="$(__gitdir)"; | |
if [ -d "$dir" ]; then | |
git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/tags; | |
return; | |
fi | |
} | |
__git_wrap__git_main () | |
{ | |
__git_func_wrap __git_main | |
} | |
__git_wrap__gitk_main () | |
{ | |
__git_func_wrap __gitk_main | |
} | |
__gitcomp () | |
{ | |
local cur_="${3-$cur}"; | |
case "$cur_" in | |
--*=) | |
;; | |
*) | |
local c i=0 IFS=' | |
'; | |
for c in $1; | |
do | |
c="$c${4-}"; | |
if [[ $c == "$cur_"* ]]; then | |
case $c in | |
--*=* | *.) | |
;; | |
*) | |
c="$c " | |
;; | |
esac; | |
COMPREPLY[i++]="${2-}$c"; | |
fi; | |
done | |
;; | |
esac | |
} | |
__gitcomp_file () | |
{ | |
local IFS=' | |
'; | |
__gitcompadd "$1" "${2-}" "${3-$cur}" ""; | |
compopt -o filenames +o nospace 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null | |
} | |
__gitcomp_nl () | |
{ | |
COMPREPLY=(); | |
__gitcomp_nl_append "$@" | |
} | |
__gitcomp_nl_append () | |
{ | |
local IFS=' | |
'; | |
__gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" | |
} | |
__gitcompadd () | |
{ | |
COMPREPLY=(); | |
__gitcompappend "$@" | |
} | |
__gitcompappend () | |
{ | |
local i=${#COMPREPLY[@]}; | |
for x in $1; | |
do | |
if [[ "$x" == "$3"* ]]; then | |
COMPREPLY[i++]="$2$x$4"; | |
fi; | |
done | |
} | |
__gitdir () | |
{ | |
if [ -z "${1-}" ]; then | |
if [ -n "${__git_dir-}" ]; then | |
echo "$__git_dir"; | |
else | |
if [ -n "${GIT_DIR-}" ]; then | |
test -d "${GIT_DIR-}" || return 1; | |
echo "$GIT_DIR"; | |
else | |
if [ -d .git ]; then | |
echo .git; | |
else | |
git rev-parse --git-dir 2> /dev/null; | |
fi; | |
fi; | |
fi; | |
else | |
if [ -d "$1/.git" ]; then | |
echo "$1/.git"; | |
else | |
echo "$1"; | |
fi; | |
fi | |
} | |
__gitk_main () | |
{ | |
__git_has_doubledash && return; | |
local g="$(__gitdir)"; | |
local merge=""; | |
if [ -f "$g/MERGE_HEAD" ]; then | |
merge="--merge"; | |
fi; | |
case "$cur" in | |
--*) | |
__gitcomp " | |
$__git_log_common_options | |
$__git_log_gitk_options | |
$merge | |
"; | |
return | |
;; | |
esac; | |
__git_complete_revlist | |
} | |
__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 | |
} | |
__tig_complete_file () | |
{ | |
local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
?*:*) | |
ref="${cur%%:*}"; | |
cur="${cur#*:}"; | |
case "$cur" in | |
?*/*) | |
pfx="${cur%/*}"; | |
cur="${cur##*/}"; | |
ls="$ref:$pfx"; | |
pfx="$pfx/" | |
;; | |
*) | |
ls="$ref" | |
;; | |
esac; | |
COMPREPLY=($(compgen -P "$pfx" -W "$(git --git-dir="$(__tigdir)" ls-tree "$ls" | sed '/^100... blob /s,^.* ,, | |
/^040000 tree /{ | |
s,^.* ,, | |
s,$,/, | |
} | |
s/^.* //')" -- "$cur")) | |
;; | |
*) | |
_tigcomp "$(__tig_refs)" | |
;; | |
esac | |
} | |
__tig_complete_revlist () | |
{ | |
local pfx cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
*...*) | |
pfx="${cur%...*}..."; | |
cur="${cur#*...}"; | |
_tigcomp "$(__tig_refs)" "$pfx" "$cur" | |
;; | |
*..*) | |
pfx="${cur%..*}.."; | |
cur="${cur#*..}"; | |
_tigcomp "$(__tig_refs)" "$pfx" "$cur" | |
;; | |
*.) | |
_tigcomp "$cur." | |
;; | |
*) | |
_tigcomp "$(__tig_refs)" | |
;; | |
esac | |
} | |
__tig_refs () | |
{ | |
local cmd i is_hash=y dir="$(__tigdir "$1")"; | |
if [ -d "$dir" ]; then | |
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; | |
do | |
if [ -e "$dir/$i" ]; then | |
echo $i; | |
fi; | |
done; | |
for i in $(git --git-dir="$dir" for-each-ref --format='%(refname)' refs/tags refs/heads refs/remotes); | |
do | |
case "$i" in | |
refs/tags/*) | |
echo "${i#refs/tags/}" | |
;; | |
refs/heads/*) | |
echo "${i#refs/heads/}" | |
;; | |
refs/remotes/*) | |
echo "${i#refs/remotes/}" | |
;; | |
*) | |
echo "$i" | |
;; | |
esac; | |
done; | |
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 | |
} | |
__tigdir () | |
{ | |
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 | |
} | |
__youtube_dl () | |
{ | |
local cur prev opts fileopts diropts keywords; | |
COMPREPLY=(); | |
cur="${COMP_WORDS[COMP_CWORD]}"; | |
prev="${COMP_WORDS[COMP_CWORD-1]}"; | |
opts="--help --version --update --ignore-errors --abort-on-error --dump-user-agent --user-agent --referer --add-header --list-extractors --extractor-descriptions --proxy --no-check-certificate --prefer-insecure --cache-dir --no-cache-dir --socket-timeout --bidi-workaround --default-search --ignore-config --encoding --playlist-start --playlist-end --match-title --reject-title --max-downloads --min-filesize --max-filesize --date --datebefore --dateafter --min-views --max-views --no-playlist --age-limit --download-archive --include-ads --youtube-include-dash-manifest --rate-limit --retries --buffer-size --no-resize-buffer --test --title --id --literal --auto-number --output --autonumber-size --restrict-filenames --batch-file --load-info --no-overwrites --continue --no-continue --cookies --no-part --no-mtime --write-description --write-info-json --write-annotations --write-thumbnail --quiet --no-warnings --simulate --skip-download --get-url --get-title --get-id --get-thumbnail --get-description --get-duration --get-filename --get-format --dump-json --newline --no-progress --console-title --verbose --dump-intermediate-pages --write-pages --youtube-print-sig-code --print-traffic --format --all-formats --prefer-free-formats --max-quality --list-formats --write-sub --write-auto-sub --all-subs --list-subs --sub-format --sub-lang --username --password --netrc --video-password --extract-audio --audio-format --audio-quality --recode-video --keep-video --no-post-overwrites --embed-subs --embed-thumbnail --add-metadata --xattrs --prefer-avconv --prefer-ffmpeg"; | |
keywords=":ytfavorites :ytrecommended :ytsubscriptions :ytwatchlater :ythistory"; | |
fileopts="-a|--batch-file|--download-archive|--cookies|--load-info"; | |
diropts="--cache-dir"; | |
if [[ ${prev} =~ ${fileopts} ]]; then | |
COMPREPLY=($(compgen -f -- ${cur})); | |
return 0; | |
else | |
if [[ ${prev} =~ ${diropts} ]]; then | |
COMPREPLY=($(compgen -d -- ${cur})); | |
return 0; | |
fi; | |
fi; | |
if [[ ${cur} =~ : ]]; then | |
COMPREPLY=($(compgen -W "${keywords}" -- ${cur})); | |
return 0; | |
else | |
if [[ ${cur} == * ]]; then | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})); | |
return 0; | |
fi; | |
fi | |
} | |
_aclocal () | |
{ | |
COMPREPLY=(); | |
local cur prev split=false; | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case "$prev" in | |
--help | --print-ac-dir | --version) | |
return 0 | |
;; | |
--acdir | -I) | |
_filedir -d; | |
return 0 | |
;; | |
--output) | |
_filedir; | |
return 0 | |
;; | |
--warnings | -W) | |
local cats=(syntax unsupported); | |
COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
_longopt $1 | |
} | |
_ag () | |
{ | |
local lngopt shtopt split=false; | |
local cur prev; | |
COMPREPLY=(); | |
cur=$(_get_cword "="); | |
prev="${COMP_WORDS[COMP_CWORD-1]}"; | |
_expand || return 0; | |
lngopt=' | |
--ackmate | |
--all-text | |
--all-types | |
--after | |
--before | |
--break | |
--nobreak | |
--case-sensitive | |
--color-line-number | |
--color-match | |
--color-path | |
--color | |
--nocolor | |
--column | |
--context | |
--debug | |
--depth | |
--file-search-regex | |
--files-with-matches | |
--files-without-matches | |
--follow | |
--group | |
--nogroup | |
--heading | |
--noheading | |
--help | |
--hidden | |
--ignore | |
--ignore-case | |
--ignore-dir | |
--invert-match | |
--line-numbers | |
--list-file-types | |
--literal | |
--max-count | |
--no-numbers | |
--pager | |
--nopager | |
--parallel | |
--path-to-agignore | |
--print-long-lines | |
--recurse | |
--no-recurse | |
--search-binary | |
--search-files | |
--search-zip | |
--silent | |
--skip-vcs-ignores | |
--smart-case | |
--stats | |
--unrestricted | |
--version | |
--word-regexp | |
--workers | |
'; | |
shtopt=' | |
-a -A -B -C -D | |
-f -g -G -h -i | |
-l -L -m -n -p | |
-Q -r -R -s -S | |
-t -u -U -v -V | |
-w -z | |
'; | |
if [[ "${prev}" == -@(A|B|C|G|g|m) ]]; then | |
return 0; | |
fi; | |
_split_longopt && split=true; | |
case "${prev}" in | |
--ignore-dir) | |
_filedir -d; | |
return 0 | |
;; | |
--path-to-agignore) | |
_filedir; | |
return 0 | |
;; | |
--pager) | |
COMPREPLY=($(compgen -c -- "${cur}")); | |
return 0 | |
;; | |
--ackmate-dir-filter | --after | --before | --color-* | --context | --depth | --file-search-regex | --ignore | --max-count | --workers) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
case "${cur}" in | |
-*) | |
if [[ "${COMP_CWORD}" -eq 1 ]]; then | |
COMPREPLY=($(compgen -W "${lngopt} ${shtopt}" -- "${cur}")); | |
else | |
COMPREPLY=($(compgen -W "${lngopt} ${shtopt}" -- "${cur}")); | |
fi; | |
return 0 | |
;; | |
*) | |
_filedir; | |
return 0 | |
;; | |
esac | |
} | |
_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 | |
} | |
_animate () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-alpha -authenticate -backdrop \ | |
-background -bordercolor -borderwidth -channel \ | |
-coalesce -colormap -colors -colorspace -crop -debug \ | |
-decipher -define -delay -density -depth -display \ | |
-dispose -dither -extract -filter -flatten -font \ | |
-foreground -format -gamma -geometry -help \ | |
-iconGeometry -iconic -identify -immutable -interlace \ | |
-interpolate -limit -list -log -loop -map -mattecolor \ | |
-mattecolor -monitor -monochrome -name -page -pause \ | |
-quantize -quiet -regard-warnings -remote -repage \ | |
-resample -resize -respect-parenthesis -rotate \ | |
-sampling-factor -scenes -seed -set -shared-memory \ | |
-size -strip -title -transparent-color -treedepth \ | |
-trim -verbose -version -virtual-pixel -visual \ | |
-window' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug +dither +gamma +map +matte' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_ant () | |
{ | |
local cur prev buildfile i; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-buildfile | -file | -f) | |
_filedir 'xml'; | |
return 0 | |
;; | |
-logfile | -l) | |
_filedir; | |
return 0 | |
;; | |
-propertyfile) | |
_filedir properties; | |
return 0 | |
;; | |
-nice) | |
COMPREPLY=($( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" )); | |
return 0 | |
;; | |
-lib | -logger | -listener | -D | -inputhandler | -main) | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-help -projecthelp -version -diagnostics \ | |
-quiet -verbose -debug -emacs -lib -logfile -logger -listener \ | |
-noinput -buildfile -D -keep-going -propertyfile -inputhandler \ | |
-find -s -nice -nouserlib -noclasspath -autoproxy -main' -- "$cur" )); | |
else | |
buildfile=build.xml; | |
for ((i=1; i < COMP_CWORD; i++ )) | |
do | |
if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then | |
buildfile=${COMP_WORDS[i+1]}; | |
break; | |
fi; | |
done; | |
[ ! -f $buildfile ] && return 0; | |
COMPREPLY=($( compgen -W "$( cat $buildfile | tr "'\t\n>" "\" \n" | sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" -- "$cur" )); | |
fi | |
} | |
_autoconf () | |
{ | |
COMPREPLY=(); | |
local cur prev split=false; | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case "$prev" in | |
--help | -h | --version | -V | --trace | -t) | |
return 0 | |
;; | |
--output | -o) | |
_filedir; | |
return 0 | |
;; | |
--warnings | -W) | |
local cats=(cross obsolete syntax); | |
COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); | |
return 0 | |
;; | |
--prepend-include | -B | --include | -I) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
_longopt $1; | |
return; | |
fi; | |
_filedir '@(ac|in)' | |
} | |
_automake () | |
{ | |
COMPREPLY=(); | |
local cur prev split=false; | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case "$prev" in | |
--help | --version) | |
return 0 | |
;; | |
--warnings | -W) | |
local cats=(gnu obsolete override portability syntax unsupported); | |
COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); | |
return 0 | |
;; | |
--libdir) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
_longopt $1; | |
return; | |
fi; | |
_filedir | |
} | |
_autoreconf () | |
{ | |
COMPREPLY=(); | |
local cur prev split=false; | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case "$prev" in | |
--help | -h | --version | -V) | |
return 0 | |
;; | |
--warnings | -W) | |
local cats=(cross gnu obsolete override portability syntax unsupported); | |
COMPREPLY=($( compgen -W '${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" )); | |
return 0 | |
;; | |
--prepend-include | -B | --include | -I) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
_longopt $1; | |
return 0; | |
fi; | |
if [[ $1 == autoheader ]]; then | |
_filedir '@(ac|in)'; | |
else | |
_filedir -d; | |
fi | |
} | |
_autoscan () | |
{ | |
COMPREPLY=(); | |
local cur prev split=false; | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case "$prev" in | |
--help | -h | --version | -V) | |
return 0 | |
;; | |
--prepend-include | -B | --include | -I) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
_longopt $1; | |
return 0; | |
fi; | |
if [[ $1 == autoupdate ]]; then | |
_filedir '@(ac|in)'; | |
else | |
_filedir -d; | |
fi | |
} | |
_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" )) | |
} | |
_brew () | |
{ | |
local i=1 cmd; | |
while [[ $i -lt $COMP_CWORD ]]; do | |
local s="${COMP_WORDS[i]}"; | |
case "$s" in | |
--*) | |
cmd="$s"; | |
break | |
;; | |
-*) | |
;; | |
*) | |
cmd="$s"; | |
break | |
;; | |
esac; | |
i=$((++i)); | |
done; | |
if [[ $i -eq $COMP_CWORD ]]; then | |
local ext=$(\ls -p $(brew --repository)/Library/Contributions/cmd 2>/dev/null | sed -e "s/\.rb//g" -e "s/brew-//g" -e "s/.*\///g"); | |
__brewcomp " | |
--cache --cellar | |
--env --prefix --repository | |
audit | |
cat | |
cleanup | |
commands | |
config --config | |
create | |
deps | |
diy configure | |
doctor | |
edit | |
fetch | |
help | |
home | |
info abv | |
install | |
linkapps | |
link ln | |
list ls | |
log | |
missing | |
options | |
outdated | |
prune | |
pin | |
search | |
reinstall | |
tap | |
test | |
uninstall remove rm | |
unlink | |
unlinkapps | |
unpin | |
untap | |
update | |
upgrade | |
uses | |
versions | |
$ext | |
"; | |
return; | |
fi; | |
case "$cmd" in | |
--cache | --cellar | --prefix) | |
__brew_complete_formulae | |
;; | |
audit | cat | edit | home) | |
__brew_complete_formulae | |
;; | |
test | unlink) | |
__brew_complete_installed | |
;; | |
bottle) | |
_brew_bottle | |
;; | |
cleanup) | |
_brew_cleanup | |
;; | |
create) | |
_brew_create | |
;; | |
deps) | |
_brew_deps | |
;; | |
doctor | dr) | |
_brew_doctor | |
;; | |
diy | configure) | |
_brew_diy | |
;; | |
fetch) | |
_brew_fetch | |
;; | |
info | abv) | |
_brew_info | |
;; | |
install | instal | reinstall) | |
_brew_install | |
;; | |
link | ln) | |
_brew_link | |
;; | |
linkapps) | |
_brew_linkapps | |
;; | |
list | ls) | |
_brew_list | |
;; | |
log) | |
_brew_log | |
;; | |
missing) | |
__brew_complete_formulae | |
;; | |
options) | |
_brew_options | |
;; | |
outdated) | |
_brew_outdated | |
;; | |
pin) | |
__brew_complete_formulae | |
;; | |
search | -S) | |
_brew_search | |
;; | |
switch) | |
_brew_switch | |
;; | |
tap) | |
_brew_complete_tap | |
;; | |
uninstall | remove | rm) | |
_brew_uninstall | |
;; | |
unpack) | |
_brew_unpack | |
;; | |
unpin) | |
__brew_complete_formulae | |
;; | |
untap) | |
__brew_complete_tapped | |
;; | |
update) | |
_brew_update | |
;; | |
upgrade) | |
_brew_upgrade | |
;; | |
uses) | |
_brew_uses | |
;; | |
versions) | |
__brew_complete_formulae | |
;; | |
*) | |
;; | |
esac | |
} | |
_brew_bottle () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--merge --rb --write --root_url="; | |
return | |
;; | |
esac; | |
__brew_complete_installed | |
} | |
_brew_cleanup () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--force"; | |
return | |
;; | |
esac; | |
__brew_complete_installed | |
} | |
_brew_complete_tap () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--repair"; | |
return | |
;; | |
esac | |
} | |
_brew_create () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--autotools --cmake --no-fetch --set-name --set-version"; | |
return | |
;; | |
esac | |
} | |
_brew_deps () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--1 --all --tree"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_diy () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--set-name --set-version"; | |
return | |
;; | |
esac | |
} | |
_brew_doctor () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
__brewcomp "$(brew doctor --list-checks)" | |
} | |
_brew_fetch () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local prv=$(__brewcomp_prev); | |
case "$cur" in | |
--*) | |
__brewcomp " | |
--deps --force | |
--devel --HEAD | |
--build-from-source --force-bottle --build-bottle | |
--retry | |
$(brew options --compact "$prv" 2>/dev/null) | |
"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_info () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--all --github --installed --json=v1"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_install () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local prv=$(__brewcomp_prev); | |
case "$cur" in | |
--*) | |
if __brewcomp_words_include "--interactive"; then | |
__brewcomp "--devel --git --HEAD"; | |
else | |
__brewcomp " | |
--build-from-source --build-bottle --force-bottle | |
--debug | |
--devel | |
--HEAD | |
--ignore-dependencies | |
--interactive | |
--only-dependencies | |
--verbose | |
$(brew options --compact "$prv" 2>/dev/null) | |
"; | |
fi; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_link () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--dry-run --overwrite --force"; | |
return | |
;; | |
esac; | |
__brew_complete_installed | |
} | |
_brew_linkapps () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--local"; | |
return | |
;; | |
esac | |
} | |
_brew_list () | |
{ | |
local allopts="--unbrewed --verbose --pinned --versions --multiple"; | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
if __brewcomp_words_include "--unbrewed"; then | |
return; | |
else | |
if __brewcomp_words_include "--verbose"; then | |
return; | |
else | |
if __brewcomp_words_include "--pinned"; then | |
return; | |
else | |
if __brewcomp_words_include "--multiple"; then | |
__brewcomp "--versions"; | |
return; | |
else | |
if __brewcomp_words_include "--versions"; then | |
__brewcomp "--multiple"; | |
return; | |
else | |
__brewcomp "$allopts"; | |
return; | |
fi; | |
fi; | |
fi; | |
fi; | |
fi | |
;; | |
esac; | |
if __brewcomp_words_include "--multiple"; then | |
__brewcomp "--versions"; | |
else | |
__brew_complete_installed; | |
fi | |
} | |
_brew_log () | |
{ | |
declare -F _git_log > /dev/null || return; | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp " | |
$__git_log_common_options | |
$__git_log_shortlog_options | |
$__git_log_gitk_options | |
$__git_diff_common_options | |
--walk-reflogs --graph --decorate | |
--abbrev-commit --oneline --reverse | |
"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_options () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--all --compact --installed"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_outdated () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--quiet"; | |
return | |
;; | |
esac | |
} | |
_brew_search () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--debian --fedora --fink --macports --opensuse --ubuntu"; | |
return | |
;; | |
esac | |
} | |
_brew_switch () | |
{ | |
case "$COMP_CWORD" in | |
2) | |
__brew_complete_installed | |
;; | |
3) | |
__brew_complete_versions "${COMP_WORDS[COMP_CWORD-1]}" | |
;; | |
*) | |
;; | |
esac | |
} | |
_brew_to_completion () | |
{ | |
_brew | |
} | |
_brew_uninstall () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--force"; | |
return | |
;; | |
esac; | |
__brew_complete_installed | |
} | |
_brew_unpack () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--git --patch --destdir="; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_brew_update () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--rebase --verbose"; | |
return | |
;; | |
esac | |
} | |
_brew_upgrade () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
local prv=$(__brewcomp_prev); | |
case "$cur" in | |
--*) | |
__brewcomp " | |
--build-from-source --build-bottle --force-bottle | |
--debug | |
--verbose | |
"; | |
return | |
;; | |
esac; | |
__brew_complete_outdated | |
} | |
_brew_uses () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--*) | |
__brewcomp "--installed --recursive"; | |
return | |
;; | |
esac; | |
__brew_complete_formulae | |
} | |
_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" )) | |
} | |
_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/}" )) | |
} | |
_cdsitepackages_complete () | |
{ | |
local cur="$2"; | |
COMPREPLY=($(cdsitepackages && compgen -d -- "${cur}" )) | |
} | |
_cdvirtualenv_complete () | |
{ | |
local cur="$2"; | |
COMPREPLY=($(cdvirtualenv && compgen -d -- "${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 | |
} | |
_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 | |
} | |
_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 | |
} | |
_compare () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-alpha -authenticate -channel \ | |
-colorspace -compress -debug -decipher -define \ | |
-density -depth -encipher -extract -format -fuzz \ | |
-help -highlight-color -identify -interlace -limit \ | |
-list -log -metric -monitor -passphrase -profile \ | |
-quality -quantize -quiet -regard-warnings \ | |
-respect-parenthesis -sampling-factor -seed -set \ | |
-size -transparent-color -type -verbose -version \ | |
-virtual-pixel' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_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 | |
} | |
_composite () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-affine -alpha -authenticate \ | |
-blend -blue-primary -border -bordercolor -channel \ | |
-colors -colorspace -comment -compose -compress \ | |
-debug -decipher -define -density -depth -displace \ | |
-display -dispose -dissolve -dither -encipher \ | |
-encoding -endian -extract -filter -font -format \ | |
-geometry -gravity -green-primary -help -identify \ | |
-interlace -interpolate -label -limit -list -log \ | |
-monitor -monochrome -negate -page -profile -quality \ | |
-quantize -quiet -red-primary -regard-warnings \ | |
-repage -resize -respect-parenthesis -rotate \ | |
-sampling-factor -scene -seed -sharpen -shave -size \ | |
-stegano -stereo -strip -swap -thumbnail -tile \ | |
-transform -transparent-color -treedepth -type -units \ | |
-unsharp -verbose -version -virtual-pixel -watermark \ | |
-white-point -write' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+compress +debug +dither +endian +label \ | |
+matte +negate +page +write' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_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 | |
} | |
_conjure () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-debug -help -list -log -monitor -quiet \ | |
-regard-warnings -seed -verbose -version' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_convert () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-adaptive-blur -adaptive-resize \ | |
-adaptive-sharpen -adjoin -affine -alpha -annotate \ | |
-antialias -append -attenuate -authenticate \ | |
-auto-orient -average -background -bench -bias \ | |
-black-point-compensation -black-threshold \ | |
-blue-primary -blur -border -bordercolor -caption \ | |
-channel -charcoal -chop -clip -clip-mask -clip-path \ | |
-clone -clut -coalesce -colorize -colors -colorspace \ | |
-combine -comment -compose -composite -compress \ | |
-contrast -contrast-stretch -convolve -crop -cycle \ | |
-debug -decipher -deconstruct -define -delay -delete \ | |
-density -depth -despeckle -display -dispose -distort \ | |
-dither -draw -edge -emboss -encipher -encoding \ | |
-endian -enhance -equalize -evaluate -extent -extract \ | |
-family -fill -filter -flatten -flip -floodfill -flop \ | |
-font -format -frame -fuzz -fx -gamma -gaussian-blur \ | |
-geometry -gravity -green-primary -help -identify \ | |
-implode -insert -intent -interlace -interpolate \ | |
-label -lat -layers -level -limit -linear-stretch \ | |
-liquid-rescale -list -log -loop -map -mask \ | |
-mattecolor -median -modulate -monitor -monochrome \ | |
-morph -mosaic -motion-blur -negate -noise -normalize \ | |
-opaque -ordered-dither -orient -page -paint -ping \ | |
-pointsize -polaroid -posterize -preview -print \ | |
-process -profile -quality -quantize -quiet \ | |
-radial-blur -raise -random-threshold -recolor \ | |
-red-primary -regard-warnings -region -render -repage \ | |
-resample -resize -respect-parenthesis -reverse -roll \ | |
-rotate -sample -sampling-factor -scale -scene -seed \ | |
-segment -separate -sepia-tone -set -shade -shadow \ | |
-sharpen -shave -shear -sigmoidal-contrast -size \ | |
-sketch -solarize -splice -spread -stretch -strip \ | |
-stroke -strokewidth -style -swap -swirl -taint \ | |
-texture -threshold -thumbnail -tile -tile-offset \ | |
-tint -transform -transparent -transparent-color \ | |
-transpose -transverse -treedepth -trim -type \ | |
-undercolor -unique-colors -units -unsharp -verbose \ | |
-version -view -vignette -virtual-pixel -wave \ | |
-weight -white-point -white-threshold \ | |
-write' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+adjoin +append +compress \ | |
+contrast +debug +dither +endian +gamma +label +map \ | |
+mask +matte +negate +noise +page +raise +render \ | |
+write' -- "$cur" )); | |
else | |
_filedir; | |
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" )) | |
} | |
_createdb () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-h | --host) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-U | --username | -O | --owner) | |
_pg_users; | |
return 0 | |
;; | |
-p | --port | -D | --tablespace | -E | --encoding | -T | --template) | |
return 0 | |
;; | |
--help | --version) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '--tablespace --template --encoding --host \ | |
--port --username --password --echo --quiet --help --version' -- "$cur" )); | |
else | |
_pg_databases; | |
fi | |
} | |
_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" )) | |
} | |
_display () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-alpha -antialias -authenticate \ | |
-auto-orient -backdrop -background -border \ | |
-bordercolor -borderwidth -channel -clip \ | |
-clip-path -coalesce -colormap -colors -colorspace \ | |
-comment -compress -contrast -crop -debug -decipher \ | |
-define -delay -density -depth -despeckle -display \ | |
-dispose -dither -edge -endian -enhance -extract \ | |
-filter -flatten -flip -flop -font -foreground \ | |
-format -frame -gamma -geometry -help -iconGeometry \ | |
-iconic -identify -immutable -interlace -interpolate \ | |
-label -limit -list -log -loop -map -mattecolor \ | |
-monitor -monochrome -name -negate -page -profile \ | |
-quality -quantize -quiet -raise -regard-warnings \ | |
-remote -repage -resample -resize \ | |
-respect-parenthesis -roll -rotate -sample \ | |
-sampling-factor -scenes -seed -segment -set \ | |
-shared-memory -sharpen -size -strip -texture -title \ | |
-transparent-color -treedepth -trim -update \ | |
-usePixmap -verbose -version -virtual-pixel -visual \ | |
-window -window-group -write' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+compress +contrast +debug +dither \ | |
+endian +gamma +label +map +matte +negate +page \ | |
+raise +write' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_dropdb () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-h | --host) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-U | --username) | |
_pg_users; | |
return 0 | |
;; | |
--help | --version) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '--host --port --username --password \ | |
--interactive --echo --quiet --help --version' -- "$cur" )); | |
else | |
_pg_databases; | |
fi | |
} | |
_dvd_devices () | |
{ | |
COMPREPLY=("${COMPREPLY[@]}" $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" )) | |
} | |
_edquota () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
-f | --filesystem) | |
_filesystems; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-r --remote -m --no-mixed-pathnames \ | |
-g --group -u --user -p --prototype -F --format -f --filesystem \ | |
-t --edit-period -T --edit-times' -- "$cur" )); | |
else | |
_user_or_group; | |
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 | |
} | |
_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<TAB>" 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; | |
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[@]}") | |
} | |
_filesystems () | |
{ | |
COMPREPLY=($( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" -- "$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 | |
} | |
_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 | |
} | |
_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 | |
} | |
_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 () | |
{ | |
__git_wrap__git_main | |
} | |
_git_add () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--interactive --refresh --patch --update --dry-run | |
--ignore-errors --intent-to-add | |
"; | |
return | |
;; | |
esac; | |
__git_complete_index_file "--others --modified --directory --no-empty-directory" | |
} | |
_git_am () | |
{ | |
local dir="$(__gitdir)"; | |
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 | |
} | |
_git_apply () | |
{ | |
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 | |
} | |
_git_archive () | |
{ | |
case "$cur" in | |
--format=*) | |
__gitcomp "$(git archive --list)" "" "${cur##--format=}"; | |
return | |
;; | |
--remote=*) | |
__gitcomp_nl "$(__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_nl "$(__git_refs)" | |
;; | |
*) | |
;; | |
esac | |
} | |
_git_branch () | |
{ | |
local i c=1 only_local_ref="n" has_r="n"; | |
while [ $c -lt $cword ]; do | |
i="${words[c]}"; | |
case "$i" in | |
-d | -m) | |
only_local_ref="y" | |
;; | |
-r) | |
has_r="y" | |
;; | |
esac; | |
((c++)); | |
done; | |
case "$cur" in | |
--set-upstream-to=*) | |
__gitcomp "$(__git_refs)" "" "${cur##--set-upstream-to=}" | |
;; | |
--*) | |
__gitcomp " | |
--color --no-color --verbose --abbrev= --no-abbrev | |
--track --no-track --contains --merged --no-merged | |
--set-upstream-to= --edit-description --list | |
--unset-upstream | |
" | |
;; | |
*) | |
if [ $only_local_ref = "y" -a $has_r = "n" ]; then | |
__gitcomp_nl "$(__git_heads)"; | |
else | |
__gitcomp_nl "$(__git_refs)"; | |
fi | |
;; | |
esac | |
} | |
_git_bug () | |
{ | |
__git_extras_workflow "bug" | |
} | |
_git_bundle () | |
{ | |
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_changelog () | |
{ | |
__gitcomp "-l -t --list --tag" | |
} | |
_git_checkout () | |
{ | |
__git_has_doubledash && return; | |
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_nl "$(__git_refs '' $track)" | |
;; | |
esac | |
} | |
_git_cherry () | |
{ | |
__gitcomp "$(__git_refs)" | |
} | |
_git_cherry_pick () | |
{ | |
local dir="$(__gitdir)"; | |
if [ -f "$dir"/CHERRY_PICK_HEAD ]; then | |
__gitcomp "--continue --quit --abort"; | |
return; | |
fi; | |
case "$cur" in | |
--*) | |
__gitcomp "--edit --no-commit --signoff --strategy= --mainline" | |
;; | |
*) | |
__gitcomp_nl "$(__git_refs)" | |
;; | |
esac | |
} | |
_git_clean () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--dry-run --quiet"; | |
return | |
;; | |
esac; | |
__git_complete_index_file "--others --directory" | |
} | |
_git_clone () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--local | |
--no-hardlinks | |
--shared | |
--reference | |
--quiet | |
--no-checkout | |
--bare | |
--mirror | |
--origin | |
--upload-pack | |
--template= | |
--depth | |
--single-branch | |
--branch | |
"; | |
return | |
;; | |
esac | |
} | |
_git_commit () | |
{ | |
case "$prev" in | |
-c | -C) | |
__gitcomp_nl "$(__git_refs)" "" "${cur}"; | |
return | |
;; | |
esac; | |
case "$cur" in | |
--cleanup=*) | |
__gitcomp "default strip verbatim whitespace | |
" "" "${cur##--cleanup=}"; | |
return | |
;; | |
--reuse-message=* | --reedit-message=* | --fixup=* | --squash=*) | |
__gitcomp_nl "$(__git_refs)" "" "${cur#*=}"; | |
return | |
;; | |
--untracked-files=*) | |
__gitcomp "all no normal" "" "${cur##--untracked-files=}"; | |
return | |
;; | |
--*) | |
__gitcomp " | |
--all --author= --signoff --verify --no-verify | |
--edit --no-edit | |
--amend --include --only --interactive | |
--dry-run --reuse-message= --reedit-message= | |
--reset-author --file= --message= --template= | |
--cleanup= --untracked-files --untracked-files= | |
--verbose --quiet --fixup= --squash= | |
"; | |
return | |
;; | |
esac; | |
if git rev-parse --verify --quiet HEAD > /dev/null; then | |
__git_complete_index_file "--committable"; | |
else | |
__git_complete_index_file "--cached"; | |
fi | |
} | |
_git_config () | |
{ | |
case "$prev" in | |
branch.*.remote | branch.*.pushremote) | |
__gitcomp_nl "$(__git_remotes)"; | |
return | |
;; | |
branch.*.merge) | |
__gitcomp_nl "$(__git_refs)"; | |
return | |
;; | |
branch.*.rebase) | |
__gitcomp "false true"; | |
return | |
;; | |
remote.pushdefault) | |
__gitcomp_nl "$(__git_remotes)"; | |
return | |
;; | |
remote.*.fetch) | |
local remote="${prev#remote.}"; | |
remote="${remote%.fetch}"; | |
if [ -z "$cur" ]; then | |
__gitcomp_nl "refs/heads/" "" "" ""; | |
return; | |
fi; | |
__gitcomp_nl "$(__git_refs_remotes "$remote")"; | |
return | |
;; | |
remote.*.push) | |
local remote="${prev#remote.}"; | |
remote="${remote%.push}"; | |
__gitcomp_nl "$(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 | |
;; | |
diff.submodule) | |
__gitcomp "log short"; | |
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_nl "$(__git_config_get_set_variables)"; | |
return | |
;; | |
*.*) | |
return | |
;; | |
esac; | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--system --global --local --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 pushremote merge mergeoptions rebase" "$pfx" "$cur_"; | |
return | |
;; | |
branch.*) | |
local pfx="${cur%.*}." cur_="${cur#*.}"; | |
__gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."; | |
__gitcomp_nl_append 'autosetupmerge | |
autosetuprebase | |
' "$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_nl "$__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_nl "$(__git_remotes)" "$pfx" "$cur_" "."; | |
__gitcomp_nl_append "pushdefault" "$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.abbrev | |
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.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.statGraphWidth | |
diff.submodule | |
diff.suppressBlankEmpty | |
diff.tool | |
diff.wordRegex | |
diff.algorithm | |
difftool. | |
difftool.prompt | |
fetch.recurseSubmodules | |
fetch.unpackLimit | |
format.attach | |
format.cc | |
format.coverLetter | |
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 | |
remote.pushdefault | |
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_contrib () | |
{ | |
__gitcomp "$(git shortlog -s | cut -f2)" | |
} | |
_git_count () | |
{ | |
__gitcomp "--all" | |
} | |
_git_delete_branch () | |
{ | |
__gitcomp "$(__git_heads)" | |
} | |
_git_delete_submodule () | |
{ | |
__gitcomp "$(git submodule status | awk '{print $2}')" | |
} | |
_git_delete_tag () | |
{ | |
__gitcomp "$(__git_tags)" | |
} | |
_git_describe () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--all --tags --contains --abbrev= --candidates= | |
--exact-match --debug --long --match --always | |
"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_diff () | |
{ | |
__git_has_doubledash && return; | |
case "$cur" in | |
--diff-algorithm=*) | |
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; | |
return | |
;; | |
--*) | |
__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; | |
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_revlist_file | |
} | |
_git_extras () | |
{ | |
__gitcomp "--version update" | |
} | |
_git_feature () | |
{ | |
__git_extras_workflow "feature" | |
} | |
_git_fetch () | |
{ | |
case "$cur" in | |
--recurse-submodules=*) | |
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; | |
return | |
;; | |
--*) | |
__gitcomp "$__git_fetch_options"; | |
return | |
;; | |
esac; | |
__git_complete_remote_or_refspec | |
} | |
_git_format_patch () | |
{ | |
case "$cur" in | |
--thread=*) | |
__gitcomp " | |
deep shallow | |
" "" "${cur##--thread=}"; | |
return | |
;; | |
--*) | |
__gitcomp "$__git_format_patch_options"; | |
return | |
;; | |
esac; | |
__git_complete_revlist | |
} | |
_git_fsck () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--tags --root --unreachable --cache --no-reflogs --full | |
--strict --verbose --lost-found | |
"; | |
return | |
;; | |
esac | |
} | |
_git_gc () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--prune --aggressive"; | |
return | |
;; | |
esac | |
} | |
_git_gitk () | |
{ | |
_gitk | |
} | |
_git_graft () | |
{ | |
__gitcomp "$(__git_heads)" | |
} | |
_git_grep () | |
{ | |
__git_has_doubledash && return; | |
case "$cur" in | |
--*) | |
__gitcomp " | |
--cached | |
--text --ignore-case --word-regexp --invert-match | |
--full-name --line-number | |
--extended-regexp --basic-regexp --fixed-strings | |
--perl-regexp | |
--files-with-matches --name-only | |
--files-without-match | |
--max-depth | |
--count | |
--and --or --not --all-match | |
"; | |
return | |
;; | |
esac; | |
case "$cword,$prev" in | |
2,* | *,-*) | |
if test -r tags; then | |
__gitcomp_nl "$(__git_match_ctag "$cur" tags)"; | |
return; | |
fi | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_help () | |
{ | |
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 | |
namespaces repository-layout tutorial tutorial-2 | |
workflows | |
" | |
} | |
_git_ignore () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--global --local"; | |
return | |
;; | |
-*) | |
__gitcomp "--global --local -g -l"; | |
return | |
;; | |
esac | |
} | |
_git_init () | |
{ | |
case "$cur" in | |
--shared=*) | |
__gitcomp " | |
false true umask group all world everybody | |
" "" "${cur##--shared=}"; | |
return | |
;; | |
--*) | |
__gitcomp "--quiet --bare --template= --shared --shared="; | |
return | |
;; | |
esac | |
} | |
_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; | |
case "$cur" in | |
--pretty=* | --format=*) | |
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) | |
" "" "${cur#*=}"; | |
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 () | |
{ | |
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; | |
__git_complete_index_file "--cached" | |
} | |
_git_ls_remote () | |
{ | |
__gitcomp_nl "$(__git_remotes)" | |
} | |
_git_ls_tree () | |
{ | |
__git_complete_file | |
} | |
_git_merge () | |
{ | |
__git_complete_strategy && return; | |
case "$cur" in | |
--*) | |
__gitcomp "$__git_merge_options"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_merge_base () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--octopus --independent --is-ancestor --fork-point"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_mergetool () | |
{ | |
case "$cur" in | |
--tool=*) | |
__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"; | |
return | |
;; | |
--*) | |
__gitcomp "--tool="; | |
return | |
;; | |
esac | |
} | |
_git_mv () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--dry-run"; | |
return | |
;; | |
esac; | |
if [ $(__git_count_arguments "mv") -gt 0 ]; then | |
__git_complete_index_file "--cached --others --directory"; | |
else | |
__git_complete_index_file "--cached"; | |
fi | |
} | |
_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")"; | |
case "$subcommand,$cur" in | |
,--*) | |
__gitcomp '--ref' | |
;; | |
,*) | |
case "$prev" in | |
--ref) | |
__gitcomp_nl "$(__git_refs)" | |
;; | |
*) | |
__gitcomp "$subcommands --ref" | |
;; | |
esac | |
;; | |
add,--reuse-message=* | append,--reuse-message=* | add,--reedit-message=* | append,--reedit-message=*) | |
__gitcomp_nl "$(__git_refs)" "" "${cur#*=}" | |
;; | |
add,--* | append,--*) | |
__gitcomp '--file= --message= --reedit-message= | |
--reuse-message=' | |
;; | |
copy,--*) | |
__gitcomp '--stdin' | |
;; | |
prune,--*) | |
__gitcomp '--dry-run --verbose' | |
;; | |
prune,*) | |
;; | |
*) | |
case "$prev" in | |
-m | -F) | |
;; | |
*) | |
__gitcomp_nl "$(__git_refs)" | |
;; | |
esac | |
;; | |
esac | |
} | |
_git_pull () | |
{ | |
__git_complete_strategy && return; | |
case "$cur" in | |
--recurse-submodules=*) | |
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"; | |
return | |
;; | |
--*) | |
__gitcomp " | |
--rebase --no-rebase | |
$__git_merge_options | |
$__git_fetch_options | |
"; | |
return | |
;; | |
esac; | |
__git_complete_remote_or_refspec | |
} | |
_git_push () | |
{ | |
case "$prev" in | |
--repo) | |
__gitcomp_nl "$(__git_remotes)"; | |
return | |
;; | |
esac; | |
case "$cur" in | |
--repo=*) | |
__gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}"; | |
return | |
;; | |
--recurse-submodules=*) | |
__gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}"; | |
return | |
;; | |
--*) | |
__gitcomp " | |
--all --mirror --tags --dry-run --force --verbose | |
--receive-pack= --repo= --set-upstream | |
--recurse-submodules= | |
"; | |
return | |
;; | |
esac; | |
__git_complete_remote_or_refspec | |
} | |
_git_rebase () | |
{ | |
local dir="$(__gitdir)"; | |
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 --fork-point --no-fork-point | |
"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_refactor () | |
{ | |
__git_extras_workflow "refactor" | |
} | |
_git_reflog () | |
{ | |
local subcommands="show delete expire"; | |
local subcommand="$(__git_find_on_cmdline "$subcommands")"; | |
if [ -z "$subcommand" ]; then | |
__gitcomp "$subcommands"; | |
else | |
__gitcomp_nl "$(__git_refs)"; | |
fi | |
} | |
_git_remote () | |
{ | |
local subcommands="add rename remove set-head set-branches set-url show prune update"; | |
local subcommand="$(__git_find_on_cmdline "$subcommands")"; | |
if [ -z "$subcommand" ]; then | |
__gitcomp "$subcommands"; | |
return; | |
fi; | |
case "$subcommand" in | |
rename | remove | set-url | show | prune) | |
__gitcomp_nl "$(__git_remotes)" | |
;; | |
set-head | set-branches) | |
__git_complete_remote_or_refspec | |
;; | |
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" | |
;; | |
*) | |
;; | |
esac | |
} | |
_git_replace () | |
{ | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_reset () | |
{ | |
__git_has_doubledash && return; | |
case "$cur" in | |
--*) | |
__gitcomp "--merge --mixed --hard --soft --patch"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_revert () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--edit --mainline --no-edit --no-commit --signoff"; | |
return | |
;; | |
esac; | |
__gitcomp_nl "$(__git_refs)" | |
} | |
_git_rm () | |
{ | |
case "$cur" in | |
--*) | |
__gitcomp "--cached --dry-run --ignore-unmatch --quiet"; | |
return | |
;; | |
esac; | |
__git_complete_index_file "--cached" | |
} | |
_git_send_email () | |
{ | |
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 | |
;; | |
--thread=*) | |
__gitcomp " | |
deep shallow | |
" "" "${cur##--thread=}"; | |
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 | |
$__git_format_patch_options"; | |
return | |
;; | |
esac; | |
__git_complete_revlist | |
} | |
_git_shortlog () | |
{ | |
__git_has_doubledash && return; | |
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; | |
case "$cur" in | |
--pretty=* | --format=*) | |
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) | |
" "" "${cur#*=}"; | |
return | |
;; | |
--diff-algorithm=*) | |
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"; | |
return | |
;; | |
--*) | |
__gitcomp "--pretty= --format= --abbrev-commit --oneline | |
$__git_diff_common_options | |
"; | |
return | |
;; | |
esac; | |
__git_complete_revlist_file | |
} | |
_git_show_branch () | |
{ | |
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_squash () | |
{ | |
__gitcomp "$(__git_heads)" | |
} | |
_git_stage () | |
{ | |
_git_add | |
} | |
_git_stash () | |
{ | |
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"; | |
fi | |
;; | |
esac; | |
else | |
case "$subcommand,$cur" in | |
save,--*) | |
__gitcomp "$save_opts" | |
;; | |
apply,--* | pop,--*) | |
__gitcomp "--index --quiet" | |
;; | |
show,--* | drop,--* | branch,--*) | |
;; | |
show,* | apply,* | drop,* | pop,* | branch,*) | |
__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list | sed -n -e 's/:.*//p')" | |
;; | |
*) | |
;; | |
esac; | |
fi | |
} | |
_git_submodule () | |
{ | |
__git_has_doubledash && return; | |
local subcommands="add status init deinit update summary foreach sync"; | |
if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then | |
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= --include-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= | |
"; | |
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 --interactive $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" | |
;; | |
*) | |
;; | |
esac; | |
fi | |
} | |
_git_tag () | |
{ | |
local i c=1 f=0; | |
while [ $c -lt $cword ]; do | |
i="${words[c]}"; | |
case "$i" in | |
-d | -v) | |
__gitcomp_nl "$(__git_tags)"; | |
return | |
;; | |
-f) | |
f=1 | |
;; | |
esac; | |
((c++)); | |
done; | |
case "$prev" in | |
-m | -F) | |
;; | |
-* | tag) | |
if [ $f = 1 ]; then | |
__gitcomp_nl "$(__git_tags)"; | |
fi | |
;; | |
*) | |
__gitcomp_nl "$(__git_refs)" | |
;; | |
esac | |
} | |
_git_undo () | |
{ | |
__gitcomp "--hard --soft -h -s" | |
} | |
_git_whatchanged () | |
{ | |
_git_log | |
} | |
_gitk () | |
{ | |
__git_wrap__gitk_main | |
} | |
_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 | |
} | |
_gpg2 () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
--homedir) | |
_filedir -d; | |
return 0 | |
;; | |
-s | --sign | --clearsign | --options | --decrypt) | |
_filedir; | |
return 0 | |
;; | |
--export | --sign-key | --lsign-key | --nrsign-key | --nrlsign-key | --edit-key) | |
COMPREPLY=($( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" )); | |
return 0 | |
;; | |
-r | --recipient) | |
COMPREPLY=($( compgen -W "$( gpg2 --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 '$(gpg2 --dump-options)' -- "$cur" )); | |
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" )) | |
} | |
_heimdal_encodings () | |
{ | |
COMPREPLY=($( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \ | |
des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \ | |
aes256-cts-hmac-sha1-96' -- "$cur" )) | |
} | |
_heimdal_principals () | |
{ | |
COMPREPLY=($( compgen -W "$( kadmin -l dump 2>/dev/null | awk '{print $1}' )" -- "$cur" )) | |
} | |
_heimdal_realms () | |
{ | |
COMPREPLY=($( compgen -W "( kadmin -l dump 2>/dev/null | awk '{print $1}' | awk -F@ '{print $2}' )" -- "$cur" )) | |
} | |
_hg () | |
{ | |
local cur prev cmd cmd_index opts i aliashg; | |
local global_args='--cwd|-R|--repository'; | |
local hg="$1"; | |
local canonical=0; | |
aliashg=$(alias $hg 2>/dev/null); | |
if [[ -n "$aliashg" ]]; then | |
aliashg=${aliashg#"alias $hg='"}; | |
aliashg=${aliashg%"'"}; | |
hg=$aliashg; | |
fi; | |
COMPREPLY=(); | |
cur="$2"; | |
prev="$3"; | |
for ((i=1; $i<=$COMP_CWORD; i++)) | |
do | |
if [[ ${COMP_WORDS[i]} != -* ]]; then | |
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then | |
cmd="${COMP_WORDS[i]}"; | |
cmd_index=$i; | |
break; | |
fi; | |
fi; | |
done; | |
if [[ "$cur" == -* ]]; then | |
if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then | |
_hg_fix_wordlist; | |
return; | |
fi; | |
opts=$(_hg_cmd debugcomplete --options "$cmd"); | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")); | |
_hg_fix_wordlist; | |
return; | |
fi; | |
case "$prev" in | |
-R | --repository) | |
_hg_paths; | |
_hg_repos; | |
_hg_fix_wordlist; | |
return | |
;; | |
--cwd) | |
_hg_fix_wordlist; | |
return | |
;; | |
esac; | |
if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then | |
_hg_commands; | |
_hg_fix_wordlist; | |
return; | |
fi; | |
local help; | |
if _hg_command_specific; then | |
_hg_fix_wordlist; | |
return; | |
fi; | |
help=$(_hg_cmd help "$cmd"); | |
if [ $? -ne 0 ]; then | |
return; | |
fi; | |
cmd=${help#hg }; | |
cmd=${cmd%%[' | |
']*}; | |
canonical=1; | |
_hg_command_specific; | |
_hg_fix_wordlist | |
} | |
_hg_bookmarks () | |
{ | |
local bookmarks="$(_hg_cmd bookmarks -q)"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur")) | |
} | |
_hg_branches () | |
{ | |
local branches="$(_hg_cmd branches -q)"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) | |
} | |
_hg_cmd () | |
{ | |
HGPLAIN=1 "$hg" "$@" 2> /dev/null | |
} | |
_hg_cmd_bisect () | |
{ | |
local i subcmd; | |
for ((i=cmd_index+1; i<=COMP_CWORD; i++)) | |
do | |
if [[ ${COMP_WORDS[i]} != -* ]]; then | |
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then | |
subcmd="${COMP_WORDS[i]}"; | |
break; | |
fi; | |
fi; | |
done; | |
if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W 'bad good help init next reset' -- "$cur")); | |
return; | |
fi; | |
case "$subcmd" in | |
good | bad) | |
_hg_labels | |
;; | |
esac; | |
return | |
} | |
_hg_cmd_bookmarks () | |
{ | |
_hg_bookmarks; | |
return | |
} | |
_hg_cmd_email () | |
{ | |
case "$prev" in | |
-c | --cc | -t | --to | -f | --from | --bcc) | |
if [ "$(type -t _hg_emails)" = function ]; then | |
local arg=to; | |
if [[ "$prev" == @(-f|--from) ]]; then | |
arg=from; | |
fi; | |
local addresses=$(_hg_emails $arg); | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$addresses' -- "$cur")); | |
fi; | |
return | |
;; | |
-m | --mbox) | |
return | |
;; | |
-s | --subject) | |
return | |
;; | |
esac; | |
_hg_labels; | |
return | |
} | |
_hg_cmd_qclone () | |
{ | |
local count=$(_hg_count_non_option); | |
if [ $count = 1 ]; then | |
_hg_paths; | |
fi; | |
_hg_repos | |
} | |
_hg_cmd_qcommit () | |
{ | |
local root=$(_hg_cmd root); | |
local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar); | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) | |
} | |
_hg_cmd_qdelete () | |
{ | |
local qcmd=qunapplied; | |
if [[ "$prev" = @(-r|--rev) ]]; then | |
qcmd=qapplied; | |
fi; | |
_hg_ext_mq_patchlist $qcmd | |
} | |
_hg_cmd_qfinish () | |
{ | |
if [[ "$prev" = @(-a|--applied) ]]; then | |
return; | |
fi; | |
_hg_ext_mq_patchlist qapplied | |
} | |
_hg_cmd_qfold () | |
{ | |
_hg_ext_mq_patchlist qunapplied | |
} | |
_hg_cmd_qgoto () | |
{ | |
if [[ "$prev" = @(-n|--name) ]]; then | |
_hg_ext_mq_queues; | |
return; | |
fi; | |
_hg_ext_mq_patchlist qseries | |
} | |
_hg_cmd_qguard () | |
{ | |
local prefix=''; | |
if [[ "$cur" == +* ]]; then | |
prefix=+; | |
else | |
if [[ "$cur" == -* ]]; then | |
prefix=-; | |
fi; | |
fi; | |
local ncur=${cur#[-+]}; | |
if ! [ "$prefix" ]; then | |
_hg_ext_mq_patchlist qseries; | |
return; | |
fi; | |
local guards=$(_hg_ext_mq_guards); | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur")) | |
} | |
_hg_cmd_qheader () | |
{ | |
_hg_ext_mq_patchlist qseries | |
} | |
_hg_cmd_qpop () | |
{ | |
if [[ "$prev" = @(-n|--name) ]]; then | |
_hg_ext_mq_queues; | |
return; | |
fi; | |
_hg_ext_mq_patchlist qapplied | |
} | |
_hg_cmd_qpush () | |
{ | |
if [[ "$prev" = @(-n|--name) ]]; then | |
_hg_ext_mq_queues; | |
return; | |
fi; | |
_hg_ext_mq_patchlist qunapplied | |
} | |
_hg_cmd_qqueue () | |
{ | |
local q; | |
local queues; | |
local opts="--list --create --rename --delete --purge"; | |
queues=$( _hg_cmd qqueue --quiet ); | |
COMPREPLY=($( compgen -W "${opts} ${queues}" "${cur}" )) | |
} | |
_hg_cmd_qrename () | |
{ | |
_hg_ext_mq_patchlist qseries | |
} | |
_hg_cmd_qsave () | |
{ | |
if [[ "$prev" = @(-n|--name) ]]; then | |
_hg_ext_mq_queues; | |
return; | |
fi | |
} | |
_hg_cmd_qselect () | |
{ | |
local guards=$(_hg_ext_mq_guards); | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur")) | |
} | |
_hg_cmd_rebase () | |
{ | |
if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then | |
_hg_labels; | |
return; | |
fi | |
} | |
_hg_cmd_shelve () | |
{ | |
if [[ "$prev" = @(-d|--delete) ]]; then | |
_hg_shelves; | |
else | |
_hg_status "mard"; | |
fi | |
} | |
_hg_cmd_sign () | |
{ | |
_hg_labels | |
} | |
_hg_cmd_strip () | |
{ | |
if [[ "$prev" = @(-B|--bookmark) ]]; then | |
_hg_bookmarks; | |
return; | |
fi; | |
_hg_labels | |
} | |
_hg_cmd_transplant () | |
{ | |
case "$prev" in | |
-s | --source) | |
_hg_paths; | |
_hg_repos; | |
return | |
;; | |
--filter) | |
return | |
;; | |
esac; | |
_hg_labels; | |
return | |
} | |
_hg_cmd_unshelve () | |
{ | |
_hg_shelves | |
} | |
_hg_command_specific () | |
{ | |
if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then | |
"_hg_cmd_$cmd"; | |
return 0; | |
fi; | |
if [ "$cmd" != status ]; then | |
case "$prev" in | |
-r | --rev) | |
if [[ $canonical = 1 || status != "$cmd"* ]]; then | |
_hg_labels; | |
return 0; | |
fi; | |
return 1 | |
;; | |
-B | --bookmark) | |
if [[ $canonical = 1 || status != "$cmd"* ]]; then | |
_hg_bookmarks; | |
return 0; | |
fi; | |
return 1 | |
;; | |
-b | --branch) | |
if [[ $canonical = 1 || status != "$cmd"* ]]; then | |
_hg_branches; | |
return 0; | |
fi; | |
return 1 | |
;; | |
esac; | |
fi; | |
local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}'); | |
[ -n "$aliascmd" ] && cmd=$aliascmd; | |
case "$cmd" in | |
help) | |
_hg_commands | |
;; | |
export) | |
if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then | |
return 0; | |
fi; | |
_hg_labels | |
;; | |
manifest | update | up | checkout | co) | |
_hg_labels | |
;; | |
pull | push | outgoing | incoming) | |
_hg_paths; | |
_hg_repos | |
;; | |
paths) | |
_hg_paths | |
;; | |
add) | |
_hg_status "u" | |
;; | |
merge) | |
_hg_labels | |
;; | |
commit | ci | record) | |
_hg_status "mar" | |
;; | |
remove | rm) | |
_hg_debugpathcomplete -n | |
;; | |
forget) | |
_hg_debugpathcomplete -fa | |
;; | |
diff) | |
_hg_status "mar" | |
;; | |
revert) | |
_hg_debugpathcomplete | |
;; | |
clone) | |
local count=$(_hg_count_non_option); | |
if [ $count = 1 ]; then | |
_hg_paths; | |
fi; | |
_hg_repos | |
;; | |
debugindex | debugindexdot) | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur")) | |
;; | |
debugdata) | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur")) | |
;; | |
*) | |
return 1 | |
;; | |
esac; | |
return 0 | |
} | |
_hg_commands () | |
{ | |
local commands; | |
commands="$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete "$cur")" || commands=""; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) | |
} | |
_hg_count_non_option () | |
{ | |
local i count=0; | |
local filters="$1"; | |
for ((i=1; $i<=$COMP_CWORD; i++)) | |
do | |
if [[ "${COMP_WORDS[i]}" != -* ]]; then | |
if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then | |
continue; | |
fi; | |
count=$(($count + 1)); | |
fi; | |
done; | |
echo $(($count - 1)) | |
} | |
_hg_debugpathcomplete () | |
{ | |
local files="$(_hg_cmd debugpathcomplete $1 "$cur")"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) | |
} | |
_hg_ext_mq_guards () | |
{ | |
_hg_cmd qselect --series | sed -e 's/^.//' | |
} | |
_hg_ext_mq_patchlist () | |
{ | |
local patches; | |
patches=$(_hg_cmd $1); | |
if [ $? -eq 0 ] && [ "$patches" ]; then | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")); | |
return 0; | |
fi; | |
return 1 | |
} | |
_hg_ext_mq_queues () | |
{ | |
local root=$(_hg_cmd root); | |
local n; | |
for n in $(cd "$root"/.hg && compgen -d -- "$cur"); | |
do | |
if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then | |
COMPREPLY=(${COMPREPLY[@]:-} "$n"); | |
fi; | |
done | |
} | |
_hg_fix_wordlist () | |
{ | |
local LASTCHAR=' '; | |
if [ ${#COMPREPLY[@]} = 1 ]; then | |
[ -d "$COMPREPLY" ] && LASTCHAR=/; | |
COMPREPLY=$(printf %q%s "$COMPREPLY" "$LASTCHAR"); | |
else | |
for ((i=0; i < ${#COMPREPLY[@]}; i++)) | |
do | |
[ -d "${COMPREPLY[$i]}" ] && COMPREPLY[$i]=${COMPREPLY[$i]}/; | |
done; | |
fi | |
} | |
_hg_labels () | |
{ | |
local labels="$(_hg_cmd debuglabelcomplete "$cur")"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur")) | |
} | |
_hg_opt_qguard () | |
{ | |
local i; | |
for ((i=cmd_index+1; i<=COMP_CWORD; i++)) | |
do | |
if [[ ${COMP_WORDS[i]} != -* ]]; then | |
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then | |
_hg_cmd_qguard; | |
return 0; | |
fi; | |
else | |
if [ "${COMP_WORDS[i]}" = -- ]; then | |
_hg_cmd_qguard; | |
return 0; | |
fi; | |
fi; | |
done; | |
return 1 | |
} | |
_hg_paths () | |
{ | |
local paths="$(_hg_cmd paths -q)"; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur")) | |
} | |
_hg_repos () | |
{ | |
local i; | |
for i in $(compgen -d -- "$cur"); | |
do | |
test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i"); | |
done | |
} | |
_hg_shelves () | |
{ | |
local shelves="$(_hg_cmd shelve -ql)"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) | |
} | |
_hg_status () | |
{ | |
local files="$(_hg_cmd status -n$1 "glob:$cur**")"; | |
local IFS=' | |
'; | |
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) | |
} | |
_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 | |
} | |
_identify () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-alpha -antialias -authenticate \ | |
-channel -colorspace -crop -debug -define -density \ | |
-depth -extract -format -fuzz -gamma -help -interlace \ | |
-interpolate -limit -list -log -monitor -ping -quiet \ | |
-regard-warnings -respect-parenthesis \ | |
-sampling-factor -seed -set -size -strip -units \ | |
-verbose -version -virtual-pixel' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_import () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-adjoin -annotate -border -channel \ | |
-colors -colorspace -comment -compress -crop -debug \ | |
-define -delay -density -depth -descend -display \ | |
-dispose -dither -encipher -encoding -endian -filter \ | |
-format -frame -geometry -gravity -help -identify \ | |
-interlace -interpolate -label -limit -list -log \ | |
-monitor -monochrome -negate -page -pause -pointsize \ | |
-quality -quantize -quiet -regard-warnings -repage \ | |
-resize -respect-parenthesis -rotate -sampling-factor \ | |
-scene -screen -seed -set -silent -snaps -strip \ | |
-thumbnail -transparent -transparent-color -treedepth \ | |
-trim -type -verbose -version -virtual-pixel \ | |
-window' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_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 | |
} | |
_installed_modules () | |
{ | |
COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}' )" -- "$1" )) | |
} | |
_ipmitool () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h | -V | -p | -U | -e | -k | -y | -P | -m | -b | -t | -B | -T | -l) | |
return 0 | |
;; | |
-d) | |
COMPREPLY=($( compgen -W "$( command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* 2>/dev/null | sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" -- "$cur" )); | |
return 0 | |
;; | |
-I) | |
COMPREPLY=($( compgen -W "$( $1 -h 2>&1 | sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' -ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" -- "$cur" )); | |
return 0 | |
;; | |
-H) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-f | -S | -O) | |
_filedir; | |
return 0 | |
;; | |
-C) | |
COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' -- "$cur" )); | |
return 0 | |
;; | |
-L) | |
COMPREPLY=($( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' -- "$cur" )); | |
return 0 | |
;; | |
-A) | |
COMPREPLY=($( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" )); | |
return 0 | |
;; | |
-o) | |
COMPREPLY=($( compgen -W "$( $1 -o list 2>&1 | awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" )); | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \ | |
-e -C -k -y -L -A -P -E -K -m -b -t -B -T -l -o -O' -- "$cur" )); | |
return 0; | |
fi; | |
local cmds=(raw i2c spd lan chassis power event mc sdr sensor fru gendev sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum firewall shell exec set hpm ekanalyzer); | |
local i c cmd subcmd; | |
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++ )) | |
do | |
[[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break; | |
for c in ${cmds[@]}; | |
do | |
[ ${COMP_WORDS[i]} = $c ] && cmd=$c && break; | |
done; | |
done; | |
if [ -z "$cmd" ]; then | |
COMPREPLY=($( compgen -W '${cmds[@]}' -- "$cur" )); | |
return 0; | |
fi; | |
case $cmd in | |
shell) | |
;; | |
exec) | |
_filedir | |
;; | |
chassis | power | kontronoem | fwum) | |
_ipmitool_singleline_help $1 $cmd | |
;; | |
lan) | |
case $subcmd in | |
print | set) | |
;; | |
alert) | |
[ "$prev" = alert ] && COMPREPLY=($( compgen -W 'print set' -- "$cur" )) | |
;; | |
stats) | |
[ "$prev" = stats ] && COMPREPLY=($( compgen -W 'print set' -- "$cur" )) | |
;; | |
*) | |
COMPREPLY=($( compgen -W 'print set alert stats' -- "$cur" )) | |
;; | |
esac | |
;; | |
sdr) | |
case $subcmd in | |
get | info | type | list | entity) | |
;; | |
elist) | |
COMPREPLY=($( compgen -W 'all full compact event mclog fru | |
generic' -- "$cur" )) | |
;; | |
dump) | |
_filedir | |
;; | |
fill) | |
case $prev in | |
fill) | |
COMPREPLY=($( compgen -W 'sensors file' -- "$cur" )) | |
;; | |
file) | |
_filedir | |
;; | |
esac | |
;; | |
*) | |
COMPREPLY=($( compgen -W 'get info type list elist entity | |
dump fill' -- "$cur" )) | |
;; | |
esac | |
;; | |
sensor) | |
case $subcmd in | |
list | get | thresh) | |
;; | |
*) | |
COMPREPLY=($( compgen -W 'list get thresh' -- "$cur" )) | |
;; | |
esac | |
;; | |
sel) | |
case $subcmd in | |
info | clear | list | elist | delete) | |
;; | |
add | save | writeraw | readraw) | |
_filedir | |
;; | |
time) | |
[ "$prev" = time ] && COMPREPLY=($( compgen -W 'get set' -- "$cur" )) | |
;; | |
*) | |
COMPREPLY=($( compgen -W 'info clear list elist delete add | |
get save writeraw readraw time' -- "$cur" )) | |
;; | |
esac | |
;; | |
user) | |
case $subcmd in | |
summary | list | disable | enable | priv | test) | |
;; | |
set) | |
[ "$prev" = set ] && COMPREPLY=($( compgen -W 'name password' -- "$cur" )) | |
;; | |
*) | |
COMPREPLY=($( compgen -W 'summary list set disable enable | |
priv test' -- "$cur" )) | |
;; | |
esac | |
;; | |
set) | |
[ "$prev" = set ] && COMPREPLY=($( compgen -W 'hostname username password privlvl | |
authtype localaddr targetaddr port csv verbose' -- "$cur" )) | |
;; | |
esac | |
} | |
_ipmitool_singleline_help () | |
{ | |
COMPREPLY=($( compgen -W "$( $1 $2 2>&1 | sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" )) | |
} | |
_isql () | |
{ | |
local cur; | |
_get_comp_words_by_ref cur; | |
[ -f "$ODBCINI" ] && COMPREPLY=($( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] )) | |
} | |
_jar () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
if [ $COMP_CWORD = 1 ]; then | |
COMPREPLY=($( compgen -W 'c t x u' -- "$cur" )); | |
return 0; | |
fi; | |
case ${COMP_WORDS[1]} in | |
*c*f) | |
_filedir | |
;; | |
*f) | |
_filedir '@([ejw]ar|zip|apk)' | |
;; | |
*) | |
_filedir | |
;; | |
esac | |
} | |
_jarsigner () | |
{ | |
COMPREPLY=(); | |
local cur prev; | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-keystore) | |
COMPREPLY=($( compgen -W 'NONE' -- "$cur" )); | |
_filedir '@(jks|ks|p12|pfx)'; | |
return 0 | |
;; | |
-storepass | -keypass | -sigfile | -digestalg | -sigalg | -tsacert | -altsigner | -altsignerpath | -providerName | -providerClass | -providerArg) | |
return 0 | |
;; | |
-storetype) | |
COMPREPLY=($( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" )); | |
return 0 | |
;; | |
-signedjar) | |
_filedir jar; | |
return 0 | |
;; | |
-tsa) | |
_filedir; | |
return 0 | |
;; | |
esac; | |
local i jar=false; | |
for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ )) | |
do | |
if [[ "${COMP_WORDS[i]}" == *.jar && "${COMP_WORDS[i-1]}" != -signedjar ]]; then | |
jar=true; | |
break; | |
fi; | |
done; | |
if ! $jar; then | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-keystore -storepass -storetype \ | |
-keypass -sigfile -signedjar -digestalg -sigalg -verify \ | |
-verbose -certs -tsa -tsacert -altsigner -altsignerpath \ | |
-protected -providerName -providerClass -providerArg' -- "$cur" )); | |
fi; | |
_filedir jar; | |
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)' | |
} | |
_javac () | |
{ | |
COMPREPLY=(); | |
local cur prev; | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-d) | |
_filedir -d; | |
return 0 | |
;; | |
-classpath | -bootclasspath | -sourcepath | -extdirs) | |
_java_path; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-g -g:none -g:lines -g:vars \ | |
-g:source -O -nowarn -verbose -deprecation -classpath \ | |
-sourcepath -bootclasspath -extdirs -d -encoding -source \ | |
-target -help' -- "$cur" )); | |
else | |
_filedir java; | |
fi | |
} | |
_javadoc () | |
{ | |
COMPREPLY=(); | |
local cur prev classpath; | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-overview | -helpfile) | |
_filedir '?(x)htm?(l)'; | |
return 0 | |
;; | |
-stylesheetfile) | |
_filedir css; | |
return 0 | |
;; | |
-d | -link | -linkoffline) | |
_filedir -d; | |
return 0 | |
;; | |
-classpath | -bootclasspath | -docletpath | -sourcepath | -extdirs) | |
_java_path; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-overview -public -protected \ | |
-package -private -help -doclet -docletpath \ | |
-sourcepath -classpath -exclude -subpackages \ | |
-breakiterator -bootclasspath -source -extdirs \ | |
-verbose -locale -encoding -J -d -use -version \ | |
-author -docfilessubdirs -splitindex \ | |
-windowtitle -doctitle -header -footer -bottom \ | |
-link -linkoffline -excludedocfilessubdir \ | |
-group -nocomment -nodeprecated -noqualifier \ | |
-nosince -nodeprecatedlist -notree -noindex \ | |
-nohelp -nonavbar -quiet -serialwarn -tag \ | |
-taglet -tagletpath -charset -helpfile \ | |
-linksource -stylesheetfile -docencoding' -- "$cur" )); | |
else | |
_filedir java; | |
_java_packages; | |
fi | |
} | |
_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" )) | |
} | |
_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_AVAHI:-} ]] && type avahi-browse >&/dev/null; then | |
COMPREPLY=("${COMPREPLY[@]}" $( compgen -P "$prefix$user" -S "$suffix" -W "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$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 | |
} | |
_ktutil () | |
{ | |
local cur prev command options split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-p | --principal) | |
_heimdal_principals; | |
return 0 | |
;; | |
-e | --enctype) | |
_heimdal_encodings; | |
return 0 | |
;; | |
-a | --admin-server) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-r | --realm) | |
_heimdal_realms; | |
return 0 | |
;; | |
-s | -k | --srvtab | --keytab) | |
_filedir; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
commands='add change copy get list remove rename purge srvconvert \ | |
srv2keytab srvcreate key2srvtab'; | |
for ((i=1; i < COMP_CWORD; i++ )) | |
do | |
case ${COMP_WORDS[i]} in | |
-k | --keytab) | |
i=$(($i+1)) | |
;; | |
-*) | |
;; | |
*) | |
command=${COMP_WORDS[i]}; | |
break | |
;; | |
esac; | |
done; | |
if [[ "$cur" == -* ]]; then | |
case $command in | |
add) | |
options='-p --principal -V -e --enctype -w --password -r \ | |
--random -s --no-salt -h --hex' | |
;; | |
change) | |
options='-r --realm -a --admin-server -s --server-port' | |
;; | |
get) | |
options='-p --principal -e --enctype -r --realm -a \ | |
--admin-server -s server --server-port' | |
;; | |
list) | |
options='--keys --timestamp' | |
;; | |
remove) | |
options='-p --principal -V --kvno -e --enctype' | |
;; | |
purge) | |
options='--age' | |
;; | |
srv2keytab | key2srvtab) | |
options='-s --srvtab' | |
;; | |
*) | |
options='-k --keytab -v --verbose --version -v --help' | |
;; | |
esac; | |
COMPREPLY=($( compgen -W "$options" -- "$cur" )); | |
else | |
case $command in | |
copy) | |
_filedir | |
;; | |
get) | |
_heimdal_principals | |
;; | |
rename) | |
_heimdal_principals | |
;; | |
*) | |
COMPREPLY=($( compgen -W "$commands" -- "$cur" )) | |
;; | |
esac; | |
fi | |
} | |
_ldap_protocols () | |
{ | |
COMPREPLY=($( compgen -W '2 3' -- "$cur" )) | |
} | |
_ldap_uris () | |
{ | |
COMPREPLY=($( compgen -W 'ldap:// ldaps://' -- "$cur" )) | |
} | |
_ldapaddmodify () | |
{ | |
local cur prev options; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-S | -f | -y) | |
_filedir; | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \ | |
-Q -U -R -x -X -Y -Z -ZZ -f'; | |
if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then | |
options="$options -a"; | |
fi; | |
COMPREPLY=($( compgen -W "$options" -- "$cur" )); | |
fi | |
} | |
_ldapcompare () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-y) | |
_filedir; | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-n -v -z -M -MM -d -D -W -w -y \ | |
-H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" )); | |
fi | |
} | |
_ldapdelete () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-f | -y) | |
_filedir; | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \ | |
-H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' -- "$cur" )); | |
fi | |
} | |
_ldapmodrdn () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-f | -y) | |
_filedir; | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \ | |
-y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' -- "$cur" )); | |
fi | |
} | |
_ldappasswd () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-t | -T | -y) | |
_filedir; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \ | |
-v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" )); | |
fi | |
} | |
_ldapsearch () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-T) | |
_filedir -d; | |
return 0 | |
;; | |
-f | -y) | |
_filedir; | |
return 0 | |
;; | |
-s) | |
COMPREPLY=($( compgen -W 'base one sub children' -- "$cur" )); | |
return 0 | |
;; | |
-a) | |
COMPREPLY=($( compgen -W 'never always search find' -- "$cur" )); | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \ | |
-LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \ | |
-P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" )); | |
fi | |
} | |
_ldapwhoami () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-h) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-H) | |
_ldap_uris; | |
return 0 | |
;; | |
-f | -y) | |
_filedir; | |
return 0 | |
;; | |
-P) | |
_ldap_protocols; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \ | |
-O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$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 | |
} | |
_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 | |
} | |
_lsvirtualenv_usage () | |
{ | |
echo "lsvirtualenv [-blh]"; | |
echo " -b -- brief mode"; | |
echo " -l -- long mode"; | |
echo " -h -- this help message" | |
} | |
_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 | |
} | |
_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" )) | |
} | |
_mogrify () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-adaptive-blur -adaptive-resize \ | |
-adaptive-sharpen -adjoin -affine -alpha -annotate \ | |
-antialias -attenuate -authenticate -auto-orient \ | |
-background -bias -black-point-compensation \ | |
-black-threshold -blue-primary -blur -border \ | |
-bordercolor -caption -channel -charcoal -chop -clip \ | |
-clip-mask -clip-path -clut -colorize -colors \ | |
-colorspace -comment -compose -compress -contrast \ | |
-contrast-stretch -convolve -cycle -debug -decipher \ | |
-define -delay -density -depth -despeckle -display \ | |
-dispose -distort -dither -draw -edge -emboss \ | |
-encipher -encoding -endian -enhance -equalize \ | |
-evaluate -extent -extract -family -fill -filter \ | |
-flip -floodfill -flop -font -format -frame -fuzz \ | |
-gamma -gaussian-blur -geometry -gravity \ | |
-green-primary -help -identify -implode -intent \ | |
-interlace -interpolate -label -lat -layers -level \ | |
-limit -linear-stretch -liquid-rescale -list -log \ | |
-loop -mask -mattecolor -median -modulate -monitor \ | |
-monochrome -motion-blur -negate -noise -normalize \ | |
-opaque -ordered-dither -orient -page -paint -path \ | |
-ping -pointsize -polaroid -posterize -preview -print \ | |
-profile -quality -quantize -quiet -radial-blur \ | |
-raise -random-threshold -recolor -red-primary \ | |
-regard-warnings -region -render -repage -resample \ | |
-resize -roll -rotate -sample -sampling-factor -scale \ | |
-scene -seed -segment -sepia-tone -set -shade -shadow \ | |
-sharpen -shave -shear -sigmoidal-contrast -size \ | |
-sketch -solarize -splice -spread -stretch -strip \ | |
-stroke -strokewidth -style -swirl -taint -texture \ | |
-threshold -thumbnail -tile -tile-offset -tint \ | |
-transform -transparent -transparent-color -transpose \ | |
-transverse -treedepth -trim -type -undercolor \ | |
-unique-colors -units -unsharp -verbose -version \ | |
-view -vignette -virtual-pixel -wave -weight \ | |
-white-point -white-threshold' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+compress +contrast +debug +dither \ | |
+endian +gamma +label +map +mask +matte +negate +page \ | |
+raise' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_montage () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-adjoin -affine -alpha \ | |
-authenticate -background -blue-primary -blur -border \ | |
-bordercolor -borderwidth -caption -channel -clone \ | |
-coalesce -colors -colorspace -comment -compose \ | |
-compress -crop -debug -define -density -depth \ | |
-display -dispose -dither -draw -encoding -endian \ | |
-extract -fill -filter -flatten -flip -flop -font \ | |
-format -frame -gamma -geometry -gravity \ | |
-green-primary -help -identify -interlace \ | |
-interpolate -label -limit -list -log -mattecolor \ | |
-mode -monitor -monochrome -origin -page -pointsize \ | |
-polaroid -profile -quality -quantize -quiet \ | |
-red-primary -regard-warnings -repage -resize \ | |
-respect-parenthesis -rotate -sampling-factor -scenes \ | |
-seed -set -shadow -size -strip -stroke -texture \ | |
-thumbnail -tile -title -transform -transparent \ | |
-transparent-color -treedepth -trim -type -units \ | |
-verbose -version -virtual-pixel \ | |
-white-point' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+adjoin +compress +debug +dither \ | |
+endian +gamma +label +matte +page' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_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 | |
} | |
_mysqladmin () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-u | --user) | |
COMPREPLY=($( compgen -u -- "$cur" )); | |
return 0 | |
;; | |
-h | --host) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
--character-sets-dir | --ssl-capath) | |
_filedir -d; | |
return 0 | |
;; | |
-S | --socket) | |
_filedir sock; | |
return 0 | |
;; | |
--defaults-file | --defaults-extra-file) | |
_filedir; | |
return 0 | |
;; | |
-c | --count | --default-character-set | -P | --port | -O | --set-variable | -i | --sleep | --ssl-ca | --ssl-cert | --ssl-cipher | --ssl-key | -w | --wait | --connect_timeout | --shutdown_timeout) | |
return 0 | |
;; | |
'-?' | --help | -V | --version) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
COMPREPLY=($( compgen -W '--count --debug-check --debug-info --force \ | |
--compress --character-sets-dir --default-character-set --help --host \ | |
--no-beep --password --port --protocol --relative --set-variable \ | |
--silent --socket --sleep --ssl --ssl-ca --ssl-capath --ssl-cert \ | |
--ssl-cipher --ssl-key --ssl-verify-server-cert --user --verbose \ | |
--version --vertical --wait --connect_timeout --shutdown_timeout \ | |
--print-defaults --no-defaults --defaults-file --defaults-extra-file' -- "$cur" )); | |
COMPREPLY=("${COMPREPLY[@]}" $( compgen -W 'create debug drop extended-status flush-hosts \ | |
flush-logs flush-status flush-tables flush-threads flush-privileges \ | |
kill password old-password ping processlist reload refresh shutdown \ | |
status start-slave stop-slave variables version' -- "$cur" )) | |
} | |
_newgrp () | |
{ | |
COMPREPLY=(); | |
if [[ "`_get_cword`" == "-" ]]; then | |
COMPREPLY=(-); | |
else | |
_allowed_groups; | |
fi | |
} | |
_nmap () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
cur=`_get_cword`; | |
prev=`_get_pword`; | |
case $prev in | |
-iL | -oN | -oX | -oS | -oG | ---excludefile | --resume | --stylesheet) | |
_filedir; | |
return 0 | |
;; | |
-oA | --datadir) | |
_filedir -d; | |
return 0 | |
;; | |
-e) | |
_available_interfaces; | |
return 0 | |
;; | |
-b | --dns-servers) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-iL -iR --exclude --excludefile -sL -sP \ | |
-PN -PS -PA -PU -PY -PE -PP -PM -PO -n -R --dns-servers \ | |
--system-dns --traceroute -sS -sT -sA -sW -sM -sU -sN -sF -sX \ | |
--scanflags -sI -sY -sZ -sO -b -p -F -r --top-ports --port-ratio \ | |
-sV --version-intensity --version-light --version-all \ | |
--version-trace -sC --script= --script-args= --script-trace \ | |
--script-updatedb -O --osscan-limit --osscan-guess -T0 -T1 -T2 -T3 \ | |
-T4 -T5 --min-hostgroup --max-hostgroup --min-parallelism \ | |
--max-parallelism --min-rtt-timeout --max-rtt-timeout \ | |
--initial-rtt-timeout --max-retries --host-timeout --scan-delay \ | |
--max-scan-delay --min-rate --max-rate -f --mtu -D -S -e \ | |
--source-port --data-length --ip-options --ttl --spoof-mac \ | |
--badsum --adler32 -oN -oX -oS -oG -oA -v -d --reason --open \ | |
--packet-trace --iflist --log-errors --append-output --resume \ | |
--stylesheet --webxml --no-stylesheet -6 -A --datadir --send-eth \ | |
--send-ip --privilege--unprivileged -V -h' -- "$cur" )); | |
else | |
_known_hosts_real "$cur"; | |
fi | |
} | |
_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 '$( 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" | |
} | |
_pg_databases () | |
{ | |
COMPREPLY=($( compgen -W "$( psql -AtqwlF ' ' 2>/dev/null | awk 'NF > 1 { print $1 }' )" -- "$cur" )) | |
} | |
_pg_users () | |
{ | |
COMPREPLY=($( compgen -W "$( psql -Atqwc 'select usename from pg_user' template1 2>/dev/null )" -- "$cur" )); | |
[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=($( compgen -u -- "$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 | |
} | |
_pnames () | |
{ | |
COMPREPLY=($( compgen -X '<defunct>' -W '$( command ps axo command= | \ | |
sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \ | |
-e "s/[])]$//" | sort -u )' -- "$cur" )) | |
} | |
_postcat () | |
{ | |
local cur prev pval len idx qfile; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-c) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
if [[ $cur == -* ]]; then | |
COMPREPLY=($( compgen -W '-c -q -v' -- "$cur" )); | |
return 0; | |
fi; | |
qfile=0; | |
for idx in "${COMP_WORDS[@]}"; | |
do | |
[[ "$idx" = -q ]] && qfile=1 && break; | |
done; | |
if [[ $qfile == 1 ]]; then | |
len=${#cur}; | |
idx=0; | |
for pval in $( mailq 2>/dev/null | sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]=$pval; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
return 0; | |
else | |
_filedir; | |
return 0; | |
fi | |
} | |
_postconf () | |
{ | |
local cur prev pval len idx eqext; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-b | -t) | |
_filedir; | |
return 0 | |
;; | |
-c) | |
_filedir -d; | |
return 0 | |
;; | |
-e) | |
cur=${cur#[\"\']}; | |
eqext='=' | |
;; | |
esac; | |
if [[ $cur == -* ]]; then | |
COMPREPLY=($( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v' -- "$cur" )); | |
return 0; | |
fi; | |
len=${#cur}; | |
idx=0; | |
for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]="$pval$eqext"; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
return 0 | |
} | |
_postfix () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-c) | |
_filedir -d; | |
return 0 | |
;; | |
-D) | |
COMPREPLY=($( compgen -W 'start' -- "$cur" )); | |
return 0 | |
;; | |
esac; | |
if [[ $cur == -* ]]; then | |
COMPREPLY=($( compgen -W '-c -D -v' -- "$cur" )); | |
return 0; | |
fi; | |
COMPREPLY=($( compgen -W 'check start stop abort flush reload status \ | |
set-permissions upgrade-configuration' -- "$cur" )) | |
} | |
_postmap () | |
{ | |
local cur prev len idx; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-c) | |
_filedir -d; | |
return 0 | |
;; | |
-[dq]) | |
return 0 | |
;; | |
esac; | |
if [[ $cur == -* ]]; then | |
COMPREPLY=($( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q' -- "$cur" )); | |
return 0; | |
fi; | |
if [[ "$cur" == *:* ]]; then | |
_compopt_o_filenames; | |
COMPREPLY=($( compgen -f -- "${cur#*:}" )); | |
else | |
len=${#cur}; | |
idx=0; | |
for pval in $( /usr/sbin/postconf -m ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]="$pval:"; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
if [[ $idx -eq 0 ]]; then | |
_compopt_o_filenames; | |
COMPREPLY=($( compgen -f -- "$cur" )); | |
fi; | |
fi; | |
return 0 | |
} | |
_postsuper () | |
{ | |
local cur prev pval len idx; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-c) | |
_filedir -d; | |
return 0 | |
;; | |
-[dr]) | |
len=${#cur}; | |
idx=0; | |
for pval in ALL $( mailq 2>/dev/null | sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]=$pval; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
return 0 | |
;; | |
-h) | |
len=${#cur}; | |
idx=0; | |
for pval in ALL $( mailq 2>/dev/null | sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]=$pval; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
return 0 | |
;; | |
-H) | |
len=${#cur}; | |
idx=0; | |
for pval in ALL $( mailq 2>/dev/null | sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); | |
do | |
if [[ "$cur" == "${pval:0:$len}" ]]; then | |
COMPREPLY[$idx]=$pval; | |
idx=$(($idx+1)); | |
fi; | |
done; | |
return 0 | |
;; | |
esac; | |
if [[ $cur == -* ]]; then | |
COMPREPLY=($( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" )); | |
return 0; | |
fi; | |
COMPREPLY=($( compgen -W 'hold incoming active deferred' -- "$cur" )) | |
} | |
_psql () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-h | --host) | |
_known_hosts_real "$cur"; | |
return 0 | |
;; | |
-U | --username) | |
_pg_users; | |
return 0 | |
;; | |
-d | --dbname) | |
_pg_databases; | |
return 0 | |
;; | |
-o | --output | -f | --file | -L | --log-file) | |
_filedir; | |
return 0 | |
;; | |
-c | --command | -F | --field-separator | -p | --port | -P | --pset | -R | --record-separator | -T | --table-attr | -v | --set | --variable) | |
return 0 | |
;; | |
-\? | --help | -V | --version) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '--echo-all --no-align --command --dbname \ | |
--echo-queries --echo-hidden --file --field-separator --host \ | |
--html --list --log-file --output --port --pset --quiet \ | |
--record-separator --single-step --single-line --tuples-only \ | |
--table-attr --username --set --version --password --expanded \ | |
--no-psqlrc --single-transaction --help' -- "$cur" )); | |
else | |
_pg_databases; | |
fi | |
} | |
_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 | |
} | |
_quota () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-F --format -g --group -u --user -v \ | |
--verbose -s --human-readable -p --raw-grace -i --no-autofs -l \ | |
--local-only -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q \ | |
--quiet-refuse -w --no-wrap' -- "$cur" )); | |
else | |
_user_or_group; | |
fi | |
} | |
_quota_formats () | |
{ | |
COMPREPLY=($( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" )) | |
} | |
_quotacheck () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-b --backup -v --verbose -d --debug \ | |
-g --group -u --user -c --create-files -f --force -i \ | |
--interactive -n --use-first-dquot -M --try-remount -m \ | |
--no-remount -R --exclude-root -F --format -a --all' -- "$cur" )); | |
else | |
_filesystems; | |
fi | |
} | |
_quotaoff () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
-x | --xfs-command) | |
COMPREPLY=($( compgen -W 'delete enforce' -- "$cur" )); | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-a --all -v --verbose -u --user \ | |
-g --group -p --print-state -x --xfs-command -F --format' -- "$cur" )); | |
else | |
_filesystems; | |
fi | |
} | |
_quotaon () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-a --all -v --verbose -u --user \ | |
-g --group -f --off -p --print-state -F --format' -- "$cur" )); | |
else | |
_filesystems; | |
fi | |
} | |
_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} | |
} | |
_rbenv () | |
{ | |
COMPREPLY=(); | |
local word="${COMP_WORDS[COMP_CWORD]}"; | |
if [ "$COMP_CWORD" -eq 1 ]; then | |
COMPREPLY=($(compgen -W "$(rbenv commands)" -- "$word")); | |
else | |
local words=("${COMP_WORDS[@]}"); | |
unset words[0]; | |
unset words[$COMP_CWORD]; | |
local completions=$(rbenv completions "${words[@]}"); | |
COMPREPLY=($(compgen -W "$completions" -- "$word")); | |
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 "$(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 | |
} | |
_repquota () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-a --all -v --verbose -s --human-readable \ | |
-c --batch-translation -C --no-batch-translation -t \ | |
--truncate-names -n --no-names -p --raw-grace -i --no-autofs \ | |
-u --user -g --group -F --format' -- "$cur" )); | |
else | |
_filesystems; | |
fi | |
} | |
_ri () | |
{ | |
local cur class method prefix ri_path ri_version separator IFS; | |
local -a classes; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
ri_path=$(type -p ri); | |
ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated; | |
[ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated; | |
IFS=', | |
'; | |
if [[ "$cur" == [A-Z]*[#.]* ]]; then | |
[[ "$cur" == *#* ]] && separator=# || separator=.; | |
class=${cur%$separator*}; | |
method=${cur#*$separator}; | |
classes=($class); | |
prefix="-P $class$separator"; | |
ri_get_methods; | |
return 0; | |
fi; | |
if [ "$ri_version" = integrated ]; then | |
classes=($( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \ | |
if /, [A-Z]+/ then print; end; end' )); | |
else | |
if [ "$ri_version" = "ri 1.8a" ]; then | |
classes=($( ruby -W0 $ri_path | ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ | |
if /^ .*[A-Z]/ then print; end; end' )); | |
else | |
classes=($( ruby -W0 $ri_path | ruby -ne 'if /^I have/..$stdin.eof then \ | |
if /^ .*[A-Z]/ then print; end; end' )); | |
fi; | |
fi; | |
COMPREPLY=($( compgen -W '${classes[@]}' -- "$cur" )); | |
if [[ "$cur" == [A-Z]* ]]; then | |
return 0; | |
fi; | |
method=$cur; | |
ri_get_methods | |
} | |
_rl_enabled () | |
{ | |
[[ "$( bind -v )" = *$1+([[:space:]])on* ]] | |
} | |
_root_command () | |
{ | |
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin; | |
local root_command=$1; | |
_command $1 $2 $3 | |
} | |
_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 | |
} | |
_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" )) | |
} | |
_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" )) | |
} | |
_setquota () | |
{ | |
local cur prev split=false; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
_split_longopt && split=true; | |
case $prev in | |
-F | --format) | |
_quota_formats; | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-r --remote -m --no-mixed-pathnames \ | |
-F --format -g --group -u --user -p --prototype -b --batch \ | |
-c --continue-batch -t --edit-period -T --edit-times -a --all' -- "$cur" )); | |
else | |
_count_args; | |
case $args in | |
1) | |
_user_or_group | |
;; | |
2) | |
_filesystems | |
;; | |
esac; | |
fi | |
} | |
_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 | |
} | |
_split_longopt () | |
{ | |
if [[ "$cur" == --?*=* ]]; then | |
prev="${cur%%?(\\)=*}"; | |
cur="${cur#*=}"; | |
return 0; | |
fi; | |
return 1 | |
} | |
_sqlite3 () | |
{ | |
COMPREPLY=(); | |
local cur prev; | |
_get_comp_words_by_ref cur prev; | |
local dbexts='@(sqlite?(3)|?(s?(3))db)'; | |
case $prev in | |
-help | -version | -separator | -nullvalue | *.$dbexts) | |
return 0 | |
;; | |
-init) | |
_filedir; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-help -init -echo -header -noheader -bail | |
-interactive -batch -column -csv -html -line -list -separator | |
-nullvalue -version' -- "$cur" )); | |
return 0; | |
fi; | |
_filedir $dbexts | |
} | |
_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 \ | |
[email protected] 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 | |
} | |
_stream () | |
{ | |
local cur; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
_ImageMagick; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '-authenticate -channel -colorspace \ | |
-compress -debug -define -density -depth -extract \ | |
-help -identify -interlace -interpolate -limit -list \ | |
-log -map -monitor -quantize -quiet -regard-warnings \ | |
-respect-parenthesis -sampling-factor -seed -set \ | |
-size -storage-type -transparent-color -verbose \ | |
-version -virtual-pixel' -- "$cur" )); | |
else | |
if [[ "$cur" == +* ]]; then | |
COMPREPLY=($( compgen -W '+debug' -- "$cur" )); | |
else | |
_filedir; | |
fi; | |
fi | |
} | |
_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 | |
} | |
_tig () | |
{ | |
local i c=1 command __tig_dir; | |
while [ $c -lt $COMP_CWORD ]; do | |
i="${COMP_WORDS[c]}"; | |
case "$i" in | |
--) | |
command="log"; | |
break | |
;; | |
-*) | |
;; | |
*) | |
command="$i"; | |
break | |
;; | |
esac; | |
c=$((++c)); | |
done; | |
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then | |
case "${COMP_WORDS[COMP_CWORD]}" in | |
--*=*) | |
COMPREPLY=() | |
;; | |
-*) | |
_tig_options | |
;; | |
*) | |
_tigcomp "blame status show log stash grep $(__tig_refs)" | |
;; | |
esac; | |
return; | |
fi; | |
case "$command" in | |
blame) | |
_tig_blame | |
;; | |
show) | |
_tig_show | |
;; | |
status) | |
;; | |
*) | |
_tigcomp " | |
$(__tig_complete_file) | |
$(__tig_refs) | |
" | |
;; | |
esac | |
} | |
_tig_blame () | |
{ | |
local reply="" ref=HEAD cur="${COMP_WORDS[COMP_CWORD]}"; | |
if test "$COMP_CWORD" -lt 3; then | |
reply="$(__tig_refs)"; | |
else | |
ref="${COMP_WORDS[2]}"; | |
fi; | |
reply="$reply $(git --git-dir="$(__tigdir)" ls-tree "$ref" | sed '/^100... blob /s,^.* ,, | |
/^040000 tree /{ | |
s,^.* ,, | |
s,$,/, | |
} | |
s/^.* //')"; | |
_tigcomp "$reply" | |
} | |
_tig_options () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--pretty=*) | |
_tigcomp " | |
oneline short medium full fuller email raw | |
" "" "${cur##--pretty=}"; | |
return | |
;; | |
--*) | |
_tigcomp " | |
--max-count= --max-age= --since= --after= | |
--min-age= --before= --until= | |
--root --not --topo-order --date-order | |
--no-merges | |
--abbrev-commit --abbrev= | |
--relative-date | |
--author= --committer= --grep= | |
--all-match | |
--pretty= --name-status --name-only | |
--not --all | |
--help --version | |
"; | |
return | |
;; | |
-*) | |
_tigcomp "-v -h"; | |
return | |
;; | |
esac; | |
__tig_complete_revlist | |
} | |
_tig_show () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
case "$cur" in | |
--pretty=*) | |
_tigcomp " | |
oneline short medium full fuller email raw | |
" "" "${cur##--pretty=}"; | |
return | |
;; | |
--*) | |
_tigcomp "--pretty="; | |
return | |
;; | |
esac; | |
__tig_complete_file | |
} | |
_tigcomp () | |
{ | |
local all c s=' | |
' IFS=' '' '' | |
'; | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
if [ $# -gt 2 ]; then | |
cur="$3"; | |
fi; | |
for c in $1; | |
do | |
case "$c$4" in | |
--*=*) | |
all="$all$c$4$s" | |
;; | |
*.) | |
all="$all$c$4$s" | |
;; | |
*) | |
all="$all$c$4 $s" | |
;; | |
esac; | |
done; | |
IFS=$s; | |
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur")); | |
return | |
} | |
_tilde () | |
{ | |
local result=0; | |
if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then | |
_compopt_o_filenames; | |
COMPREPLY=($( compgen -P '~' -u "${1#\~}" )); | |
result=${#COMPREPLY[@]}; | |
fi; | |
return $result | |
} | |
_tmux () | |
{ | |
local cur prev opts; | |
COMPREPLY=(); | |
cur="${COMP_WORDS[COMP_CWORD]}"; | |
prev="${COMP_WORDS[COMP_CWORD-1]}"; | |
opts=" attach-session bind-key break-pane capture-pane choose-client choose-session choose-window clear-history clock-mode command-prompt confirm-before copy-buffer copy-mode delete-buffer detach-client display-message display-panes down-pane find-window has-session if-shell join-pane kill-pane kill-server kill-session kill-window last-window link-window list-buffers list-clients list-commands list-keys list-panes list-sessions list-windows load-buffer lock-client lock-server lock-session move-window new-session new-window next-layout next-window paste-buffer pipe-pane previous-layout previous-window refresh-client rename-session rename-window resize-pane respawn-window rotate-window run-shell save-buffer select-layout select-pane select-prompt select-window send-keys send-prefix server-info set-buffer set-environment set-option set-window-option show-buffer show-environment show-messages show-options show-window-options source-file split-window start-server suspend-client swap-pane swap-window switch-client unbind-key unlink-window up-pane"; | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})); | |
return 0 | |
} | |
_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 | |
} | |
_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 | |
} | |
_user_or_group () | |
{ | |
local i; | |
for ((i=1; i < COMP_CWORD; i++ )) | |
do | |
if [[ "${COMP_WORDS[i]}" == -g ]]; then | |
COMPREPLY=($( compgen -g -- "$cur" )); | |
return 0; | |
fi; | |
done; | |
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 | |
} | |
_venv () | |
{ | |
if [[ $VIRTUAL_ENV != "" ]]; then | |
echo "(${VIRTUAL_ENV##*/})"; | |
else | |
echo ""; | |
fi | |
} | |
_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 | |
} | |
_virtualenvs () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
COMPREPLY=($(compgen -W "`virtualenvwrapper_show_workon_options`" -- ${cur})) | |
} | |
_xmllint () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
-o | --output) | |
_filedir; | |
return 0 | |
;; | |
--path | --dtdvalidfpi | --maxmem | --encode | --pattern) | |
return 0 | |
;; | |
--dtdvalid) | |
_filedir 'dtd?(.gz)'; | |
return 0 | |
;; | |
--relaxng) | |
_filedir 'rng?(.gz)'; | |
return 0 | |
;; | |
--schema) | |
_filedir 'xsd?(.gz)'; | |
return 0 | |
;; | |
--schematron) | |
_filedir 'sch?(.gz)'; | |
return 0 | |
;; | |
esac; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '$( xmllint --help 2>&1 | \ | |
sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \ | |
-o' -- "$cur" )); | |
return 0; | |
fi; | |
_filedir '@(*ml|htm|svg|xs[dl]|rng|wsdl|jnlp)?(.gz)' | |
} | |
_xsltproc () | |
{ | |
local cur prev; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur prev; | |
case $prev in | |
--output | -o) | |
_filedir; | |
return 0 | |
;; | |
--maxdepth) | |
return 0 | |
;; | |
--encoding) | |
COMPREPLY=($( compgen -W "$( iconv -l | sed -e '/^UTF[1378]/d' -e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" )); | |
return 0 | |
;; | |
--param | --stringparam) | |
return 0 | |
;; | |
--path) | |
_filedir -d; | |
return 0 | |
;; | |
--writesubtree) | |
_filedir -d; | |
return 0 | |
;; | |
esac; | |
[[ $COMP_CWORD -gt 2 && `_get_cword '' 2` == --?(string)param ]] && return 0; | |
if [[ "$cur" == -* ]]; then | |
_longopt xsltproc; | |
else | |
_filedir '@(xsl|xslt|xml)'; | |
fi | |
} | |
_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" )) | |
} | |
_xzdec () | |
{ | |
COMPREPLY=(); | |
local cur prev; | |
_get_comp_words_by_ref cur prev; | |
if [[ "$cur" == -* ]]; then | |
COMPREPLY=($( compgen -W '--memory --help --version' -- "$cur" )); | |
return 0; | |
fi; | |
local split=false; | |
_split_longopt && split=true; | |
case $prev in | |
-M | --memory) | |
return 0 | |
;; | |
-h | --help | -V | --version) | |
return 0 | |
;; | |
esac; | |
$split && return 0; | |
_filedir xz | |
} | |
_ypmatch () | |
{ | |
local cur map cmd; | |
COMPREPLY=(); | |
_get_comp_words_by_ref cur; | |
cmd=${1##*/}; | |
[[ $cmd == ypcat && $COMP_CWORD -gt 1 ]] && return 0; | |
[[ $cmd == ypmatch && $COMP_CWORD -gt 2 ]] && return 0; | |
if [[ $cmd == ypmatch && $COMP_CWORD -eq 1 && ${#COMP_WORDS[@]} -eq 3 ]]; then | |
map=${COMP_WORDS[2]}; | |
COMPREPLY=($( compgen -W '$( ypcat $map | \ | |
cut -d':' -f 1 )' -- "$cur")); | |
else | |
[[ $cmd == ypmatch && $COMP_CWORD -ne 2 ]] && return 0; | |
COMPREPLY=($( compgen -W '$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur")); | |
fi; | |
return 0 | |
} | |
add2virtualenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
site_packages="`virtualenvwrapper_get_site_packages_dir`"; | |
if [ ! -d "${site_packages}" ]; then | |
echo "ERROR: currently-active virtualenv does not appear to have a site-packages directory" 1>&2; | |
return 1; | |
fi; | |
path_file="$site_packages/_virtualenv_path_extensions.pth"; | |
if [ "$*" = "" ]; then | |
echo "Usage: add2virtualenv dir [dir ...]"; | |
if [ -f "$path_file" ]; then | |
echo; | |
echo "Existing paths:"; | |
cat "$path_file" | grep -v "^import"; | |
fi; | |
return 1; | |
fi; | |
remove=0; | |
if [ "$1" = "-d" ]; then | |
remove=1; | |
shift; | |
fi; | |
if [ ! -f "$path_file" ]; then | |
echo "import sys; sys.__plen = len(sys.path)" > "$path_file" || return 1; | |
echo "import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)" >> "$path_file" || return 1; | |
fi; | |
for pydir in "$@"; | |
do | |
absolute_path="$(virtualenvwrapper_absolutepath "$pydir")"; | |
if [ "$absolute_path" != "$pydir" ]; then | |
echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2; | |
fi; | |
if [ $remove -eq 1 ]; then | |
sed -i.tmp "\:^$absolute_path$: d" "$path_file"; | |
else | |
sed -i.tmp '1 a\ | |
'"$absolute_path"' | |
' "$path_file"; | |
fi; | |
rm -f "${path_file}.tmp"; | |
done; | |
return 0 | |
} | |
allvirtualenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
typeset d; | |
virtualenvwrapper_show_workon_options | while read d; do | |
[ ! -d "$WORKON_HOME/$d" ] && continue; | |
echo "$d"; | |
echo "$d" | sed 's/./=/g'; | |
( source "$WORKON_HOME/$d/bin/activate"; | |
cd "$VIRTUAL_ENV"; | |
$@ ); | |
echo; | |
done | |
} | |
cdproject () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
if [ -f "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME" ]; then | |
typeset project_dir="$(cat "$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME")"; | |
if [ ! -z "$project_dir" ]; then | |
cd "$project_dir"; | |
else | |
echo "Project directory $project_dir does not exist" 1>&2; | |
return 1; | |
fi; | |
else | |
echo "No project set in $VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME" 1>&2; | |
return 1; | |
fi; | |
return 0 | |
} | |
cdsitepackages () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
typeset site_packages="`virtualenvwrapper_get_site_packages_dir`"; | |
virtualenvwrapper_cd "$site_packages"/$1 | |
} | |
cdvirtualenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
virtualenvwrapper_cd $VIRTUAL_ENV/$1 | |
} | |
cpvirtualenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_virtualenv_clone || return 1; | |
typeset src_name="$1"; | |
typeset trg_name="$2"; | |
typeset src; | |
typeset trg; | |
if [ "$src_name" = "" ]; then | |
echo "Please provide a valid virtualenv to copy."; | |
return 1; | |
else | |
if [ ! -e "$WORKON_HOME/$src_name" ]; then | |
src="$(virtualenvwrapper_expandpath "$src_name")"; | |
if [ ! -e "$src" ]; then | |
echo "Please provide a valid virtualenv to copy."; | |
return 1; | |
fi; | |
src_name="$(basename "$src")"; | |
else | |
src="$WORKON_HOME/$src_name"; | |
fi; | |
fi; | |
if [ "$trg_name" = "" ]; then | |
trg="$WORKON_HOME/$src_name"; | |
trg_name="$src_name"; | |
else | |
trg="$WORKON_HOME/$trg_name"; | |
fi; | |
trg="$(virtualenvwrapper_expandpath "$trg")"; | |
if [ -e "$trg" ]; then | |
echo "$trg_name virtualenv already exists."; | |
return 1; | |
fi; | |
echo "Copying $src_name as $trg_name..."; | |
( [ -n "$ZSH_VERSION" ] && setopt SH_WORD_SPLIT; | |
virtualenvwrapper_cd "$WORKON_HOME" && "$VIRTUALENVWRAPPER_VIRTUALENV_CLONE" "$src" "$trg"; | |
[ -d "$trg" ] && virtualenvwrapper_run_hook "pre_cpvirtualenv" "$src" "$trg_name" && virtualenvwrapper_run_hook "pre_mkvirtualenv" "$trg_name" ); | |
typeset RC=$?; | |
[ $RC -ne 0 ] && return $RC; | |
[ ! -d "$WORKON_HOME/$trg_name" ] && return 1; | |
workon "$trg_name"; | |
virtualenvwrapper_run_hook "post_mkvirtualenv"; | |
virtualenvwrapper_run_hook "post_cpvirtualenv" | |
} | |
dequote () | |
{ | |
eval echo "$1" 2> /dev/null | |
} | |
lssitepackages () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
typeset site_packages="`virtualenvwrapper_get_site_packages_dir`"; | |
ls $@ "$site_packages"; | |
path_file="$site_packages/_virtualenv_path_extensions.pth"; | |
if [ -f "$path_file" ]; then | |
echo; | |
echo "_virtualenv_path_extensions.pth:"; | |
cat "$path_file"; | |
fi | |
} | |
lsvirtualenv () | |
{ | |
typeset long_mode=true; | |
if command -v "getopts" >&/dev/null; then | |
OPTIND=1; | |
while getopts ":blh" opt "$@"; do | |
case "$opt" in | |
l) | |
long_mode=true | |
;; | |
b) | |
long_mode=false | |
;; | |
h) | |
_lsvirtualenv_usage; | |
return 1 | |
;; | |
?) | |
echo "Invalid option: -$OPTARG" 1>&2; | |
_lsvirtualenv_usage; | |
return 1 | |
;; | |
esac; | |
done; | |
else | |
typeset -a args; | |
args=($(getopt blh "$@")); | |
if [ $? != 0 ]; then | |
_lsvirtualenv_usage; | |
return 1; | |
fi; | |
for opt in $args; | |
do | |
case "$opt" in | |
-l) | |
long_mode=true | |
;; | |
-b) | |
long_mode=false | |
;; | |
-h) | |
_lsvirtualenv_usage; | |
return 1 | |
;; | |
esac; | |
done; | |
fi; | |
if $long_mode; then | |
allvirtualenv showvirtualenv "$env_name"; | |
else | |
virtualenvwrapper_show_workon_options; | |
fi | |
} | |
mkproject () | |
{ | |
typeset -a in_args; | |
typeset -a out_args; | |
typeset -i i; | |
typeset tst; | |
typeset a; | |
typeset t; | |
typeset templates; | |
in_args=("$@"); | |
if [ -n "$ZSH_VERSION" ]; then | |
i=1; | |
tst="-le"; | |
else | |
i=0; | |
tst="-lt"; | |
fi; | |
while [ $i $tst $# ]; do | |
a="${in_args[$i]}"; | |
case "$a" in | |
-h | --help) | |
virtualenvwrapper_mkproject_help; | |
return | |
;; | |
-t) | |
i=$(( $i + 1 )); | |
templates="$templates ${in_args[$i]}" | |
;; | |
*) | |
if [ ${#out_args} -gt 0 ]; then | |
out_args=("${out_args[@]-}" "$a"); | |
else | |
out_args=("$a"); | |
fi | |
;; | |
esac; | |
i=$(( $i + 1 )); | |
done; | |
set -- "${out_args[@]}"; | |
eval "typeset envname=\$$#"; | |
virtualenvwrapper_verify_project_home || return 1; | |
if [ -d "$PROJECT_HOME/$envname" ]; then | |
echo "Project $envname already exists." 1>&2; | |
return 1; | |
fi; | |
mkvirtualenv "$@" || return 1; | |
cd "$PROJECT_HOME"; | |
virtualenvwrapper_run_hook "project.pre_mkproject" $envname; | |
echo "Creating $PROJECT_HOME/$envname"; | |
mkdir -p "$PROJECT_HOME/$envname"; | |
setvirtualenvproject "$VIRTUAL_ENV" "$PROJECT_HOME/$envname"; | |
cd "$PROJECT_HOME/$envname"; | |
for t in $templates; | |
do | |
echo; | |
echo "Applying template $t"; | |
virtualenvwrapper_run_hook --name $(echo $t | sed 's/^ //') "project.template" "$envname" "$PROJECT_HOME/$envname"; | |
done; | |
virtualenvwrapper_run_hook "project.post_mkproject" | |
} | |
mktmpenv () | |
{ | |
typeset tmpenvname; | |
typeset RC; | |
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid,sys; sys.stdout.write(uuid.uuid4()+"\n")' 2>/dev/null); | |
if [ -z "$tmpenvname" ]; then | |
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random,sys; sys.stdout.write(hex(random.getrandbits(64))[2:-1]+"\n")' 2>/dev/null); | |
fi; | |
mkvirtualenv "$@" "$tmpenvname"; | |
RC=$?; | |
if [ $RC -ne 0 ]; then | |
return $RC; | |
fi; | |
cdvirtualenv; | |
echo "This is a temporary environment. It will be deleted when you run 'deactivate'." | tee "$VIRTUAL_ENV/README.tmpenv"; | |
cat - >> "$VIRTUAL_ENV/bin/postdeactivate" <<EOF | |
if [ -f "$VIRTUAL_ENV/README.tmpenv" ] | |
then | |
echo "Removing temporary environment:" $(basename "$VIRTUAL_ENV") | |
rmvirtualenv $(basename "$VIRTUAL_ENV") | |
fi | |
EOF | |
} | |
mkvirtualenv () | |
{ | |
typeset -a in_args; | |
typeset -a out_args; | |
typeset -i i; | |
typeset tst; | |
typeset a; | |
typeset envname; | |
typeset requirements; | |
typeset packages; | |
typeset interpreter; | |
in_args=("$@"); | |
if [ -n "$ZSH_VERSION" ]; then | |
i=1; | |
tst="-le"; | |
else | |
i=0; | |
tst="-lt"; | |
fi; | |
while [ $i $tst $# ]; do | |
a="${in_args[$i]}"; | |
case "$a" in | |
-a) | |
i=$(( $i + 1 )); | |
project="${in_args[$i]}" | |
;; | |
-h | --help) | |
virtualenvwrapper_mkvirtualenv_help $a; | |
return | |
;; | |
-i) | |
i=$(( $i + 1 )); | |
packages="$packages ${in_args[$i]}" | |
;; | |
-p | --python*) | |
if echo "$a" | grep -q "="; then | |
interpreter="$(echo "$a" | cut -f2 -d=)"; | |
else | |
i=$(( $i + 1 )); | |
interpreter="${in_args[$i]}"; | |
fi; | |
interpreter="$(virtualenvwrapper_absolutepath "$interpreter")" | |
;; | |
-r) | |
i=$(( $i + 1 )); | |
requirements="${in_args[$i]}"; | |
requirements="$(virtualenvwrapper_expandpath "$requirements")" | |
;; | |
*) | |
if [ ${#out_args} -gt 0 ]; then | |
out_args=("${out_args[@]-}" "$a"); | |
else | |
out_args=("$a"); | |
fi | |
;; | |
esac; | |
i=$(( $i + 1 )); | |
done; | |
if [ ! -z $interpreter ]; then | |
out_args=("--python=$interpreter" ${out_args[@]}); | |
fi; | |
set -- "${out_args[@]}"; | |
eval "envname=\$$#"; | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_virtualenv || return 1; | |
( [ -n "$ZSH_VERSION" ] && setopt SH_WORD_SPLIT; | |
virtualenvwrapper_cd "$WORKON_HOME" && "$VIRTUALENVWRAPPER_VIRTUALENV" $VIRTUALENVWRAPPER_VIRTUALENV_ARGS "$@" && [ -d "$WORKON_HOME/$envname" ] && virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname" ); | |
typeset RC=$?; | |
[ $RC -ne 0 ] && return $RC; | |
[ ! -d "$WORKON_HOME/$envname" ] && return 0; | |
if [ ! -z "$project" ]; then | |
setvirtualenvproject "$WORKON_HOME/$envname" "$project"; | |
fi; | |
workon "$envname"; | |
if [ ! -z "$requirements" ]; then | |
pip install -r "$requirements"; | |
fi; | |
for a in $packages; | |
do | |
pip install $a; | |
done; | |
virtualenvwrapper_run_hook "post_mkvirtualenv" | |
} | |
parse_git_branch () | |
{ | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "["${ref#refs/heads/}"] " | |
} | |
quote () | |
{ | |
echo \'${1//\'/\'\\\'\'}\' | |
} | |
quote_readline () | |
{ | |
local quoted; | |
_quote_readline_by_ref "$1" ret; | |
printf %s "$ret" | |
} | |
rbenv () | |
{ | |
typeset command; | |
command="$1"; | |
if [ "$#" -gt 0 ]; then | |
shift; | |
fi; | |
case "$command" in | |
rehash | shell) | |
eval `rbenv "sh-$command" "$@"` | |
;; | |
*) | |
command rbenv "$command" "$@" | |
;; | |
esac | |
} | |
ri_get_methods () | |
{ | |
local regex; | |
if [ "$ri_version" = integrated ]; then | |
if [ -z "$separator" ]; then | |
regex="(Instance|Class)"; | |
else | |
if [ "$separator" = "#" ]; then | |
regex=Instance; | |
else | |
regex=Class; | |
fi; | |
fi; | |
COMPREPLY=(${COMPREPLY[@]} "$( ri ${classes[@]} 2>/dev/null | ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \ | |
/^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \ | |
end' | sort -u )"); | |
else | |
COMPREPLY=(${COMPREPLY[@]} "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \ | |
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \ | |
end' | sort -u )"); | |
fi; | |
COMPREPLY=($( compgen $prefix -W '${COMPREPLY[@]}' -- $method )) | |
} | |
rmvirtualenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
if [ ${#@} = 0 ]; then | |
echo "Please specify an enviroment." 1>&2; | |
return 1; | |
fi; | |
typeset env_name; | |
for env_name in $@; | |
do | |
echo "Removing $env_name..."; | |
typeset env_dir="$WORKON_HOME/$env_name"; | |
if [ "$VIRTUAL_ENV" = "$env_dir" ]; then | |
echo "ERROR: You cannot remove the active environment ('$env_name')." 1>&2; | |
echo "Either switch to another environment, or run 'deactivate'." 1>&2; | |
return 1; | |
fi; | |
typeset prior_dir="$(pwd)"; | |
virtualenvwrapper_cd "$WORKON_HOME"; | |
virtualenvwrapper_run_hook "pre_rmvirtualenv" "$env_name"; | |
command \rm -rf "$env_dir"; | |
virtualenvwrapper_run_hook "post_rmvirtualenv" "$env_name"; | |
if [ -d "$prior_dir" ]; then | |
virtualenvwrapper_cd "$prior_dir"; | |
fi; | |
done | |
} | |
setvirtualenvproject () | |
{ | |
typeset venv="$1"; | |
typeset prj="$2"; | |
if [ -z "$venv" ]; then | |
venv="$VIRTUAL_ENV"; | |
fi; | |
if [ -z "$prj" ]; then | |
prj="$(pwd)"; | |
fi; | |
echo "Setting project for $(basename $venv) to $prj"; | |
echo "$prj" > "$venv/$VIRTUALENVWRAPPER_PROJECT_FILENAME" | |
} | |
showvirtualenv () | |
{ | |
typeset env_name="$1"; | |
if [ -z "$env_name" ]; then | |
if [ -z "$VIRTUAL_ENV" ]; then | |
echo "showvirtualenv [env]"; | |
return 1; | |
fi; | |
env_name=$(basename "$VIRTUAL_ENV"); | |
fi; | |
virtualenvwrapper_run_hook "get_env_details" "$env_name"; | |
echo | |
} | |
toggleglobalsitepackages () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
typeset no_global_site_packages_file="`virtualenvwrapper_get_site_packages_dir`/../no-global-site-packages.txt"; | |
if [ -f $no_global_site_packages_file ]; then | |
rm $no_global_site_packages_file; | |
[ "$1" = "-q" ] || echo "Enabled global site-packages"; | |
else | |
touch $no_global_site_packages_file; | |
[ "$1" = "-q" ] || echo "Disabled global site-packages"; | |
fi | |
} | |
virtualenvwrapper_absolutepath () | |
{ | |
if [ "$1" = "" ]; then | |
return 1; | |
else | |
"$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.abspath(\"$1\")+'\n')"; | |
return 0; | |
fi | |
} | |
virtualenvwrapper_cd () | |
{ | |
if [ -n "$BASH" ]; then | |
builtin \cd "$@"; | |
else | |
if [ -n "$ZSH_VERSION" ]; then | |
builtin \cd "$@"; | |
else | |
command \cd "$@"; | |
fi; | |
fi | |
} | |
virtualenvwrapper_derive_workon_home () | |
{ | |
typeset workon_home_dir="$WORKON_HOME"; | |
if [ "$workon_home_dir" = "" ]; then | |
workon_home_dir="$HOME/.virtualenvs"; | |
fi; | |
if echo "$workon_home_dir" | ( unset GREP_OPTIONS; | |
command \grep '^[^/~]' > /dev/null ); then | |
workon_home_dir="$HOME/$WORKON_HOME"; | |
fi; | |
if echo "$workon_home_dir" | ( unset GREP_OPTIONS; | |
command \egrep '([\$~]|//)' > /dev/null ); then | |
workon_home_dir="$(virtualenvwrapper_expandpath "$workon_home_dir")"; | |
fi; | |
echo "$workon_home_dir"; | |
return 0 | |
} | |
virtualenvwrapper_expandpath () | |
{ | |
if [ "$1" = "" ]; then | |
return 1; | |
else | |
"$VIRTUALENVWRAPPER_PYTHON" -c "import os,sys; sys.stdout.write(os.path.normpath(os.path.expanduser(os.path.expandvars(\"$1\")))+'\n')"; | |
return 0; | |
fi | |
} | |
virtualenvwrapper_get_python_version () | |
{ | |
"$VIRTUAL_ENV/bin/python" -V 2>&1 | cut -f2 -d' ' | cut -f-2 -d. | |
} | |
virtualenvwrapper_get_site_packages_dir () | |
{ | |
"$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/python" -c "import distutils; print(distutils.sysconfig.get_python_lib())" | |
} | |
virtualenvwrapper_initialize () | |
{ | |
export WORKON_HOME="$(virtualenvwrapper_derive_workon_home)"; | |
virtualenvwrapper_verify_workon_home -q || return 1; | |
if [ "$VIRTUALENVWRAPPER_HOOK_DIR" = "" ]; then | |
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"; | |
fi; | |
virtualenvwrapper_run_hook "initialize"; | |
virtualenvwrapper_setup_tab_completion; | |
return 0 | |
} | |
virtualenvwrapper_mkproject_help () | |
{ | |
echo "Usage: mkproject [-t template] [virtualenv options] project_name"; | |
echo ""; | |
echo "Multiple templates may be selected. They are applied in the order"; | |
echo "specified on the command line."; | |
echo; | |
echo "mkvirtualenv help:"; | |
echo; | |
mkvirtualenv -h; | |
echo; | |
echo "Available project templates:"; | |
echo; | |
"$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' -l project.template | |
} | |
virtualenvwrapper_mktemp () | |
{ | |
command \mktemp "$@" | |
} | |
virtualenvwrapper_mkvirtualenv_help () | |
{ | |
echo "Usage: mkvirtualenv [-a project_path] [-i package] [-r requirements_file] [virtualenv options] env_name"; | |
echo; | |
echo " -a project_path"; | |
echo; | |
echo " Provide a full path to a project directory to associate with"; | |
echo " the new environment."; | |
echo; | |
echo " -i package"; | |
echo; | |
echo " Install a package after the environment is created."; | |
echo " This option may be repeated."; | |
echo; | |
echo " -r requirements_file"; | |
echo; | |
echo " Provide a pip requirements file to install a base set of packages"; | |
echo " into the new environment."; | |
echo; | |
echo 'virtualenv help:'; | |
echo; | |
"$VIRTUALENVWRAPPER_VIRTUALENV" $@ | |
} | |
virtualenvwrapper_run_hook () | |
{ | |
typeset hook_script; | |
typeset result; | |
hook_script="$(virtualenvwrapper_tempfile ${1}-hook)" || return 1; | |
( cd "$WORKON_HOME" && "$VIRTUALENVWRAPPER_PYTHON" -m 'virtualenvwrapper.hook_loader' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@" ); | |
result=$?; | |
if [ $result -eq 0 ]; then | |
if [ ! -f "$hook_script" ]; then | |
echo "ERROR: virtualenvwrapper_run_hook could not find temporary file $hook_script" 1>&2; | |
command \rm -f "$hook_script"; | |
return 2; | |
fi; | |
source "$hook_script"; | |
else | |
if [ "${1}" = "initialize" ]; then | |
cat - 1>&2 <<EOF | |
virtualenvwrapper.sh: There was a problem running the initialization hooks. | |
If Python could not import the module virtualenvwrapper.hook_loader, | |
check that virtualenv has been installed for | |
VIRTUALENVWRAPPER_PYTHON=$VIRTUALENVWRAPPER_PYTHON and that PATH is | |
set properly. | |
EOF | |
fi; | |
fi | |
command \rm -f "$hook_script"; | |
return $result | |
} | |
virtualenvwrapper_setup_tab_completion () | |
{ | |
if [ -n "$BASH" ]; then | |
function _virtualenvs () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}"; | |
COMPREPLY=($(compgen -W "`virtualenvwrapper_show_workon_options`" -- ${cur})) | |
}; | |
function _cdvirtualenv_complete () | |
{ | |
local cur="$2"; | |
COMPREPLY=($(cdvirtualenv && compgen -d -- "${cur}" )) | |
}; | |
function _cdsitepackages_complete () | |
{ | |
local cur="$2"; | |
COMPREPLY=($(cdsitepackages && compgen -d -- "${cur}" )) | |
}; | |
complete -o nospace -F _cdvirtualenv_complete -S/ cdvirtualenv; | |
complete -o nospace -F _cdsitepackages_complete -S/ cdsitepackages; | |
complete -o default -o nospace -F _virtualenvs workon; | |
complete -o default -o nospace -F _virtualenvs rmvirtualenv; | |
complete -o default -o nospace -F _virtualenvs cpvirtualenv; | |
complete -o default -o nospace -F _virtualenvs showvirtualenv; | |
else | |
if [ -n "$ZSH_VERSION" ]; then | |
function _virtualenvs () | |
{ | |
reply=($(virtualenvwrapper_show_workon_options)) | |
}; | |
function _cdvirtualenv_complete () | |
{ | |
reply=($(cdvirtualenv && ls -d ${1}*)) | |
}; | |
function _cdsitepackages_complete () | |
{ | |
reply=($(cdsitepackages && ls -d ${1}*)) | |
}; | |
compctl -K _virtualenvs workon rmvirtualenv cpvirtualenv showvirtualenv; | |
compctl -K _cdvirtualenv_complete cdvirtualenv; | |
compctl -K _cdsitepackages_complete cdsitepackages; | |
fi; | |
fi | |
} | |
virtualenvwrapper_show_workon_options () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
( cd "$WORKON_HOME" && echo */$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate ) 2> /dev/null | command \sed "s|/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate||g" | command \fmt -w 1 | ( unset GREP_OPTIONS; | |
command \egrep -v '^\*$' ) 2> /dev/null | |
} | |
virtualenvwrapper_tempfile () | |
{ | |
typeset suffix=${1:-hook}; | |
typeset file; | |
file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)"; | |
if [ $? -ne 0 ] || [ -z "$file" ] || [ ! -f "$file" ]; then | |
echo "ERROR: virtualenvwrapper could not create a temporary file name." 1>&2; | |
return 1; | |
fi; | |
echo $file; | |
return 0 | |
} | |
virtualenvwrapper_verify_active_environment () | |
{ | |
if [ ! -n "${VIRTUAL_ENV}" ] || [ ! -d "${VIRTUAL_ENV}" ]; then | |
echo "ERROR: no virtualenv active, or active virtualenv is missing" 1>&2; | |
return 1; | |
fi; | |
return 0 | |
} | |
virtualenvwrapper_verify_project_home () | |
{ | |
if [ -z "$PROJECT_HOME" ]; then | |
echo "ERROR: Set the PROJECT_HOME shell variable to the name of the directory where projects should be created." 1>&2; | |
return 1; | |
fi; | |
if [ ! -d "$PROJECT_HOME" ]; then | |
[ "$1" != "-q" ] && echo "ERROR: Project directory '$PROJECT_HOME' does not exist. Create it or set PROJECT_HOME to an existing directory." 1>&2; | |
return 1; | |
fi; | |
return 0 | |
} | |
virtualenvwrapper_verify_resource () | |
{ | |
typeset exe_path="$(command \which "$1" | (unset GREP_OPTIONS; command \grep -v "not found"))"; | |
if [ "$exe_path" = "" ]; then | |
echo "ERROR: virtualenvwrapper could not find $1 in your path" 1>&2; | |
return 1; | |
fi; | |
if [ ! -e "$exe_path" ]; then | |
echo "ERROR: Found $1 in path as \"$exe_path\" but that does not exist" 1>&2; | |
return 1; | |
fi; | |
return 0 | |
} | |
virtualenvwrapper_verify_virtualenv () | |
{ | |
virtualenvwrapper_verify_resource $VIRTUALENVWRAPPER_VIRTUALENV | |
} | |
virtualenvwrapper_verify_virtualenv_clone () | |
{ | |
virtualenvwrapper_verify_resource $VIRTUALENVWRAPPER_VIRTUALENV_CLONE | |
} | |
virtualenvwrapper_verify_workon_environment () | |
{ | |
typeset env_name="$1"; | |
if [ ! -d "$WORKON_HOME/$env_name" ]; then | |
echo "ERROR: Environment '$env_name' does not exist. Create it with 'mkvirtualenv $env_name'." 1>&2; | |
return 1; | |
fi; | |
return 0 | |
} | |
virtualenvwrapper_verify_workon_home () | |
{ | |
RC=0; | |
if [ ! -d "$WORKON_HOME/" ]; then | |
if [ "$1" != "-q" ]; then | |
echo "NOTE: Virtual environments directory $WORKON_HOME does not exist. Creating..." 1>&2; | |
fi; | |
mkdir -p "$WORKON_HOME"; | |
RC=$?; | |
fi; | |
return $RC | |
} | |
virtualenvwrapper_workon_help () | |
{ | |
echo "Usage: workon env_name"; | |
echo ""; | |
echo " Deactivate any currently activated virtualenv"; | |
echo " and activate the named environment, triggering"; | |
echo " any hooks in the process."; | |
echo ""; | |
echo " workon"; | |
echo ""; | |
echo " Print a list of available environments."; | |
echo " (See also lsvirtualenv -b)"; | |
echo ""; | |
echo " workon (-h|--help)"; | |
echo ""; | |
echo " Show this help message."; | |
echo "" | |
} | |
wipeenv () | |
{ | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_active_environment || return 1; | |
typeset req_file="$(virtualenvwrapper_tempfile "requirements.txt")"; | |
pip freeze | egrep -v '(distribute|wsgiref)' > "$req_file"; | |
if [ -n "$(cat "$req_file")" ]; then | |
echo "Uninstalling packages:"; | |
cat "$req_file"; | |
echo; | |
pip uninstall -y $(cat "$req_file" | sed 's/>/=/g' | cut -f1 -d=); | |
else | |
echo "Nothing to remove."; | |
fi; | |
rm -f "$req_file" | |
} | |
workon () | |
{ | |
in_args=("$@"); | |
if [ -n "$ZSH_VERSION" ]; then | |
i=1; | |
tst="-le"; | |
else | |
i=0; | |
tst="-lt"; | |
fi; | |
while [ $i $tst $# ]; do | |
a="${in_args[$i]}"; | |
case "$a" in | |
-h | --help) | |
virtualenvwrapper_workon_help; | |
return 0 | |
;; | |
esac; | |
i=$(( $i + 1 )); | |
done; | |
typeset env_name="$1"; | |
if [ "$env_name" = "" ]; then | |
lsvirtualenv -b; | |
return 1; | |
fi; | |
virtualenvwrapper_verify_workon_home || return 1; | |
virtualenvwrapper_verify_workon_environment $env_name || return 1; | |
activate="$WORKON_HOME/$env_name/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate"; | |
if [ ! -f "$activate" ]; then | |
echo "ERROR: Environment '$WORKON_HOME/$env_name' does not contain an activate script." 1>&2; | |
return 1; | |
fi; | |
type deactivate > /dev/null 2>&1; | |
if [ $? -eq 0 ]; then | |
deactivate; | |
unset -f deactivate > /dev/null 2>&1; | |
fi; | |
virtualenvwrapper_run_hook "pre_activate" "$env_name"; | |
source "$activate"; | |
virtualenvwrapper_original_deactivate=`typeset -f deactivate | sed 's/deactivate/virtualenv_deactivate/g'`; | |
eval "$virtualenvwrapper_original_deactivate"; | |
unset -f deactivate > /dev/null 2>&1; | |
eval 'deactivate () { | |
typeset env_postdeactivate_hook | |
typeset old_env | |
# Call the local hook before the global so we can undo | |
# any settings made by the local postactivate first. | |
virtualenvwrapper_run_hook "pre_deactivate" | |
env_postdeactivate_hook="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate" | |
old_env=$(basename "$VIRTUAL_ENV") | |
# Call the original function. | |
virtualenv_deactivate $1 | |
virtualenvwrapper_run_hook "post_deactivate" "$old_env" | |
if [ ! "$1" = "nondestructive" ] | |
then | |
# Remove this function | |
unset -f virtualenv_deactivate >/dev/null 2>&1 | |
unset -f deactivate >/dev/null 2>&1 | |
fi | |
}'; | |
virtualenvwrapper_run_hook "post_activate"; | |
return 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project | |
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh | |
TERM_PROGRAM=iTerm.app | |
TERM=screen-256color | |
SHELL=/bin/bash | |
TMPDIR=/var/folders/49/30k39lp17mz4_sdyz_0wcdb00000gn/T/ | |
Apple_PubSub_Socket_Render=/tmp/launch-TMJdla/Render | |
USER=bulkan | |
SSH_AUTH_SOCK=/tmp/launch-3tw6z9/Listeners | |
__CF_USER_TEXT_ENCODING=0x1F5:0:0 | |
WORKON_HOME=/Users/bulkan/src/python | |
PROJECT_HOME=/Users/bulkan/src/python | |
__CHECKFIX1436934=1 | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/local/heroku/bin:/Users/bulkan/.bin:/Users/bulkan/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/Users/bulkan/src/go/bin | |
VIRTUALENVWRAPPER_HOOK_DIR=/Users/bulkan/src/python | |
PWD=/Users/bulkan | |
LANG=en_AU.UTF-8 | |
ITERM_PROFILE=Solarized Dark | |
SHLVL=1 | |
COLORFGBG=7;0 | |
HOME=/Users/bulkan | |
ITERM_SESSION_ID=w0t2p0 | |
LOGNAME=bulkan | |
GOPATH=/Users/bulkan/src/go | |
PROMPT_COMMAND=PS1="\[\033[36m\]$(_venv)\[\033[0m\][\[\033[0m\]\w]\[\033[36m\]$(parse_git_branch):\[\033[0m\] " | |
_=/usr/bin/env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment