1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
# (C) 2011 magicant
# Completion script for the "git-clone" command.
# Supports Git 1.7.7.
function completion/git-clone {
WORDS=(git clone "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::clone:arg {
OPTIONS=( #>#
"--bare; clone as a bare repository"
"b: --branch:; specify a branch to be the new repository's HEAD"
"c: --config:; specify a config variable for the new repository"
"--depth:; specify the max number of history to clone"
"l --local; optimize local clone"
"--mirror; clone as a mirror repository"
"n --no-checkout; don't check out HEAD automatically"
"--no-hardlinks; don't use hard links to spare disk space for local clone"
"o: --origin:; specify a name for the source repository to set as a remote repository"
"--progress; report progress"
"q --quiet; don't report progress"
"--recursive --recurse-submodules; initialize submodules recursively"
"--reference:; specify a reference repository to share objects (possibly dangerous operation)"
"--separate-git-dir:; specify a directory where the new repository is located"
"s --shared; share objects in repositories (possibly dangerous operation)"
"--template:; specify a directory that contains templates"
"u: --upload-pack:; specify a path for git-upload-pack on the remote host"
"v --verbose" # TODO description
) #<#
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
# (b|--branch)
# ;;
(c|--config)
if command -vf completion//git::completeoptionname >/dev/null 2>&1 ||
. -AL completion/git-config; then
command -f completion//git::completeoptionname =
fi
;;
# (--depth)
# ;;
# (o|--origin)
# ;;
(u|--reference|--template|--separate-git-dir|--upload-pack)
complete -P "$PREFIX" -S / -T -d
;;
('')
command -f completion//getoperands
command -f completion/git::clone:opr
;;
esac
}
function completion/git::clone:opr {
if [ ${WORDS[#]} -eq 0 ]; then
#TODO complete remote URI
fi
complete -P "$PREFIX" -S / -T -d
}
# vim: set ft=sh ts=8 sts=8 sw=8 noet:
|