?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
PK s¢
[µÿw÷ ÷ scl.bashnu W+A„¶ # main function bound to scl command
_scl()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-l --list"
# handle options
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
local collections=($(find /etc/scl/prefixes -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | sort -u))
# handle scriptlets; the first parameter must be a scriptlet if it is not an option
if ((COMP_CWORD == 1)); then
# get array of scriptlets found throughout collections
local scriptlets=()
for col in ${collections[@]}; do
local prefix=`cat /etc/scl/prefixes/$col`
scriptlets+=($(find $prefix/$col/* -maxdepth 1 -type f -exec basename {} \; | sort -u))
done
scriptlets_str=`echo ${scriptlets[@]} | sed 's/ /\n/g'| sort -u`
COMPREPLY=( $(compgen -W "$scriptlets_str register deregister" -- ${cur}) )
return 0
fi
# handle commands; does not handle commands without single or double quotes
if [[ ${cur} == \'* || ${cur} == \"* ]] ; then
# it is a command do not reply with anything
return 0
fi
# handle collections; if it is not an option or a command, it must be a collection
if [ $prev == "register" ]; then
compopt -o nospace
COMPREPLY=( $(compgen -A directory ${cur}) )
return 0
fi
COMPREPLY=( $(compgen -W "${collections[*]}" -- ${cur}) )
return 0
}
# bind the scl command to the _scl function for completion
complete -F _scl scl
PK s¢
[Œluá° á° gitnu W+A„¶ # bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
# *) .git/remotes file names
# *) git 'subcommands'
# *) tree paths within 'ref:path/to/file' expressions
# *) common --long-options
#
# To use these routines:
#
# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
# 2) Added the following line to your .bashrc:
# source ~/.git-completion.sh
#
# 3) Consider changing your PS1 to also show the current branch:
# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
#
# The argument to __git_ps1 will be displayed only if you
# are currently in a git repository. The %s token will be
# the name of the current branch.
#
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
# value, unstaged (*) and staged (+) changes will be shown next
# to the branch name. You can configure this per-repository
# with the bash.showDirtyState variable, which defaults to true
# once GIT_PS1_SHOWDIRTYSTATE is enabled.
#
# You can also see if currently something is stashed, by setting
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
# then a '$' will be shown next to the branch name.
#
# If you would like to see if there're untracked files, then you can
# set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're
# untracked files, then a '%' will be shown next to the branch name.
#
# To submit patches:
#
# *) Read Documentation/SubmittingPatches
# *) Send all patches to the current maintainer:
#
# "Shawn O. Pearce"
#
# *) Always CC the Git mailing list:
#
# git@vger.kernel.org
#
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"
elif [ -d .git ]; then
echo .git
else
git rev-parse --git-dir 2>/dev/null
fi
elif [ -d "$1/.git" ]; then
echo "$1/.git"
else
echo "$1"
fi
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
__git_ps1 ()
{
local g="$(__gitdir)"
if [ -n "$g" ]; then
local r
local b
if [ -f "$g/rebase-merge/interactive" ]; then
r="|REBASE-i"
b="$(cat "$g/rebase-merge/head-name")"
elif [ -d "$g/rebase-merge" ]; then
r="|REBASE-m"
b="$(cat "$g/rebase-merge/head-name")"
else
if [ -d "$g/rebase-apply" ]; then
if [ -f "$g/rebase-apply/rebasing" ]; then
r="|REBASE"
elif [ -f "$g/rebase-apply/applying" ]; then
r="|AM"
else
r="|AM/REBASE"
fi
elif [ -f "$g/MERGE_HEAD" ]; then
r="|MERGING"
elif [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING"
fi
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
b="$(
case "${GIT_PS1_DESCRIBE_STYLE-}" in
(contains)
git describe --contains HEAD ;;
(branch)
git describe --contains --all HEAD ;;
(describe)
git describe HEAD ;;
(* | default)
git describe --exact-match HEAD ;;
esac 2>/dev/null)" ||
b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
b="unknown"
b="($b)"
}
fi
local w
local i
local s
local u
local c
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
c="BARE:"
else
b="GIT_DIR!"
fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
git diff --no-ext-diff --quiet --exit-code || w="*"
if git rev-parse --quiet --verify HEAD >/dev/null; then
git diff-index --cached --quiet HEAD -- || i="+"
else
i="#"
fi
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
fi
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
u="%"
fi
fi
fi
local f="$w$i$s$u"
printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r"
fi
}
# __gitcomp_1 requires 2 arguments
__gitcomp_1 ()
{
local c IFS=' '$'\t'$'\n'
for c in $1; do
case "$c$2" in
--*=*) printf %s$'\n' "$c$2" ;;
*.) printf %s$'\n' "$c$2" ;;
*) printf %s$'\n' "$c$2 " ;;
esac
done
}
# __gitcomp accepts 1, 2, 3, or 4 arguments
# generates completion reply with compgen
__gitcomp ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
if [ $# -gt 2 ]; then
cur="$3"
fi
case "$cur" in
--*=)
COMPREPLY=()
;;
*)
local IFS=$'\n'
COMPREPLY=($(compgen -P "${2-}" \
-W "$(__gitcomp_1 "${1-}" "${4-}")" \
-- "$cur"))
;;
esac
}
# __git_heads accepts 0 or 1 arguments (to pass to __gitdir)
__git_heads ()
{
local cmd i is_hash=y dir="$(__gitdir "${1-}")"
if [ -d "$dir" ]; then
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
refs/heads
return
fi
for i in $(git ls-remote "${1-}" 2>/dev/null); do
case "$is_hash,$i" in
y,*) is_hash=n ;;
n,*^{}) is_hash=y ;;
n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
n,*) is_hash=y; echo "$i" ;;
esac
done
}
# __git_tags accepts 0 or 1 arguments (to pass to __gitdir)
__git_tags ()
{
local cmd i is_hash=y dir="$(__gitdir "${1-}")"
if [ -d "$dir" ]; then
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
refs/tags
return
fi
for i in $(git ls-remote "${1-}" 2>/dev/null); do
case "$is_hash,$i" in
y,*) is_hash=n ;;
n,*^{}) is_hash=y ;;
n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
n,*) is_hash=y; echo "$i" ;;
esac
done
}
# __git_refs accepts 0 or 1 arguments (to pass to __gitdir)
__git_refs ()
{
local i is_hash=y dir="$(__gitdir "${1-}")"
local cur="${COMP_WORDS[COMP_CWORD]}" format refs
if [ -d "$dir" ]; then
case "$cur" in
refs|refs/*)
format="refname"
refs="${cur%/*}"
;;
*)
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
return
fi
for i in $(git ls-remote "$dir" 2>/dev/null); do
case "$is_hash,$i" in
y,*) is_hash=n ;;
n,*^{}) is_hash=y ;;
n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
n,*) is_hash=y; echo "$i" ;;
esac
done
}
# __git_refs2 requires 1 argument (to pass to __git_refs)
__git_refs2 ()
{
local i
for i in $(__git_refs "$1"); do
echo "$i:$i"
done
}
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
local cmd i is_hash=y
for i in $(git ls-remote "$1" 2>/dev/null); do
case "$is_hash,$i" in
n,refs/heads/*)
is_hash=y
echo "$i:refs/remotes/$1/${i#refs/heads/}"
;;
y,*) is_hash=n ;;
n,*^{}) is_hash=y ;;
n,refs/tags/*) is_hash=y;;
n,*) is_hash=y; ;;
esac
done
}
__git_remotes ()
{
local i ngoff IFS=$'\n' d="$(__gitdir)"
shopt -q nullglob || ngoff=1
shopt -s nullglob
for i in "$d/remotes"/*; do
echo ${i#$d/remotes/}
done
[ "$ngoff" ] && shopt -u nullglob
for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
i="${i#remote.}"
echo "${i/.url*/}"
done
}
__git_list_merge_strategies ()
{
git merge -s help 2>&1 |
sed -n -e '/[Aa]vailable strategies are: /,/^$/{
s/\.$//
s/.*://
s/^[ ]*//
s/[ ]*$//
p
}'
}
__git_merge_strategies=
# 'git merge -s help' (and thus detection of the merge strategy
# list) fails, unfortunately, if run outside of any git working
# tree. __git_merge_strategies is set to the empty string in
# that case, and the detection will be repeated the next time it
# is needed.
__git_compute_merge_strategies ()
{
: ${__git_merge_strategies:=$(__git_list_merge_strategies)}
}
__git_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
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) pfx="$ref:$pfx" ;;
esac
local IFS=$'\n'
COMPREPLY=($(compgen -P "$pfx" \
-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
| sed '/^100... blob /{
s,^.* ,,
s,$, ,
}
/^120000 blob /{
s,^.* ,,
s,$, ,
}
/^040000 tree /{
s,^.* ,,
s,$,/,
}
s/^.* //')" \
-- "$cur"))
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
__git_complete_revlist ()
{
local pfx cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
*...*)
pfx="${cur%...*}..."
cur="${cur#*...}"
__gitcomp "$(__git_refs)" "$pfx" "$cur"
;;
*..*)
pfx="${cur%..*}.."
cur="${cur#*..}"
__gitcomp "$(__git_refs)" "$pfx" "$cur"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
__git_complete_remote_or_refspec ()
{
local cmd="${COMP_WORDS[1]}"
local cur="${COMP_WORDS[COMP_CWORD]}"
local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
case "$i" in
--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
--all)
case "$cmd" in
push) no_complete_refspec=1 ;;
fetch)
COMPREPLY=()
return
;;
*) ;;
esac
;;
-*) ;;
*) remote="$i"; break ;;
esac
c=$((++c))
done
if [ -z "$remote" ]; then
__gitcomp "$(__git_remotes)"
return
fi
if [ $no_complete_refspec = 1 ]; then
COMPREPLY=()
return
fi
[ "$remote" = "." ] && remote=
case "$cur" in
*:*)
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) pfx="${cur%%:*}:" ;;
esac
cur="${cur#*:}"
lhs=0
;;
+*)
pfx="+"
cur="${cur#+}"
;;
esac
case "$cmd" in
fetch)
if [ $lhs = 1 ]; then
__gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur"
else
__gitcomp "$(__git_refs)" "$pfx" "$cur"
fi
;;
pull)
if [ $lhs = 1 ]; then
__gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
else
__gitcomp "$(__git_refs)" "$pfx" "$cur"
fi
;;
push)
if [ $lhs = 1 ]; then
__gitcomp "$(__git_refs)" "$pfx" "$cur"
else
__gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
fi
;;
esac
}
__git_complete_strategy ()
{
__git_compute_merge_strategies
case "${COMP_WORDS[COMP_CWORD-1]}" in
-s|--strategy)
__gitcomp "$__git_merge_strategies"
return 0
esac
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--strategy=*)
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
return 0
;;
esac
return 1
}
__git_list_all_commands ()
{
local i IFS=" "$'\n'
for i in $(git help -a|egrep '^ [a-zA-Z0-9]')
do
case $i in
*--*) : helper pattern;;
*) echo $i;;
esac
done
}
__git_all_commands=
__git_compute_all_commands ()
{
: ${__git_all_commands:=$(__git_list_all_commands)}
}
__git_list_porcelain_commands ()
{
local i IFS=" "$'\n'
__git_compute_all_commands
for i in "help" $__git_all_commands
do
case $i in
*--*) : helper pattern;;
applymbox) : ask gittus;;
applypatch) : ask gittus;;
archimport) : import;;
cat-file) : plumbing;;
check-attr) : plumbing;;
check-ref-format) : plumbing;;
checkout-index) : plumbing;;
commit-tree) : plumbing;;
count-objects) : infrequent;;
cvsexportcommit) : export;;
cvsimport) : import;;
cvsserver) : daemon;;
daemon) : daemon;;
diff-files) : plumbing;;
diff-index) : plumbing;;
diff-tree) : plumbing;;
fast-import) : import;;
fast-export) : export;;
fsck-objects) : plumbing;;
fetch-pack) : plumbing;;
fmt-merge-msg) : plumbing;;
for-each-ref) : plumbing;;
hash-object) : plumbing;;
http-*) : transport;;
index-pack) : plumbing;;
init-db) : deprecated;;
local-fetch) : plumbing;;
lost-found) : infrequent;;
ls-files) : plumbing;;
ls-remote) : plumbing;;
ls-tree) : plumbing;;
mailinfo) : plumbing;;
mailsplit) : plumbing;;
merge-*) : plumbing;;
mktree) : plumbing;;
mktag) : plumbing;;
pack-objects) : plumbing;;
pack-redundant) : plumbing;;
pack-refs) : plumbing;;
parse-remote) : plumbing;;
patch-id) : plumbing;;
peek-remote) : plumbing;;
prune) : plumbing;;
prune-packed) : plumbing;;
quiltimport) : import;;
read-tree) : plumbing;;
receive-pack) : plumbing;;
reflog) : plumbing;;
remote-*) : transport;;
repo-config) : deprecated;;
rerere) : plumbing;;
rev-list) : plumbing;;
rev-parse) : plumbing;;
runstatus) : plumbing;;
sh-setup) : internal;;
shell) : daemon;;
show-ref) : plumbing;;
send-pack) : plumbing;;
show-index) : plumbing;;
ssh-*) : transport;;
stripspace) : plumbing;;
symbolic-ref) : plumbing;;
tar-tree) : deprecated;;
unpack-file) : plumbing;;
unpack-objects) : plumbing;;
update-index) : plumbing;;
update-ref) : plumbing;;
update-server-info) : daemon;;
upload-archive) : plumbing;;
upload-pack) : plumbing;;
write-tree) : plumbing;;
var) : infrequent;;
verify-pack) : infrequent;;
verify-tag) : plumbing;;
*) echo $i;;
esac
done
}
__git_porcelain_commands=
__git_compute_porcelain_commands ()
{
__git_compute_all_commands
: ${__git_porcelain_commands:=$(__git_list_porcelain_commands)}
}
__git_aliases ()
{
local i IFS=$'\n'
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_aliased_command requires 1 argument
__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_find_on_cmdline requires 1 argument
__git_find_on_cmdline ()
{
local word subcommand c=1
while [ $c -lt $COMP_CWORD ]; do
word="${COMP_WORDS[c]}"
for subcommand in $1; do
if [ "$subcommand" = "$word" ]; then
echo "$subcommand"
return
fi
done
c=$((++c))
done
}
__git_has_doubledash ()
{
local c=1
while [ $c -lt $COMP_CWORD ]; do
if [ "--" = "${COMP_WORDS[c]}" ]; then
return 0
fi
c=$((++c))
done
return 1
}
__git_whitespacelist="nowarn warn error error-all fix"
_git_am ()
{
local cur="${COMP_WORDS[COMP_CWORD]}" 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
COMPREPLY=()
}
_git_apply ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--whitespace=*)
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
return
;;
--*)
__gitcomp "
--stat --numstat --summary --check --index
--cached --index-info --reverse --reject --unidiff-zero
--apply --no-add --exclude=
--ignore-whitespace --ignore-space-change
--whitespace= --inaccurate-eof --verbose
"
return
esac
COMPREPLY=()
}
_git_add ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--interactive --refresh --patch --update --dry-run
--ignore-errors --intent-to-add
"
return
esac
COMPREPLY=()
}
_git_archive ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--format=*)
__gitcomp "$(git archive --list)" "" "${cur##--format=}"
return
;;
--remote=*)
__gitcomp "$(__git_remotes)" "" "${cur##--remote=}"
return
;;
--*)
__gitcomp "
--format= --list --verbose
--prefix= --remote= --exec=
"
return
;;
esac
__git_complete_file
}
_git_bisect ()
{
__git_has_doubledash && return
local subcommands="start bad good skip reset visualize replay log run"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
bad|good|reset|skip)
__gitcomp "$(__git_refs)"
;;
*)
COMPREPLY=()
;;
esac
}
_git_branch ()
{
local i c=1 only_local_ref="n" has_r="n"
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
case "$i" in
-d|-m) only_local_ref="y" ;;
-r) has_r="y" ;;
esac
c=$((++c))
done
case "${COMP_WORDS[COMP_CWORD]}" in
--*)
__gitcomp "
--color --no-color --verbose --abbrev= --no-abbrev
--track --no-track --contains --merged --no-merged
"
;;
*)
if [ $only_local_ref = "y" -a $has_r = "n" ]; then
__gitcomp "$(__git_heads)"
else
__gitcomp "$(__git_refs)"
fi
;;
esac
}
_git_bundle ()
{
local cmd="${COMP_WORDS[2]}"
case "$COMP_CWORD" in
2)
__gitcomp "create list-heads verify unbundle"
;;
3)
# looking for a file
;;
*)
case "$cmd" in
create)
__git_complete_revlist
;;
esac
;;
esac
}
_git_checkout ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--conflict=*)
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
;;
--*)
__gitcomp "
--quiet --ours --theirs --track --no-track --merge
--conflict= --patch
"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_cherry ()
{
__gitcomp "$(__git_refs)"
}
_git_cherry_pick ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--edit --no-commit"
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_clean ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--dry-run --quiet"
return
;;
esac
COMPREPLY=()
}
_git_clone ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--local
--no-hardlinks
--shared
--reference
--quiet
--no-checkout
--bare
--mirror
--origin
--upload-pack
--template=
--depth
"
return
;;
esac
COMPREPLY=()
}
_git_commit ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--cleanup=*)
__gitcomp "default strip verbatim whitespace
" "" "${cur##--cleanup=}"
return
;;
--reuse-message=*)
__gitcomp "$(__git_refs)" "" "${cur##--reuse-message=}"
return
;;
--reedit-message=*)
__gitcomp "$(__git_refs)" "" "${cur##--reedit-message=}"
return
;;
--untracked-files=*)
__gitcomp "all no normal" "" "${cur##--untracked-files=}"
return
;;
--*)
__gitcomp "
--all --author= --signoff --verify --no-verify
--edit --amend --include --only --interactive
--dry-run --reuse-message= --reedit-message=
--reset-author --file= --message= --template=
--cleanup= --untracked-files --untracked-files=
--verbose --quiet
"
return
esac
COMPREPLY=()
}
_git_describe ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--all --tags --contains --abbrev= --candidates=
--exact-match --debug --long --match --always
"
return
esac
__gitcomp "$(__git_refs)"
}
__git_diff_common_options="--stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
--full-index --binary --abbrev --diff-filter=
--find-copies-harder
--text --ignore-space-at-eol --ignore-space-change
--ignore-all-space --exit-code --quiet --ext-diff
--no-ext-diff
--no-prefix --src-prefix= --dst-prefix=
--inter-hunk-context=
--patience
--raw
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
"
_git_diff ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs
$__git_diff_common_options
"
return
;;
esac
__git_complete_file
}
__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
tkdiff vimdiff gvimdiff xxdiff araxis p4merge
"
_git_difftool ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--tool=*)
__gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"
return
;;
--*)
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs
--no-renames --diff-filter= --find-copies-harder
--relative --ignore-submodules
--tool="
return
;;
esac
__git_complete_file
}
__git_fetch_options="
--quiet --verbose --append --upload-pack --force --keep --depth=
--tags --no-tags --all --prune --dry-run
"
_git_fetch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "$__git_fetch_options"
return
;;
esac
__git_complete_remote_or_refspec
}
_git_format_patch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--thread=*)
__gitcomp "
deep shallow
" "" "${cur##--thread=}"
return
;;
--*)
__gitcomp "
--stdout --attach --no-attach --thread --thread=
--output-directory
--numbered --start-number
--numbered-files
--keep-subject
--signoff
--in-reply-to= --cc=
--full-index --binary
--not --all
--cover-letter
--no-prefix --src-prefix= --dst-prefix=
--inline --suffix= --ignore-if-in-upstream
--subject-prefix=
"
return
;;
esac
__git_complete_revlist
}
_git_fsck ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--tags --root --unreachable --cache --no-reflogs --full
--strict --verbose --lost-found
"
return
;;
esac
COMPREPLY=()
}
_git_gc ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--prune --aggressive"
return
;;
esac
COMPREPLY=()
}
_git_gitk ()
{
_gitk
}
_git_grep ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--cached
--text --ignore-case --word-regexp --invert-match
--full-name
--extended-regexp --basic-regexp --fixed-strings
--files-with-matches --name-only
--files-without-match
--max-depth
--count
--and --or --not --all-match
"
return
;;
esac
__gitcomp "$(__git_refs)"
}
_git_help ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--all --info --man --web"
return
;;
esac
__git_compute_all_commands
__gitcomp "$__git_all_commands
attributes cli core-tutorial cvs-migration
diffcore gitk glossary hooks ignore modules
repository-layout tutorial tutorial-2
workflows
"
}
_git_init ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--shared=*)
__gitcomp "
false true umask group all world everybody
" "" "${cur##--shared=}"
return
;;
--*)
__gitcomp "--quiet --bare --template= --shared --shared="
return
;;
esac
COMPREPLY=()
}
_git_ls_files ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--cached --deleted --modified --others --ignored
--stage --directory --no-empty-directory --unmerged
--killed --exclude= --exclude-from=
--exclude-per-directory= --exclude-standard
--error-unmatch --with-tree= --full-name
--abbrev --ignored --exclude-per-directory
"
return
;;
esac
COMPREPLY=()
}
_git_ls_remote ()
{
__gitcomp "$(__git_remotes)"
}
_git_ls_tree ()
{
__git_complete_file
}
# Options that go well for log, shortlog and gitk
__git_log_common_options="
--not --all
--branches --tags --remotes
--first-parent --merges --no-merges
--max-count=
--max-age= --since= --after=
--min-age= --until= --before=
"
# Options that go well for log and gitk (not shortlog)
__git_log_gitk_options="
--dense --sparse --full-history
--simplify-merges --simplify-by-decoration
--left-right
"
# Options that go well for log and shortlog (not gitk)
__git_log_shortlog_options="
--author= --committer= --grep=
--all-match
"
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
_git_log ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
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=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
return
;;
--format=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--format=}"
return
;;
--date=*)
__gitcomp "$__git_log_date_formats" "" "${cur##--date=}"
return
;;
--decorate=*)
__gitcomp "long short" "" "${cur##--decorate=}"
return
;;
--*)
__gitcomp "
$__git_log_common_options
$__git_log_shortlog_options
$__git_log_gitk_options
--root --topo-order --date-order --reverse
--follow --full-diff
--abbrev-commit --abbrev=
--relative-date --date=
--pretty= --format= --oneline
--cherry-pick
--graph
--decorate --decorate=
--walk-reflogs
--parents --children
$merge
$__git_diff_common_options
--pickaxe-all --pickaxe-regex
"
return
;;
esac
__git_complete_revlist
}
__git_merge_options="
--no-commit --no-stat --log --no-log --squash --strategy
--commit --stat --no-squash --ff --no-ff --ff-only
"
_git_merge ()
{
__git_complete_strategy && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "$__git_merge_options"
return
esac
__gitcomp "$(__git_refs)"
}
_git_mergetool ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--tool=*)
__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
return
;;
--*)
__gitcomp "--tool="
return
;;
esac
COMPREPLY=()
}
_git_merge_base ()
{
__gitcomp "$(__git_refs)"
}
_git_mv ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--dry-run"
return
;;
esac
COMPREPLY=()
}
_git_name_rev ()
{
__gitcomp "--tags --all --stdin"
}
_git_notes ()
{
local subcommands="edit show"
if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
__gitcomp "$subcommands"
return
fi
case "${COMP_WORDS[COMP_CWORD-1]}" in
-m|-F)
COMPREPLY=()
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_pull ()
{
__git_complete_strategy && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
--rebase --no-rebase
$__git_merge_options
$__git_fetch_options
"
return
;;
esac
__git_complete_remote_or_refspec
}
_git_push ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "${COMP_WORDS[COMP_CWORD-1]}" in
--repo)
__gitcomp "$(__git_remotes)"
return
esac
case "$cur" in
--repo=*)
__gitcomp "$(__git_remotes)" "" "${cur##--repo=}"
return
;;
--*)
__gitcomp "
--all --mirror --tags --dry-run --force --verbose
--receive-pack= --repo=
"
return
;;
esac
__git_complete_remote_or_refspec
}
_git_rebase ()
{
local cur="${COMP_WORDS[COMP_CWORD]}" 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
"
return
esac
__gitcomp "$(__git_refs)"
}
__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
_git_send_email ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--confirm=*)
__gitcomp "
$__git_send_email_confirm_options
" "" "${cur##--confirm=}"
return
;;
--suppress-cc=*)
__gitcomp "
$__git_send_email_suppresscc_options
" "" "${cur##--suppress-cc=}"
return
;;
--smtp-encryption=*)
__gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"
return
;;
--*)
__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
--compose --confirm= --dry-run --envelope-sender
--from --identity
--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
--no-suppress-from --no-thread --quiet
--signed-off-by-cc --smtp-pass --smtp-server
--smtp-server-port --smtp-encryption= --smtp-user
--subject --suppress-cc= --suppress-from --thread --to
--validate --no-validate"
return
;;
esac
COMPREPLY=()
}
_git_stage ()
{
_git_add
}
__git_config_get_set_variables ()
{
local prevword word config_file= c=$COMP_CWORD
while [ $c -gt 1 ]; do
word="${COMP_WORDS[c]}"
case "$word" in
--global|--system|--file=*)
config_file="$word"
break
;;
-f|--file)
config_file="$word $prevword"
break
;;
esac
prevword=$word
c=$((--c))
done
git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null |
while read line
do
case "$line" in
*.*=*)
echo "${line/=*/}"
;;
esac
done
}
_git_config ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prv="${COMP_WORDS[COMP_CWORD-1]}"
case "$prv" in
branch.*.remote)
__gitcomp "$(__git_remotes)"
return
;;
branch.*.merge)
__gitcomp "$(__git_refs)"
return
;;
remote.*.fetch)
local remote="${prv#remote.}"
remote="${remote%.fetch}"
__gitcomp "$(__git_refs_remotes "$remote")"
return
;;
remote.*.push)
local remote="${prv#remote.}"
remote="${remote%.push}"
__gitcomp "$(git --git-dir="$(__gitdir)" \
for-each-ref --format='%(refname):%(refname)' \
refs/heads)"
return
;;
pull.twohead|pull.octopus)
__git_compute_merge_strategies
__gitcomp "$__git_merge_strategies"
return
;;
color.branch|color.diff|color.interactive|\
color.showbranch|color.status|color.ui)
__gitcomp "always never auto"
return
;;
color.pager)
__gitcomp "false true"
return
;;
color.*.*)
__gitcomp "
normal black red green yellow blue magenta cyan white
bold dim ul blink reverse
"
return
;;
help.format)
__gitcomp "man info web html"
return
;;
log.date)
__gitcomp "$__git_log_date_formats"
return
;;
sendemail.aliasesfiletype)
__gitcomp "mutt mailrc pine elm gnus"
return
;;
sendemail.confirm)
__gitcomp "$__git_send_email_confirm_options"
return
;;
sendemail.suppresscc)
__gitcomp "$__git_send_email_suppresscc_options"
return
;;
--get|--get-all|--unset|--unset-all)
__gitcomp "$(__git_config_get_set_variables)"
return
;;
*.*)
COMPREPLY=()
return
;;
esac
case "$cur" in
--*)
__gitcomp "
--global --system --file=
--list --replace-all
--get --get-all --get-regexp
--add --unset --unset-all
--remove-section --rename-section
"
return
;;
branch.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "remote merge mergeoptions rebase" "$pfx" "$cur"
return
;;
branch.*)
local pfx="${cur%.*}."
cur="${cur#*.}"
__gitcomp "$(__git_heads)" "$pfx" "$cur" "."
return
;;
guitool.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "
argprompt cmd confirm needsfile noconsole norescan
prompt revprompt revunmerged title
" "$pfx" "$cur"
return
;;
difftool.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "cmd path" "$pfx" "$cur"
return
;;
man.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "cmd path" "$pfx" "$cur"
return
;;
mergetool.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "cmd path trustExitCode" "$pfx" "$cur"
return
;;
pager.*)
local pfx="${cur%.*}."
cur="${cur#*.}"
__git_compute_all_commands
__gitcomp "$__git_all_commands" "$pfx" "$cur"
return
;;
remote.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "
url proxy fetch push mirror skipDefaultUpdate
receivepack uploadpack tagopt pushurl
" "$pfx" "$cur"
return
;;
remote.*)
local pfx="${cur%.*}."
cur="${cur#*.}"
__gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
return
;;
url.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur"
return
;;
esac
__gitcomp "
add.ignore-errors
alias.
apply.ignorewhitespace
apply.whitespace
branch.autosetupmerge
branch.autosetuprebase
clean.requireForce
color.branch
color.branch.current
color.branch.local
color.branch.plain
color.branch.remote
color.diff
color.diff.commit
color.diff.frag
color.diff.meta
color.diff.new
color.diff.old
color.diff.plain
color.diff.whitespace
color.grep
color.grep.external
color.grep.match
color.interactive
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.template
core.autocrlf
core.bare
core.compression
core.createObject
core.deltaBaseCacheLimit
core.editor
core.excludesfile
core.fileMode
core.fsyncobjectfiles
core.gitProxy
core.ignoreCygwinFSTricks
core.ignoreStat
core.logAllRefUpdates
core.loosecompression
core.packedGitLimit
core.packedGitWindowSize
core.pager
core.preferSymlinkRefs
core.preloadindex
core.quotepath
core.repositoryFormatVersion
core.safecrlf
core.sharedRepository
core.symlinks
core.trustctime
core.warnAmbiguousRefs
core.whitespace
core.worktree
diff.autorefreshindex
diff.external
diff.mnemonicprefix
diff.renameLimit
diff.renameLimit.
diff.renames
diff.suppressBlankEmpty
diff.tool
diff.wordRegex
difftool.
difftool.prompt
fetch.unpackLimit
format.attach
format.cc
format.headers
format.numbered
format.pretty
format.signoff
format.subjectprefix
format.suffix
format.thread
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.noEPSV
http.proxy
http.sslCAInfo
http.sslCAPath
http.sslCert
http.sslKey
http.sslVerify
i18n.commitEncoding
i18n.logOutputEncoding
imap.folder
imap.host
imap.pass
imap.port
imap.preformattedHTML
imap.sslverify
imap.tunnel
imap.user
instaweb.browser
instaweb.httpd
instaweb.local
instaweb.modulepath
instaweb.port
interactive.singlekey
log.date
log.showroot
mailmap.file
man.
man.viewer
merge.conflictstyle
merge.log
merge.renameLimit
merge.stat
merge.tool
merge.verbosity
mergetool.
mergetool.keepBackup
mergetool.prompt
pack.compression
pack.deltaCacheLimit
pack.deltaCacheSize
pack.depth
pack.indexVersion
pack.packSizeLimit
pack.threads
pack.window
pack.windowMemory
pager.
pull.octopus
pull.twohead
push.default
rebase.stat
receive.denyCurrentBranch
receive.denyDeletes
receive.denyNonFastForwards
receive.fsckObjects
receive.unpackLimit
repack.usedeltabaseoffset
rerere.autoupdate
rerere.enabled
sendemail.aliasesfile
sendemail.aliasesfiletype
sendemail.bcc
sendemail.cc
sendemail.cccmd
sendemail.chainreplyto
sendemail.confirm
sendemail.envelopesender
sendemail.multiedit
sendemail.signedoffbycc
sendemail.smtpencryption
sendemail.smtppass
sendemail.smtpserver
sendemail.smtpserverport
sendemail.smtpuser
sendemail.suppresscc
sendemail.suppressfrom
sendemail.thread
sendemail.to
sendemail.validate
showbranch.default
status.relativePaths
status.showUntrackedFiles
tar.umask
transfer.unpackLimit
url.
user.email
user.name
user.signingkey
web.browser
branch. remote.
"
}
_git_remote ()
{
local subcommands="add rename rm show prune update set-head"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
rename|rm|show|prune)
__gitcomp "$(__git_remotes)"
;;
update)
local i c='' IFS=$'\n'
for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do
i="${i#remotes.}"
c="$c ${i/ */}"
done
__gitcomp "$c"
;;
*)
COMPREPLY=()
;;
esac
}
_git_replace ()
{
__gitcomp "$(__git_refs)"
}
_git_reset ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--merge --mixed --hard --soft --patch"
return
;;
esac
__gitcomp "$(__git_refs)"
}
_git_revert ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--edit --mainline --no-edit --no-commit --signoff"
return
;;
esac
__gitcomp "$(__git_refs)"
}
_git_rm ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
return
;;
esac
COMPREPLY=()
}
_git_shortlog ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "
$__git_log_common_options
$__git_log_shortlog_options
--numbered --summary
"
return
;;
esac
__git_complete_revlist
}
_git_show ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--pretty=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
return
;;
--format=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--format=}"
return
;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --oneline
$__git_diff_common_options
"
return
;;
esac
__git_complete_file
}
_git_show_branch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
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_stash ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local save_opts='--keep-index --no-keep-index --quiet --patch'
local subcommands='save list show apply clear drop pop create branch'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
case "$cur" in
--*)
__gitcomp "$save_opts"
;;
*)
if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
__gitcomp "$subcommands"
else
COMPREPLY=()
fi
;;
esac
else
case "$subcommand,$cur" in
save,--*)
__gitcomp "$save_opts"
;;
apply,--*|pop,--*)
__gitcomp "--index --quiet"
;;
show,--*|drop,--*|branch,--*)
COMPREPLY=()
;;
show,*|apply,*|drop,*|pop,*|branch,*)
__gitcomp "$(git --git-dir="$(__gitdir)" stash list \
| sed -n -e 's/:.*//p')"
;;
*)
COMPREPLY=()
;;
esac
fi
}
_git_submodule ()
{
__git_has_doubledash && return
local subcommands="add status init update summary foreach sync"
if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
__gitcomp "--quiet --cached"
;;
*)
__gitcomp "$subcommands"
;;
esac
return
fi
}
_git_svn ()
{
local subcommands="
init fetch clone rebase dcommit log find-rev
set-tree commit-diff info create-ignore propget
proplist show-ignore show-externals branch tag blame
migrate mkdirs reset gc
"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
local remote_opts="--username= --config-dir= --no-auth-cache"
local fc_opts="
--follow-parent --authors-file= --repack=
--no-metadata --use-svm-props --use-svnsync-props
--log-window-size= --no-checkout --quiet
--repack-flags --use-log-author --localtime
--ignore-paths= $remote_opts
"
local init_opts="
--template= --shared= --trunk= --tags=
--branches= --stdlayout --minimize-url
--no-metadata --use-svm-props --use-svnsync-props
--rewrite-root= --prefix= --use-log-author
--add-author-from $remote_opts
"
local cmt_opts="
--edit --rmdir --find-copies-harder --copy-similarity=
"
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$subcommand,$cur" in
fetch,--*)
__gitcomp "--revision= --fetch-all $fc_opts"
;;
clone,--*)
__gitcomp "--revision= $fc_opts $init_opts"
;;
init,--*)
__gitcomp "$init_opts"
;;
dcommit,--*)
__gitcomp "
--merge --strategy= --verbose --dry-run
--fetch-all --no-rebase --commit-url
--revision $cmt_opts $fc_opts
"
;;
set-tree,--*)
__gitcomp "--stdin $cmt_opts $fc_opts"
;;
create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\
show-externals,--*|mkdirs,--*)
__gitcomp "--revision="
;;
log,--*)
__gitcomp "
--limit= --revision= --verbose --incremental
--oneline --show-commit --non-recursive
--authors-file= --color
"
;;
rebase,--*)
__gitcomp "
--merge --verbose --strategy= --local
--fetch-all --dry-run $fc_opts
"
;;
commit-diff,--*)
__gitcomp "--message= --file= --revision= $cmt_opts"
;;
info,--*)
__gitcomp "--url"
;;
branch,--*)
__gitcomp "--dry-run --message --tag"
;;
tag,--*)
__gitcomp "--dry-run --message"
;;
blame,--*)
__gitcomp "--git-format"
;;
migrate,--*)
__gitcomp "
--config-dir= --ignore-paths= --minimize
--no-auth-cache --username=
"
;;
reset,--*)
__gitcomp "--revision= --parent"
;;
*)
COMPREPLY=()
;;
esac
fi
}
_git_tag ()
{
local i c=1 f=0
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
case "$i" in
-d|-v)
__gitcomp "$(__git_tags)"
return
;;
-f)
f=1
;;
esac
c=$((++c))
done
case "${COMP_WORDS[COMP_CWORD-1]}" in
-m|-F)
COMPREPLY=()
;;
-*|tag)
if [ $f = 1 ]; then
__gitcomp "$(__git_tags)"
else
COMPREPLY=()
fi
;;
*)
__gitcomp "$(__git_refs)"
;;
esac
}
_git_whatchanged ()
{
_git_log
}
_git ()
{
local i c=1 command __git_dir
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
case "$i" in
--git-dir=*) __git_dir="${i#--git-dir=}" ;;
--bare) __git_dir="." ;;
--version|-p|--paginate) ;;
--help) command="help"; break ;;
*) command="$i"; break ;;
esac
c=$((++c))
done
if [ -z "$command" ]; then
case "${COMP_WORDS[COMP_CWORD]}" in
--*) __gitcomp "
--paginate
--no-pager
--git-dir=
--bare
--version
--exec-path
--html-path
--work-tree=
--help
"
;;
*) __git_compute_porcelain_commands
__gitcomp "$__git_porcelain_commands $(__git_aliases)" ;;
esac
return
fi
local completion_func="_git_${command//-/_}"
declare -F $completion_func >/dev/null && $completion_func && return
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
completion_func="_git_${expansion//-/_}"
declare -F $completion_func >/dev/null && $completion_func
fi
}
_gitk ()
{
__git_has_doubledash && return
local cur="${COMP_WORDS[COMP_CWORD]}"
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
}
complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \
|| complete -o default -o nospace -F _git git
complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \
|| complete -o default -o nospace -F _gitk gitk
# The following are necessary only for Cygwin, and only are needed
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
|| complete -o default -o nospace -F _git git.exe
fi
PK s¢
[ÿîÐc§ § gdbus-bash-completion.shnu W+A„¶
# Check for bash
[ -z "$BASH_VERSION" ] && return
####################################################################################################
__gdbus() {
local IFS=$'\n'
local cur=`_get_cword :`
local suggestions=$(gdbus complete "${COMP_LINE}" ${COMP_POINT})
COMPREPLY=($(compgen -W "$suggestions" -- "$cur"))
# Remove colon-word prefix from COMPREPLY items
case "$cur" in
*:*)
case "$COMP_WORDBREAKS" in
*:*)
local colon_word=${cur%${cur##*:}}
local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
done
;;
esac
;;
esac
}
####################################################################################################
complete -o nospace -F __gdbus gdbus
PK s¢
[i*ÙÁÿ™ ÿ™
subversionnu W+A„¶ # Programmable completion for the Subversion svn command under bash. Source
# this file (or on some systems add it to ~/.bash_completion and start a new
# shell) and bash's completion mechanism will know all about svn's options!
# Provides completion for the svnadmin, svndumpfilter, svnlook and svnsync
# commands as well. Who wants to read man pages/help text...
# Known to work with bash 3.* with programmable completion and extended
# pattern matching enabled (use 'shopt -s extglob progcomp' to enable
# these if they are not already enabled).
shopt -s extglob
# Tree helper functions which only use bash, to ease readability.
# look for value associated to key from stdin in K/V hash file format
# val=$(_svn_read_hashfile svn:realmstring < some/file)
function _svn_read_hashfile()
{
local tkey=$1 key= val=
while true; do
read tag len
[ $tag = 'END' ] && break
[ $tag != 'K' ] && {
#echo "unexpected tag '$tag' instead of 'K'" >&2
return
}
read -r -n $len key ; read
read tag len
[ $tag != 'V' ] && {
#echo "unexpected tag '$tag' instead of 'V'" >&2
return
}
read -r -n $len val ; read
if [[ $key = $tkey ]] ; then
echo "$val"
return
fi
done
#echo "target key '$tkey' not found" >&2
}
# _svn_grcut shell-regular-expression
# extract filenames from 'svn status' output
function _svn_grcut()
{
local re=$1 line= old_IFS
# fix IFS, so that leading spaces are not ignored by next read.
# (there is a leading space in svn status output if only a prop is changed)
old_IFS="$IFS"
IFS=$'\n'
while read -r line ; do
[[ ! $re || $line == $re ]] && echo "${line/????????/}"
done
IFS="$old_IFS"
}
# extract stuff from svn info output
# _svn_info (URL|Repository Root)
function _svn_info()
{
local what=$1 line=
LANG=C LC_MESSAGES=C svn info --non-interactive 2> /dev/null | \
while read line ; do
[[ $line == *"$what: "* ]] && echo ${line#*: }
done
}
# _svn_lls (dir|file|all) files...
# list svn-managed files from list
# some 'svn status --all-files' would be welcome here?
function _svn_lls()
{
local opt=$1 f=
shift
for f in "$@" ; do
# could try to check in .svn/entries? hmmm...
if [[ $opt == @(dir|all) && -d "$f" ]] ; then
echo "$f/"
elif [[ $opt == @(file|all) ]] ; then
# split f in directory/file names
local dn= fn="$f"
[[ "$f" == */* ]] && dn=${f%\/*}/ fn=${f##*\/}
# ??? this does not work for just added files, because they
# do not have a content reference yet...
[ -f "${dn}.svn/text-base/${fn}.svn-base" ] && echo "$f"
fi
done
}
# This completion guides the command/option order along the one suggested
# by "svn help", although other syntaxes are allowed.
#
# - there is a "real" parser to check for what is available and deduce what
# can be suggested further.
# - the syntax should be coherent with subversion/svn/{cl.h,main.c}
# - although it is not a good practice, mixed options and arguments
# is supported by the completion as it is by the svn command.
# - the completion works in the middle of a line,
# but not really in the middle of an argument or option.
# - property names are completed: see comments about issues related to handling
# ":" within property names although it is a word completion separator.
# - unknown properties are assumed to be simple file properties.
# - --revprop and --revision options are forced to revision properties
# as they are mandatory in this case.
# - argument values are suggested to some other options, eg directory names
# for --config-dir.
# - values for some options can be extended with environment variables:
# SVN_BASH_FILE_PROPS: other properties on files/directories
# SVN_BASH_REV_PROPS: other properties on revisions
# SVN_BASH_ENCODINGS: encodings to be suggested
# SVN_BASH_MIME_TYPE: mime types to be suggested
# SVN_BASH_KEYWORDS: "svn:keywords" substitutions to be suggested
# SVN_BASH_USERNAME: usernames suggested for --username
# SVN_BASH_COMPL_EXT: completion extensions for file arguments, based on the
# current subcommand, so that for instance only modified files are
# suggested for 'revert', only not svn-managed files for 'add', and so on.
# Possible values are:
# - username: guess usernames from ~/.subversion/auth/...
# - svnstatus: use 'svn status' for completion
# - recurse: allow recursion (expensive)
# - externals: recurse into externals (very expensive)
# Both former options are reasonable, but beware that both later options
# may be unadvisable if used on large working copies.
# None of these costly completions are activated by default.
# Argument completion outside a working copy results in an error message.
# Filenames with spaces are not completed properly.
#
# TODO
# - other options?
# - obsolete options could be removed from auto-comp? (e.g. -N)
# - obsolete commands could be removed? (e.g. resolved)
# - completion does not work properly when editing in the middle of the line
# status/previous are those at the end of the line, not at the entry position
_svn()
{
local cur cmds cmdOpts pOpts mOpts rOpts qOpts nOpts optsParam opt
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Possible expansions, without pure-prefix abbreviations such as "up".
cmds='add blame annotate praise cat changelist cl checkout co cleanup'
cmds="$cmds commit ci copy cp delete remove rm diff export help import"
cmds="$cmds info list ls lock log merge mergeinfo mkdir move mv rename"
cmds="$cmds propdel pdel propedit pedit propget pget proplist plist"
cmds="$cmds propset pset resolve resolved revert status switch unlock"
cmds="$cmds update"
# help options have a strange command status...
local helpOpts='--help -h'
# all special options that have a command status
local specOpts="--version $helpOpts"
# options that require a parameter
# note: continued lines must end '|' continuing lines must start '|'
optsParam="-r|--revision|--username|--password|--targets"
optsParam="$optsParam|-x|--extensions|-m|--message|-F|--file"
optsParam="$optsParam|--encoding|--diff-cmd|--diff3-cmd|--editor-cmd"
optsParam="$optsParam|--old|--new|--config-dir|--config-option"
optsParam="$optsParam|--native-eol|-l|--limit|-c|--change"
optsParam="$optsParam|--depth|--set-depth|--with-revprop"
optsParam="$optsParam|--changelist|--accept|--show-revs"
# svn:* and other (env SVN_BASH_*_PROPS) properties
local svnProps revProps allProps psCmds propCmds
# svn and user configured file properties
svnProps="svn:keywords svn:executable svn:needs-lock svn:externals
svn:ignore svn:eol-style svn:mime-type $SVN_BASH_FILE_PROPS"
# svn and user configured revision properties
revProps="svn:author svn:log svn:date $SVN_BASH_REV_PROPS"
# all properties as an array variable
allProps=( $svnProps $revProps )
# subcommands that expect property names
psCmds='propset|pset|ps'
propCmds="$psCmds|propget|pget|pg|propedit|pedit|pe|propdel|pdel|pd"
# Parse arguments and set various variables about what was found.
#
# cmd: the current command if available
# isPropCmd: whether it expects a property name argument
# isPsCmd: whether it also expects a property value argument
# isHelpCmd: whether it is about help
# nExpectArgs: how many arguments are expected by the command
# help: help requested about this command (if cmd=='help')
# prop: property name (if appropriate)
# isRevProp: is it a special revision property
# val: property value (if appropriate, under pset)
# options: all options encountered
# hasRevPropOpt: is --revprop set
# hasRevisionOpt: is --revision set
# hasRelocateOpt: is --relocate set
# hasReintegrateOpt: is --reintegrate set
# acceptOpt: the value of --accept
# nargs: how many arguments were found
# stat: status of parsing at the 'current' word
#
# prev: previous command in the loop
# last: status of last parameter analyzed
# i: index
local cmd= isPropCmd= isPsCmd= isHelpCmd= nExpectArgs= isCur= i=0
local prev= help= prop= val= isRevProp= last='none' nargs=0 stat=
local options= hasRevPropOpt= hasRevisionOpt= hasRelocateOpt=
local acceptOpt= URL= hasReintegrateOpt=
for opt in "${COMP_WORDS[@]}"
do
# get status of current word (from previous iteration)
[[ $isCur ]] && stat=$last
# are we processing the current word
isCur=
[[ $i -eq $COMP_CWORD ]] && isCur=1
let i++
# FIRST must be the "svn" command
[ $last = 'none' ] && { last='first'; continue ; }
# SKIP option arguments
if [[ $prev == @($optsParam) ]] ; then
# record accept value
[[ $prev = '--accept' ]] && acceptOpt=$opt
prev=''
last='skip'
continue ;
fi
# Argh... This looks like a bash bug...
# Redirections are passed to the completion function
# although it is managed by the shell directly...
# It matters because we want to tell the user when no more
# completion is available, so it does not necessary
# fallback to the default case.
if [[ $prev == @(<|>|>>|[12]>|[12]>>) ]] ; then
prev=''
last='skip'
continue ;
fi
prev=$opt
# get the subCoMmanD
if [[ ! $cmd && $opt \
&& ( $opt != -* || $opt == @(${specOpts// /|}) ) ]]
then
cmd=$opt
[[ $cmd == @($propCmds) ]] && isPropCmd=1
[[ $cmd == @($psCmds) ]] && isPsCmd=1
[[ $cmd == @(${helpOpts// /|}) ]] && cmd='help'
[[ $cmd = 'help' ]] && isHelpCmd=1
# HELP about a command asked with an option
if [[ $isHelpCmd && $cmd && $cmd != 'help' && ! $help ]]
then
help=$cmd
cmd='help'
fi
last='cmd'
continue
fi
# HELP about a command
if [[ $isHelpCmd && ! $help && $opt && $opt != -* ]]
then
help=$opt
last='help'
continue
fi
# PROPerty name
if [[ $isPropCmd && ! $prop && $opt && $opt != -* ]]
then
prop=$opt
[[ $prop == @(${revProps// /|}) ]] && isRevProp=1
last='prop'
continue
fi
# property VALue
if [[ $isPsCmd && $prop && ! $val && $opt != -* ]] ;
then
val=$opt
last='val'
continue
fi
if [[ $last != 'onlyarg' ]]
then
# more OPTions
case $opt in
-r|--revision|--revision=*)
hasRevisionOpt=1
;;
--revprop)
hasRevPropOpt=1
# restrict to revision properties!
allProps=( $revProps )
# on revprops, only one URL is expected
nExpectArgs=1
;;
-h|--help)
isHelpCmd=1
;;
-F|--file)
val='-F'
;;
--relocate)
hasRelocateOpt=1
;;
--reintegrate)
hasReintegrateOpt=1
;;
esac
# no more options, only arguments, whatever they look like.
if [[ $opt = '--' && ! $isCur ]] ; then
last='onlyarg'
continue
fi
# options are recorded...
if [[ $opt == -* ]] ; then
# but not the current one!
[[ ! $isCur ]] && options="$options $opt "
last='opt'
continue
fi
else
# onlyarg
let nargs++
continue
fi
# then we have an argument
if [[ $cmd = 'merge' && ! $URL ]] ; then
# fist argument is the source URL for the merge
URL=$opt
fi
last='arg'
let nargs++
done
# end opt option processing...
[[ $stat ]] || stat=$last
# suggest all subcommands, including special help
if [[ ! $cmd || $stat = 'cmd' ]]
then
COMPREPLY=( $( compgen -W "$cmds $specOpts" -- $cur ) )
return 0
fi
# suggest all subcommands
if [[ $stat = 'help' || ( $isHelpCmd && ! $help ) ]]
then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
if [[ $cmd = 'merge' || $cmd = 'mergeinfo' ]]
then
local here=$(_svn_info URL)
# suggest a possible URL for merging
if [[ ! $URL && $stat = 'arg' ]] ; then
# we assume a 'standard' repos with branches and trunk
if [[ "$here" == */branches/* ]] ; then
# we guess that it is a merge from the trunk
COMPREPLY=( $(compgen -W ${here/\/branches\/*/\/trunk} -- $cur ) )
return 0
elif [[ "$here" == */trunk* ]] ; then
# we guess that it is a merge from a branch
COMPREPLY=( $(compgen -W ${here/\/trunk*/\/branches\/} -- $cur ) )
return 0
else
# no se, let us suggest the repository root...
COMPREPLY=( $(compgen -W $(_svn_info Root) -- $cur ) )
return 0
fi
elif [[ $URL == */branches/* && $here == */trunk* && \
! $hasReintegrateOpt && $cur = '' && $stat = 'arg' ]] ; then
# force --reintegrate only if the current word is empty
COMPREPLY=( $(compgen -W '--reintegrate' -- $cur ) )
return 0
fi
fi
# help about option arguments
if [[ $stat = 'skip' ]]
then
local previous=${COMP_WORDS[COMP_CWORD-1]}
local values= dirs= beep= exes=
[[ $previous = '--config-dir' ]] && dirs=1
# external editor, diff, diff3...
[[ $previous = --*-cmd ]] && exes=1
[[ $previous = '--native-eol' ]] && values='LF CR CRLF'
# just to suggest that a number is expected. hummm.
[[ $previous = '--limit' ]] && values='0 1 2 3 4 5 6 7 8 9'
# some special partial help about --revision option.
[[ $previous = '--revision' || $previous = '-r' ]] && \
values='HEAD BASE PREV COMMITTED 0 {'
[[ $previous = '--encoding' ]] && \
values="latin1 utf8 $SVN_BASH_ENCODINGS"
[[ $previous = '--extensions' || $previous = '-x' ]] && \
values="--unified --ignore-space-change \
--ignore-all-space --ignore-eol-style"
[[ $previous = '--depth' ]] && \
values='empty files immediates infinity'
[[ $previous = '--set-depth' ]] && \
values='empty exclude files immediates infinity'
[[ $previous = '--accept' ]] && \
{
# the list is different for 'resolve'
if [[ $cmd = 'resolve' ]] ; then
# from svn help resolve
values='base working mine-full theirs-full'
else # checkout merge switch update
# not implemented yet: mine-conflict theirs-conflict
values='postpone base mine-full theirs-full edit launch'
fi
}
[[ $previous = '--show-revs' ]] && values='merged eligible'
if [[ $previous = '--username' ]] ; then
values="$SVN_BASH_USERNAME"
if [[ $SVN_BASH_COMPL_EXT == *username* ]] ; then
local file=
# digest? others?
for file in ~/.subversion/auth/svn.simple/* ; do
if [ -r $file ] ; then
values="$values $(_svn_read_hashfile username < $file)"
fi
done
fi
[[ ! "$values" ]] && beep=1
fi
# could look at ~/.subversion/ ?
# hmmm... this option should not exist
[[ $previous = '--password' ]] && beep=1
# TODO: provide help about other options such as:
# --old --new --with-revprop
# if the previous option required a parameter, do something
# or fallback on ordinary filename expansion
[[ $values ]] && COMPREPLY=( $( compgen -W "$values" -- $cur ) )
[[ $dirs ]] && COMPREPLY=( $( compgen -o dirnames -- $cur ) )
[[ $exes ]] && COMPREPLY=( $( compgen -c -- $cur ) )
[[ $beep ]] &&
{
# 'no known completion'. hummm.
echo -en "\a"
COMPREPLY=( '' )
}
return 0
fi
# provide allowed property names after property commands
if [[ $isPropCmd && ( ! $prop || $stat = 'prop' ) && $cur != -* ]]
then
#
# Ok, this part is pretty ugly.
#
# The issue is that ":" is a completion word separator,
# which is a good idea for file:// urls but not within
# property names...
#
# The first idea was to remove locally ":" from COMP_WORDBREAKS
# and then put it back in all cases but in property name
# completion. It does not always work. There is a strange bug
# where one may get "svn:svn:xxx" in some unclear cases.
#
# Thus the handling is reprogrammed here...
# The code assumes that property names look like *:*,
# but it also works reasonably well with simple names.
local choices=
if [[ $cur == *:* ]]
then
# only suggest/show possible suffixes
local prefix=${cur%:*} suffix=${cur#*:} c=
for c in ${allProps[@]} ; do
[[ $c == $prefix:* ]] && choices="$choices ${c#*:}"
done
# everything will be appended to the prefix because ':' is
# a separator, so cur is restricted to the suffix part.
cur=$suffix
else
# only one choice is fine
COMPREPLY=( $( compgen -W "${allProps[*]}" -- $cur ) )
[ ${#COMPREPLY[@]} -eq 1 ] && return 0
# no ':' so only suggest prefixes?
local seen= n=0 last= c=
for c in ${allProps[@]%:*} ; do
# do not put the same prefix twice...
if [[ $c == $cur* && ( ! $seen || $c != @($seen) ) ]]
then
let n++
last=$c
choices="$choices $c:"
if [[ $seen ]]
then
seen="$seen|$c*"
else
seen="$c*"
fi
fi
done
# supply two choices to force a partial completion and a beep
[[ $n -eq 1 ]] && choices="$last:1 $last:2"
fi
COMPREPLY=( $( compgen -W "$choices" -- $cur ) )
return 0
fi
# force mandatory --revprop option on revision properties
if [[ $isRevProp && ! $hasRevPropOpt ]]
then
COMPREPLY=( $( compgen -W '--revprop' -- $cur ) )
return 0
fi
# force mandatory --revision option on revision properties
if [[ $isRevProp && $hasRevPropOpt && ! $hasRevisionOpt ]]
then
COMPREPLY=( $( compgen -W '--revision' -- $cur ) )
return 0
fi
# possible completion when setting property values
if [[ $isPsCmd && $prop && ( ! $val || $stat = 'val' ) ]]
then
# ' is a reminder for an arbitrary value
local values="\' --file"
case $prop in
svn:keywords)
# just a subset?
values="Id Rev URL Date Author Header \' $SVN_BASH_KEYWORDS"
;;
svn:executable|svn:needs-lock)
# hmmm... canonical value * is special to the shell.
values='\\*'
;;
svn:eol-style)
values='native LF CR CRLF'
;;
svn:mime-type)
# could read /etc/mime.types if available. overkill.
values="text/ text/plain text/html text/xml text/rtf
image/ image/png image/gif image/jpeg image/tiff
audio/ audio/midi audio/mpeg
video/ video/mpeg video/mp4
application/ application/octet-stream
$SVN_BASH_MIME_TYPE"
;;
esac
COMPREPLY=( $( compgen -W "$values" -- $cur ) )
# special case for --file... return even if within an option
[[ ${COMPREPLY} ]] && return 0
fi
# force mandatory --accept option for 'resolve' command
if [[ $cmd = 'resolve' && ! $acceptOpt ]]
then
COMPREPLY=( $( compgen -W '--accept' -- $cur ) )
# force option now! others will be available on later completions
return 0
fi
# maximum number of additional arguments expected in various forms
case $cmd in
merge)
nExpectArgs=3
;;
mergeinfo)
nExpectArgs=1
;;
copy|cp|move|mv|rename|ren|export|import)
nExpectArgs=2
;;
switch|sw)
[[ ! $hasRelocateOpt ]] && nExpectArgs=2
;;
help|h)
nExpectArgs=0
;;
--version)
nExpectArgs=0
;;
esac
# the maximum number of arguments is reached for a command
if [[ $nExpectArgs && $nargs -gt $nExpectArgs ]]
then
# some way to tell 'no completion at all'... is there a better one?
# Do not say 'file completion' here.
echo -en "\a"
COMPREPLY=( '' )
return 0
fi
# if not typing an option,
# then fallback on filename expansion...
if [[ $cur != -* || $stat = 'onlyarg' ]] ; then
# do we allow possible expensive completion here?
if [[ $SVN_BASH_COMPL_EXT == *svnstatus* ]] ; then
# build status command and options
# "--quiet" removes 'unknown' files
local status='svn status --non-interactive'
[[ $SVN_BASH_COMPL_EXT == *recurse* ]] || \
status="$status --non-recursive"
# I'm not sure that it can work with externals in call cases
# the output contains translatable sentences (even with quiet)
[[ $SVN_BASH_COMPL_EXT == *externals* ]] || \
status="$status --ignore-externals"
local cs= files=
# subtlety: must not set $cur* if $cur is empty in some cases
[[ $cur ]] && cs=$cur*
# 'files' is set according to the current subcommand
case $cmd in
st*) # status completion must include all files
files=$cur*
;;
ci|commit|revert|di*) # anything edited
files=$($status $cs| _svn_grcut '@([MADR!]*| M*|_M*)')
;;
add) # unknown files
files=$($status $cs| _svn_grcut '\?*')
;;
unlock) # unlock locked files
files=$($status $cs| _svn_grcut '@(??L*|?????[KOTB]*)')
;;
resolve*) # files in conflict
files=$($status $cs| _svn_grcut '@(?C*|C*)')
;;
praise|blame|ann*) # any svn file but added
files=$( _svn_lls all $cur* )
;;
p*) # prop commands
if [[ $cmd == @($propCmds) && \
$prop == @(svn:ignore|svn:externals) ]] ; then
# directory specific props
files=$( _svn_lls dir . $cur* )
else
# ??? added directories appear twice: foo foo/
files="$( _svn_lls all $cur* )
$($status $cs | _svn_grcut 'A*' )"
fi
;;
info) # information on any file
files="$( _svn_lls all $cur* )
$($status $cs | _svn_grcut 'A*' )"
;;
remove|rm|del*|move|mv|rename) # changing existing files
files=$( _svn_lls all $cur* )
;;
mkdir) # completion in mkdir can only be for subdirs?
files=$( _svn_lls dir $cur* )
;;
log|lock|up*|cl*|switch) # misc, all but added files
files=$( _svn_lls all $cur* )
;;
merge) # may do a better job? URL/WCPATH
files=$( _svn_lls all $cur* )
;;
ls|list) # better job? what about URLs?
files=$( _svn_lls all $cur* )
;;
*) # other commands: changelist export import cat mergeinfo
local fallback=1
;;
esac
# when not recursive, some relevant files may exist
# within subdirectories, so they are added here.
# should it be restricted to svn-managed subdirs? no??
if [[ $SVN_BASH_COMPL_EXT != *recurse* ]] ; then
files="$files $( _svn_lls dir $cur* )"
fi
# set completion depending on computed 'files'
if [[ $files ]] ; then
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
# if empty, set to nope?
[[ "${COMPREPLY[*]}" ]] || COMPREPLY=( '' )
elif [[ ! $fallback ]] ; then
# this suggests no completion...
echo -en "\a"
COMPREPLY=( '' )
fi
fi
# else fallback to ordinary filename completion...
return 0
fi
# otherwise build possible options for the command
pOpts="--username --password --no-auth-cache --non-interactive"
mOpts="-m --message -F --file --encoding --force-log --with-revprop"
rOpts="-r --revision"
qOpts="-q --quiet"
nOpts="-N --non-recursive --depth"
gOpts="-g --use-merge-history"
cmdOpts=
case $cmd in
--version)
cmdOpts="$qOpts"
;;
add)
cmdOpts="--auto-props --no-auto-props --force --targets \
--no-ignore --parents $nOpts $qOpts $pOpts"
;;
blame|annotate|ann|praise)
cmdOpts="$rOpts $pOpts -v --verbose --incremental --xml \
-x --extensions --force $gOpts"
;;
cat)
cmdOpts="$rOpts $pOpts"
;;
changelist|cl)
cmdOpts="--targets $pOpts $qOpts --changelist \
-R --recursive --depth --remove"
;;
checkout|co)
cmdOpts="$rOpts $qOpts $nOpts $pOpts --ignore-externals \
--force --accept"
;;
cleanup)
cmdOpts="--diff3-cmd $pOpts"
;;
commit|ci)
cmdOpts="$mOpts $qOpts $nOpts --targets --editor-cmd $pOpts \
--no-unlock --changelist --keep-changelists"
;;
copy|cp)
cmdOpts="$mOpts $rOpts $qOpts --editor-cmd $pOpts --parents"
;;
delete|del|remove|rm)
cmdOpts="--force $mOpts $qOpts --targets --editor-cmd $pOpts \
--keep-local"
;;
diff|di)
cmdOpts="$rOpts -x --extensions --diff-cmd --no-diff-deleted \
$nOpts $pOpts --force --old --new --notice-ancestry \
-c --change --summarize --changelist --xml"
;;
export)
cmdOpts="$rOpts $qOpts $pOpts $nOpts --force --native-eol \
--ignore-externals"
;;
help|h|\?)
cmdOpts=
;;
import)
cmdOpts="--auto-props --no-auto-props $mOpts $qOpts $nOpts \
--no-ignore --editor-cmd $pOpts --force"
;;
info)
cmdOpts="$pOpts $rOpts --targets -R --recursive --depth \
--incremental --xml --changelist"
;;
list|ls)
cmdOpts="$rOpts -v --verbose -R --recursive $pOpts \
--incremental --xml --depth"
;;
lock)
cmdOpts="-m --message -F --file --encoding --force-log \
--targets --force $pOpts"
;;
log)
cmdOpts="$rOpts -v --verbose --targets $pOpts --stop-on-copy \
--incremental --xml $qOpts -l --limit -c --change \
$gOpts --with-all-revprops --with-revprop"
;;
merge)
cmdOpts="$rOpts $nOpts $qOpts --force --dry-run --diff3-cmd \
$pOpts --ignore-ancestry -c --change -x --extensions \
--record-only --accept --reintegrate"
;;
mergeinfo)
cmdOpts="$rOpts $pOpts --show-revs"
;;
mkdir)
cmdOpts="$mOpts $qOpts --editor-cmd $pOpts --parents"
;;
move|mv|rename|ren)
cmdOpts="$mOpts $rOpts $qOpts --force --editor-cmd $pOpts \
--parents"
;;
propdel|pdel|pd)
cmdOpts="$qOpts -R --recursive $rOpts $pOpts --changelist \
--depth"
[[ $isRevProp || ! $prop ]] && cmdOpts="$cmdOpts --revprop"
;;
propedit|pedit|pe)
cmdOpts="--editor-cmd $pOpts $mOpts --force"
[[ $isRevProp || ! $prop ]] && \
cmdOpts="$cmdOpts --revprop $rOpts"
;;
propget|pget|pg)
cmdOpts="-v --verbose -R --recursive $rOpts --strict $pOpts --changelist \
--depth --xml"
[[ $isRevProp || ! $prop ]] && cmdOpts="$cmdOpts --revprop"
;;
proplist|plist|pl)
cmdOpts="-v --verbose -R --recursive $rOpts --revprop $qOpts \
$pOpts --changelist --depth --xml"
;;
propset|pset|ps)
cmdOpts="$qOpts --targets -R --recursive \
--encoding $pOpts --force --changelist --depth"
[[ $isRevProp || ! $prop ]] && \
cmdOpts="$cmdOpts --revprop $rOpts"
[[ $val ]] || cmdOpts="$cmdOpts -F --file"
;;
resolve)
cmdOpts="--targets -R --recursive $qOpts $pOpts --accept \
--depth"
;;
resolved)
cmdOpts="--targets -R --recursive $qOpts $pOpts --depth"
;;
revert)
cmdOpts="--targets -R --recursive $qOpts --changelist \
--depth $pOpts"
;;
status|stat|st)
cmdOpts="-u --show-updates -v --verbose $nOpts $qOpts $pOpts \
--no-ignore --ignore-externals --incremental --xml \
--changelist"
;;
switch|sw)
cmdOpts="--relocate $rOpts $nOpts $qOpts $pOpts --diff3-cmd \
--force --accept --ignore-externals --set-depth"
;;
unlock)
cmdOpts="--targets --force $pOpts"
;;
update|up)
cmdOpts="$rOpts $nOpts $qOpts $pOpts --diff3-cmd \
--ignore-externals --force --accept --changelist \
--editor-cmd --set-depth"
;;
*)
;;
esac
# add options that are nearly always available
[[ "$cmd" != "--version" ]] && cmdOpts="$cmdOpts $helpOpts"
cmdOpts="$cmdOpts --config-dir --config-option"
# --accept (edit|launch) incompatible with --non-interactive
if [[ $acceptOpt == @(edit|launch) ]] ;
then
cmdOpts=${cmdOpts/ --non-interactive / }
fi
# take out options already given
for opt in $options
do
local optBase
# remove leading dashes and arguments
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# take out alternatives and mutually exclusives
case $optBase in
-v) cmdOpts=${cmdOpts/ --verbose / } ;;
--verbose) cmdOpts=${cmdOpts/ -v / } ;;
-N) cmdOpts=${cmdOpts/ --non-recursive / } ;;
--non-recursive) cmdOpts=${cmdOpts/ -N / } ;;
-R) cmdOpts=${cmdOpts/ --recursive / } ;;
--recursive) cmdOpts=${cmdOpts/ -R / } ;;
-x) cmdOpts=${cmdOpts/ --extensions / } ;;
--extensions) cmdOpts=${cmdOpts/ -x / } ;;
-q) cmdOpts=${cmdOpts/ --quiet / } ;;
--quiet) cmdOpts=${cmdOpts/ -q / } ;;
-h) cmdOpts=${cmdOpts/ --help / } ;;
--help) cmdOpts=${cmdOpts/ -h / } ;;
-l) cmdOpts=${cmdOpts/ --limit / } ;;
--limit) cmdOpts=${cmdOpts/ -l / } ;;
-r) cmdOpts=${cmdOpts/ --revision / } ;;
--revision) cmdOpts=${cmdOpts/ -r / } ;;
-c) cmdOpts=${cmdOpts/ --change / } ;;
--change) cmdOpts=${cmdOpts/ -c / } ;;
--auto-props) cmdOpts=${cmdOpts/ --no-auto-props / } ;;
--no-auto-props) cmdOpts=${cmdOpts/ --auto-props / } ;;
-g) cmdOpts=${cmdOpts/ --use-merge-history / } ;;
--use-merge-history)
cmdOpts=${cmdOpts/ -g / } ;;
-m|--message|-F|--file)
cmdOpts=${cmdOpts/ --message / }
cmdOpts=${cmdOpts/ -m / }
cmdOpts=${cmdOpts/ --file / }
cmdOpts=${cmdOpts/ -F / }
;;
esac
# remove help options within help subcommand
if [ $isHelpCmd ] ; then
cmdOpts=${cmdOpts/ -h / }
cmdOpts=${cmdOpts/ --help / }
fi
done
# provide help about available options
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
return 0
}
complete -F _svn -o default -X '@(*/.svn|*/.svn/|.svn|.svn/)' svn
_svnadmin ()
{
local cur cmds cmdOpts optsParam opt helpCmds optBase i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Possible expansions, without pure-prefix abbreviations such as "h".
cmds='crashtest create deltify dump help hotcopy list-dblogs \
list-unused-dblogs load lslocks lstxns pack recover rmlocks \
rmtxns setlog setrevprop setuuid upgrade verify --version'
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
# options that require a parameter
# note: continued lines must end '|' continuing lines must start '|'
optsParam="-r|--revision|--parent-dir|--fs-type"
# if not typing an option, or if the previous option required a
# parameter, then fallback on ordinary filename expansion
helpCmds='help|--help|h|\?'
if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
[[ "$cur" != -* ]] || \
[[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then
return 0
fi
cmdOpts=
case ${COMP_WORDS[1]} in
create)
cmdOpts="--bdb-txn-nosync --bdb-log-keep --config-dir \
--fs-type --pre-1.4-compatible --pre-1.5-compatible"
;;
deltify)
cmdOpts="-r --revision -q --quiet"
;;
dump)
cmdOpts="-r --revision --incremental -q --quiet --deltas"
;;
help|h|\?)
cmdOpts="$cmds"
;;
hotcopy)
cmdOpts="--clean-logs"
;;
load)
cmdOpts="--ignore-uuid --force-uuid --parent-dir -q --quiet \
--use-pre-commit-hook --use-post-commit-hook"
;;
recover)
cmdOpts="--wait"
;;
rmtxns)
cmdOpts="-q --quiet"
;;
setlog)
cmdOpts="-r --revision --bypass-hooks"
;;
setrevprop)
cmdOpts="-r --revision --use-pre-revprop-change-hook \
--use-post-revprop-change-hook"
;;
verify)
cmdOpts="-r --revision -q --quiet"
;;
*)
;;
esac
cmdOpts="$cmdOpts --help -h"
# take out options already given
for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
opt=${COMP_WORDS[$i]}
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# take out alternatives
case $optBase in
-q) cmdOpts=${cmdOpts/ --quiet / } ;;
--quiet) cmdOpts=${cmdOpts/ -q / } ;;
-h) cmdOpts=${cmdOpts/ --help / } ;;
--help) cmdOpts=${cmdOpts/ -h / } ;;
-r) cmdOpts=${cmdOpts/ --revision / } ;;
--revision) cmdOpts=${cmdOpts/ -r / } ;;
esac
# skip next option if this one requires a parameter
if [[ $opt == @($optsParam) ]] ; then
((++i))
fi
done
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
return 0
}
complete -F _svnadmin -o default svnadmin
_svndumpfilter ()
{
local cur cmds cmdOpts optsParam opt helpCmds optBase i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Possible expansions, without pure-prefix abbreviations such as "h".
cmds='exclude help include --version'
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
# options that require a parameter
# note: continued lines must end '|' continuing lines must start '|'
optsParam="--targets"
# if not typing an option, or if the previous option required a
# parameter, then fallback on ordinary filename expansion
helpCmds='help|--help|h|\?'
if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
[[ "$cur" != -* ]] || \
[[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then
return 0
fi
cmdOpts=
case ${COMP_WORDS[1]} in
exclude|include)
cmdOpts="--drop-empty-revs --renumber-revs
--skip-missing-merge-sources --targets
--preserve-revprops --quiet"
;;
help|h|\?)
cmdOpts="$cmds"
;;
*)
;;
esac
cmdOpts="$cmdOpts --help -h"
# take out options already given
for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
opt=${COMP_WORDS[$i]}
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# take out alternatives
case $optBase in
-h) cmdOpts=${cmdOpts/ --help / } ;;
--help) cmdOpts=${cmdOpts/ -h / } ;;
esac
# skip next option if this one requires a parameter
if [[ $opt == @($optsParam) ]] ; then
((++i))
fi
done
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
return 0
}
complete -F _svndumpfilter -o default svndumpfilter
_svnlook ()
{
local cur cmds cmdOpts optsParam opt helpCmds optBase i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Possible expansions, without pure-prefix abbreviations such as "h".
cmds='author cat changed date diff dirs-changed help history info \
lock log propget proplist tree uuid youngest --version'
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
# options that require a parameter
# note: continued lines must end '|' continuing lines must start '|'
optsParam="-r|--revision|-t|--transaction|-l|--limit|-x|--extensions"
# if not typing an option, or if the previous option required a
# parameter, then fallback on ordinary filename expansion
helpCmds='help|--help|h|\?'
if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
[[ "$cur" != -* ]] || \
[[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then
return 0
fi
cmdOpts=
case ${COMP_WORDS[1]} in
author)
cmdOpts="-r --revision -t --transaction"
;;
cat)
cmdOpts="-r --revision -t --transaction"
;;
changed)
cmdOpts="-r --revision -t --transaction --copy-info"
;;
date)
cmdOpts="-r --revision -t --transaction"
;;
diff)
cmdOpts="-r --revision -t --transaction --diff-copy-from \
--no-diff-added --no-diff-deleted -x --extensions"
;;
dirs-changed)
cmdOpts="-r --revision -t --transaction"
;;
help|h|\?)
cmdOpts="$cmds"
;;
history)
cmdOpts="-r --revision -l --limit --show-ids"
;;
info)
cmdOpts="-r --revision -t --transaction"
;;
lock)
cmdOpts=
;;
log)
cmdOpts="-r --revision -t --transaction"
;;
propget|pget|pg)
cmdOpts="-r --revision -t --transaction --revprop"
;;
proplist|plist|pl)
cmdOpts="-r --revision -t --transaction --revprop -v --verbose --xml"
;;
tree)
cmdOpts="-r --revision -t --transaction --full-paths -N --non-recursive --show-ids"
;;
uuid)
cmdOpts=
;;
youngest)
cmdOpts=
;;
*)
;;
esac
cmdOpts="$cmdOpts --help -h"
# take out options already given
for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
opt=${COMP_WORDS[$i]}
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# take out alternatives
case $optBase in
-N) cmdOpts=${cmdOpts/ --non-recursive / } ;;
--non-recursive) cmdOpts=${cmdOpts/ -N / } ;;
-h) cmdOpts=${cmdOpts/ --help / } ;;
--help) cmdOpts=${cmdOpts/ -h / } ;;
-l) cmdOpts=${cmdOpts/ --limit / } ;;
--limit) cmdOpts=${cmdOpts/ -l / } ;;
-r) cmdOpts=${cmdOpts/ --revision / } ;;
--revision) cmdOpts=${cmdOpts/ -r / } ;;
-t) cmdOpts=${cmdOpts/ --transaction / } ;;
--transaction) cmdOpts=${cmdOpts/ -t / } ;;
-v) cmdOpts=${cmdOpts/ --verbose / } ;;
--verbose) cmdOpts=${cmdOpts/ -v / } ;;
-x) cmdOpts=${cmdOpts/ --extensions / } ;;
--extensions) cmdOpts=${cmdOpts/ -x / } ;;
esac
# skip next option if this one requires a parameter
if [[ $opt == @($optsParam) ]] ; then
((++i))
fi
done
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
return 0
}
complete -F _svnlook -o default svnlook
_svnsync ()
{
local cur cmds cmdOpts optsParam opt helpCmds optBase i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Possible expansions, without pure-prefix abbreviations such as "h".
cmds='copy-revprops help info initialize synchronize --version'
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
return 0
fi
# options that require a parameter
# note: continued lines must end '|' continuing lines must start '|'
optsParam="--config-dir|--config-option|--source-username|--source-password"
optsParam="$optsParam|--sync-username|--sync-password"
# if not typing an option, or if the previous option required a
# parameter, then fallback on ordinary filename expansion
helpCmds='help|--help|h|\?'
if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
[[ "$cur" != -* ]] || \
[[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then
return 0
fi
cmdOpts=
case ${COMP_WORDS[1]} in
copy-revprops|initialize|init|synchronize|sync)
cmdOpts="--non-interactive --no-auth-cache --trust-server-cert \
--source-username --source-password --sync-username \
--sync-password --config-dir --config-option -q --quiet"
;;
help|h|\?)
cmdOpts="$cmds"
;;
info)
cmdOpts="--non-interactive --no-auth-cache --trust-server-cert \
--source-username --source-password --sync-username \
--sync-password --config-dir --config-option"
;;
*)
;;
esac
cmdOpts="$cmdOpts --help -h"
# take out options already given
for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
opt=${COMP_WORDS[$i]}
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# take out alternatives
case $optBase in
-h) cmdOpts=${cmdOpts/ --help / } ;;
--help) cmdOpts=${cmdOpts/ -h / } ;;
-q) cmdOpts=${cmdOpts/ --quiet / } ;;
--quiet) cmdOpts=${cmdOpts/ -q / } ;;
esac
# skip next option if this one requires a parameter
if [[ $opt == @($optsParam) ]] ; then
((++i))
fi
done
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
return 0
}
complete -F _svnsync -o default svnsync
PK s¢
[çås_ _ yum-utils.bashnu W+A„¶ # bash completion for yum-utils
# repomanage
_yu_repomanage()
{
COMPREPLY=()
case "$3" in
-h|--help)
return 0
;;
-k|--keep)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) )
return 0
;;
esac
if [[ "$2" == -* ]] ; then
COMPREPLY=( $( compgen -W '--old --new --space --keep --nocheck
--help' -- "$2" ) )
return 0
fi
COMPREPLY=( $( compgen -d -- "$2" ) )
} &&
complete -F _yu_repomanage -o filenames repomanage repomanage.py
# package-cleanup
_yu_package_cleanup()
{
COMPREPLY=()
_yum_complete_baseopts "$2" "$3" 2>/dev/null && return 0
case "$3" in
--leaf-regex|--qf|--queryformat)
return 0
;;
--count)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) )
return 0
;;
esac
COMPREPLY=( $( compgen -W '$( _yum_baseopts 2>/dev/null ) --problems
--queryformat --orphans --dupes --cleandupes --noscripts --leaves --all
--leaf-regex --exclude-devel --exclude-bin --oldkernels --count
--keepdevel' -- "$2" ) )
} &&
complete -F _yu_package_cleanup -o filenames package-cleanup package-cleanup.py
# verifytree
_yu_verifytree()
{
COMPREPLY=()
case "$3" in
-h|--help|-t|--testopia)
return 0
;;
esac
if [[ "$2" == -* ]] ; then
COMPREPLY=( $( compgen -W '--help --checkall --testopia --treeinfo' \
-- "$2" ) )
return 0
fi
COMPREPLY=( $( compgen -d -- "$2" ) )
} &&
complete -F _yu_verifytree -o filenames verifytree verifytree.py
# repo-graph
_yu_repo_graph()
{
COMPREPLY=()
case "$3" in
-h|--help)
return 0
;;
--repoid)
_yum_repolist all "$2" 2>/dev/null
return 0
;;
-c)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
return 0
;;
esac
COMPREPLY=( $( compgen -W '--help --repoid -c' -- "$2" ) )
} &&
complete -F _yu_repo_graph -o filenames repo-graph repo-graph.py
# repo-rss
_yu_repo_rss()
{
COMPREPLY=()
case "$3" in
-h|--help|-l|-t|-d|-r|-a)
return 0
;;
-f)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.xml' -- "$2" ) )
return 0
;;
-c)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
return 0
;;
esac
COMPREPLY=( $( compgen -W '--help -f -l -t -d -r --tempcache -g -a -c' \
-- "$2" ) )
[[ "$2" == -* ]] || _yum_repolist all "$2" 2>/dev/null || return 0
} &&
complete -F _yu_repo_rss -o filenames repo-rss repo-rss.py
# repoclosure
_yu_repoclosure()
{
COMPREPLY=()
case "$3" in
-h|--help|-a|--arch|--basearch|--repofrompath)
return 0
;;
-c|--config)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
return 0
;;
-l|--lookaside|-r|--repoid)
_yum_repolist all "$2" 2>/dev/null
return 0
;;
-p|--pkg)
_yum_list all "$2" 2>/dev/null
return 0
;;
-g|--group)
_yum_grouplist "" "$2" 2>/dev/null
return 0
;;
esac
COMPREPLY=( $( compgen -W '--help --config --arch --basearch --builddeps
--lookaside --repoid --tempcache --quiet --newest --repofrompath --pkg
--group' -- "$2" ) )
} &&
complete -F _yu_repoclosure -o filenames repoclosure repoclosure.py
# repoquery
_yu_repoquery()
{
COMPREPLY=()
local groupmode=false
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
case "${COMP_WORDS[i]}" in -g|--group) groupmode=true ; break ;; esac
done
case "$3" in
-h|--help|--version|-f|--file|--qf|--queryformat|--resolve|--archlist|\
--whatprovides|--whatrequires|--whatobsoletes|--whatconflicts|\
--repofrompath)
return 0
;;
-l|--list|-i|--info|-R|--requires)
if $groupmode ; then
_yum_grouplist "" "$2" 2>/dev/null
else
_yum_list all "$2" 2>/dev/null
fi
return 0
;;
--provides|--obsoletes|--conflicts|--groupmember|--changelog|\
--location|--nevra|--envra|--nvr|-s|--source)
_yum_list all "$2" 2>/dev/null
return 0
;;
--grouppkgs)
COMPREPLY=( $( compgen -W 'all default optional mandatory' \
-- "$2" ) )
return 0
;;
--pkgnarrow)
COMPREPLY=( $( compgen -W 'all available updates installed extras
obsoletes recent repos' -- "$2" ) )
return 0
;;
--repoid)
_yum_repolist all "$2" 2>/dev/null
return 0
;;
--enablerepo)
_yum_repolist disabled "$2" 2>/dev/null
return 0
;;
--disablerepo)
_yum_repolist enabled "$2" 2>/dev/null
return 0
;;
-c)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
return 0
;;
esac
COMPREPLY=( $( compgen -W '--version --help --list --info --file
--queryformat --groupmember --all --requires --provides --obsoletes
--conflicts --changelog --location --nevra --envra --nvr --source
--srpm --resolve --exactdeps --recursive --whatprovides --whatrequires
--whatobsoletes --whatconflicts --group --grouppkgs --archlist
--pkgnarrow --installed --show-duplicates --repoid --enablerepo
--disablerepo --repofrompath --plugins --quiet --verbose --cache
--tempcache --querytags --config --tree-requires --tree-conflicts
--tree-obsoletes --tree-whatrequires' -- "$2" ) )
} &&
complete -F _yu_repoquery -o filenames repoquery repoquery.py
# yumdb
_yu_yumdb()
{
COMPREPLY=()
case "$3" in
-h|--help|-version)
return 0
;;
-c|--config)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
return 0
;;
shell)
COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) )
return 0
;;
esac
if [ $COMP_CWORD -le 1 ] ; then
COMPREPLY=( $( compgen -W 'get set del rename rename-force copy search
exist unset info shell --version --help --noplugins --config' \
-- "$2" ) )
fi
} &&
complete -F _yu_yumdb -o filenames yumdb yumdb.py
# repodiff
_yu_repodiff()
{
COMPREPLY=()
case "$3" in
-h|--help|--version|-n|--new|-o|--old|-a|--archlist)
return 0
;;
esac
COMPREPLY=( $( compgen -W '--version --help --new --old --quiet --archlist
--size --simple' -- "$2" ) )
} &&
complete -F _yu_repodiff repodiff repodiff.py
# yum-builddep
_yu_builddep()
{
COMPREPLY=()
_yum_complete_baseopts "$2" "$3" && return 0
if [[ $2 == -* ]] ; then
COMPREPLY=( $( compgen -W '$( _yum_baseopts 2>/dev/null )' -- "$2" ) )
return 0
fi
COMPREPLY=( $( compgen -f -o plusdirs -X "!*.spec" -- "$2" ) )
[[ $2 != */* && $2 != ~* ]] && _yum_list all "$2" 2>/dev/null
} &&
complete -F _yu_builddep -o filenames yum-builddep yum-builddep.py
# debuginfo-install
_yu_debuginfo_install()
{
COMPREPLY=()
_yum_complete_baseopts "$2" "$3" && return 0
if [[ $2 == -* ]] ; then
COMPREPLY=( $( compgen -W '$( _yum_baseopts 2>/dev/null )
--no-debuginfo-plugin' -- "$2" ) )
return 0
fi
_yum_list all "$2"
} &&
complete -F _yu_debuginfo_install debuginfo-install debuginfo-install.py
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh
PK s¢
[Øæ-.’' ’' yum.bashnu W+A„¶ # bash completion for yum
# arguments:
# 1 = argument to "yum list" (all, available, updates etc)
# 2 = current word to be completed
_yum_list()
{
if [ "$1" = all ] ; then
# Try to strip in between headings like "Available Packages" - would
# be nice if e.g. -d 0 did that for us. This will obviously only work
# for English :P
COMPREPLY=( "${COMPREPLY[@]}"
$( ${yum:-yum} -d 0 -C list $1 "$2*" 2>/dev/null | \
sed -ne '/^Available /d' -e '/^Installed /d' -e '/^Updated /d' \
-e 's/[[:space:]].*//p' ) )
else
# Drop first line (e.g. "Updated Packages") - would be nice if e.g.
# -d 0 did that for us.
COMPREPLY=( "${COMPREPLY[@]}"
$( ${yum:-yum} -d 0 -C list $1 "$2*" 2>/dev/null | \
sed -ne 1d -e 's/[[:space:]].*//p' ) )
fi
}
# arguments:
# 1 = argument to "yum repolist" (enabled, disabled etc)
# 2 = current word to be completed
_yum_repolist()
{
# TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
# (for now --noplugins is used to get rid of "Loaded plugins: ...")
# Drop first ("repo id repo name") and last ("repolist: ...") rows -
# would be nice if e.g. -d 0 did that for us.
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -W "$( ${yum:-yum} --noplugins -C repolist $1 2>/dev/null | \
sed -ne '/^repo\s\{1,\}id/d' -e '/^repolist:/d' \
-e 's/[[:space:]].*//p' )" -- "$2" ) )
}
# arguments:
# 1 = argument to "yum grouplist" (usually empty (""), or hidden)
# 2 = current word to be completed
_yum_grouplist()
{
local IFS=$'\n'
# TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
COMPREPLY=( $( compgen -W "$( ${yum:-yum} -C grouplist $1 "$2*" \
2>/dev/null | sed -ne 's/^[[:space:]]\{1,\}\(.\{1,\}\)/\1/p' )" \
-- "$2" ) )
}
# arguments:
# 1 = 1 or 0 to list enabled or disabled plugins
# 2 = current word to be completed
_yum_plugins()
{
local val
[ $1 = 1 ] && val='\(1\|yes\|true\|on\)' || val='\(0\|no\|false\|off\)'
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -W '$( command grep -il "^\s*enabled\s*=\s*$val" \
/etc/yum/pluginconf.d/*.conf 2>/dev/null \
| sed -ne "s|^.*/\([^/]\{1,\}\)\.conf$|\1|p" )' -- "$2" ) )
}
# arguments:
# 1 = current word to be completed
_yum_binrpmfiles()
{
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -f -o plusdirs -X '!*.rpm' -- "$1" ) )
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -X '*.src.rpm' ) )
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -X '*.nosrc.rpm' ) )
}
_yum_baseopts()
{
local opts='--help --tolerant --cacheonly --config --randomwait
--debuglevel --showduplicates --errorlevel --rpmverbosity --quiet
--verbose --assumeyes --assumeno --version --installroot --enablerepo
--disablerepo --exclude --disableexcludes --obsoletes --noplugins
--nogpgcheck --skip-broken --color --releasever --setopt --downloadonly
--downloaddir'
[[ $COMP_LINE == *--noplugins* ]] || \
opts="$opts --disableplugin --enableplugin"
printf %s "$opts"
}
# arguments:
# 1 = current word to be completed
# 2 = previous word
# return 0 if no more completions should be sought, 1 otherwise
_yum_complete_baseopts()
{
local split=false
type _split_longopt &>/dev/null && _split_longopt && split=true
case $2 in
-d|--debuglevel|-e|--errorlevel)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$1" ) )
return 0
;;
--rpmverbosity)
COMPREPLY=( $( compgen -W 'info critical emergency error warn
debug' -- "$1" ) )
return 0
;;
-c|--config)
COMPREPLY=( $( compgen -f -o plusdirs -X "!*.conf" -- "$1" ) )
return 0
;;
--installroot|--downloaddir)
COMPREPLY=( $( compgen -d -- "$1" ) )
return 0
;;
--enablerepo)
_yum_repolist disabled "$1"
return 0
;;
--disablerepo)
_yum_repolist enabled "$1"
return 0
;;
--disableexcludes)
_yum_repolist all "$1"
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all main' -- "$1" ) )
return 0
;;
--enableplugin)
_yum_plugins 0 "$1"
return 0
;;
--disableplugin)
_yum_plugins 1 "$1"
return 0
;;
--color)
COMPREPLY=( $( compgen -W 'always auto never' -- "$1" ) )
return 0
;;
-R|--randomwait|-x|--exclude|-h|--help|--version|--releasever|--cve|\
--bz|--advisory|--tmprepo|--verify-filenames|--setopt)
return 0
;;
--download-order)
COMPREPLY=( $( compgen -W 'default smallestfirst largestfirst' \
-- "$1" ) )
return 0
;;
--override-protection)
_yum_list installed "$1"
return 0
;;
--verify-configuration-files)
COMPREPLY=( $( compgen -W '1 0' -- "$1" ) )
return 0
;;
esac
$split && return 0 || return 1
}
_yum()
{
COMPREPLY=()
local yum=$1
local cur prev
local -a words
if type _get_comp_words_by_ref &>/dev/null ; then
_get_comp_words_by_ref cur prev words
else
cur=$2 prev=$3 words=("${COMP_WORDS[@]}")
fi
# Commands offered as completions
local cmds=( check check-update clean deplist distro-sync downgrade
groupinfo groupinstall grouplist groupremove help history info install
list makecache provides reinstall remove repolist resolvedep search
shell update upgrade version )
local i c cmd subcmd
for (( i=1; i < ${#words[@]}-1; i++ )) ; do
[[ -n $cmd ]] && subcmd=${words[i]} && break
# Recognize additional commands and aliases
for c in ${cmds[@]} check-rpmdb distribution-synchronization erase \
groupupdate grouperase localinstall localupdate whatprovides ; do
[[ ${words[i]} == $c ]] && cmd=$c && break
done
done
case $cmd in
check|check-rpmdb)
COMPREPLY=( $( compgen -W 'dependencies duplicates all' \
-- "$cur" ) )
return 0
;;
check-update|grouplist|makecache|provides|whatprovides|resolvedep|\
search)
return 0
;;
clean)
if [ "$prev" = clean ] ; then
COMPREPLY=( $( compgen -W 'expire-cache packages headers
metadata cache dbcache all' -- "$cur" ) )
fi
return 0
;;
deplist)
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.[rs]pm' -- "$cur" ) )
[[ "$cur" == */* ]] || _yum_list all "$cur"
return 0
;;
downgrade|reinstall)
_yum_binrpmfiles "$cur"
[[ "$cur" == */* ]] || _yum_list installed "$cur"
return 0
;;
erase|remove|distro-sync|distribution-synchronization)
_yum_list installed "$cur"
return 0
;;
group*)
_yum_grouplist "" "$cur"
return 0
;;
help)
if [ "$prev" = help ] ; then
COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) )
fi
return 0
;;
history)
case $prev in
history)
COMPREPLY=( $( compgen -W 'info list summary undo redo
new addon-info package-list' -- "$cur" ) )
;;
undo|redo|repeat|addon|addon-info)
COMPREPLY=( $( compgen -W "last $( $yum -d 0 -C history \
2>/dev/null | \
sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" \
-- "$cur" ) )
;;
esac
case $subcmd in
package-list|pkg|pkgs|pkg-list|pkgs-list|package|packages|\
packages-list)
_yum_list installed "$cur"
;;
esac
return 0
;;
info)
_yum_list all "$cur"
return 0
;;
install)
_yum_binrpmfiles "$cur"
[[ "$cur" == */* ]] || _yum_list available "$cur"
return 0
;;
list)
if [ "$prev" = list ] ; then
COMPREPLY=( $( compgen -W 'all available updates installed
extras obsoletes recent' -- "$cur" ) )
fi
return 0
;;
localinstall|localupdate)
_yum_binrpmfiles "$cur"
return 0
;;
repolist)
if [ "$prev" = repolist ] ; then
COMPREPLY=( $( compgen -W 'all enabled disabled' -- "$cur" ) )
fi
return 0
;;
shell)
if [ "$prev" = shell ] ; then
COMPREPLY=( $( compgen -f -o plusdirs -- "$cur" ) )
fi
return 0
;;
update|upgrade)
_yum_binrpmfiles "$cur"
[[ "$cur" == */* ]] || _yum_list updates "$cur"
return 0
;;
version)
if [ "$prev" = version ] ; then
COMPREPLY=( $( compgen -W 'all installed available nogroups
grouplist groupinfo' -- "$cur" ) )
fi
return 0
;;
esac
_yum_complete_baseopts "$cur" "$prev" && return 0
COMPREPLY=( $( compgen -W '$( _yum_baseopts ) ${cmds[@]}' -- "$cur" ) )
} &&
complete -F _yum -o filenames yum yummain.py
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh
PK s¢
[µÿw÷ ÷ scl.bashnu W+A„¶ PK s¢
[Œluá° á° / gitnu W+A„¶ PK s¢
[ÿîÐc§ § C· gdbus-bash-completion.shnu W+A„¶ PK s¢
[i*ÙÁÿ™ ÿ™
2» subversionnu W+A„¶ PK s¢
[çås_ _ kU yum-utils.bashnu W+A„¶ PK s¢
[Øæ-.’' ’' u yum.bashnu W+A„¶ PK Ã Òœ