#compdef subrepo
# Generated with perl module App::Spec v0.000
_subrepo() {
local program=subrepo
typeset -A opt_args
local curcontext="$curcontext" state line context
# ---- Command:
_arguments -s \
'1: :->cmd1' \
'*: :->args' \
&& ret=0
case $state in
cmd1)
_alternative 'args:cmd2:((branch\:"Create a branch with local subrepo commits since last pull." clean\:"Remove artifacts created by '"'"'fetch'"'"' and '"'"'branch'"'"' commands." clone\:"Add a repository as a subrepo in a subdir of your repository." commit\:"Add subrepo branch to current history as a single commit." fetch\:"Fetch the remote/upstream content for a subrepo." help\:"Same as '"'"'git help subrepo'"'"'" init\:"Turn an existing subdirectory into a subrepo." pull\:"Update the subrepo subdir with the latest upstream changes." push\:"Push a properly merged subrepo branch back upstream." status\:"Get the status of a subrepo." version\:"display version information about git-subrepo"))'
;;
args)
case $line[1] in
branch)
# ---- Command: branch
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[All subrepos]' \
&& ret=0
case $state in
subrepo)
_subrepo_branch_param_subrepo_completion
;;
esac
;;
clean)
# ---- Command: clean
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[All subrepos]' \
&& ret=0
case $state in
subrepo)
_subrepo_clean_param_subrepo_completion
;;
esac
;;
clone)
# ---- Command: clone
_arguments -s -C \
'1: :->cmd1' \
'2: :->repository' \
'3: :->subdir' \
'--help[Show command help]' \
'-h[Show command help]' \
'--branch[Upstream branch]:branch' \
'-b[Upstream branch]:branch' \
'--force[reclone (completely replace) an existing subdir.]' \
'-f[reclone (completely replace) an existing subdir.]' \
&& ret=0
case $state in
repository)
;;
subdir)
_files
;;
esac
;;
commit)
# ---- Command: commit
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'3: :->subreporef' \
'--help[Show command help]' \
'-h[Show command help]' \
&& ret=0
case $state in
subrepo)
_subrepo_commit_param_subrepo_completion
;;
subreporef)
;;
esac
;;
fetch)
# ---- Command: fetch
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[All subrepos]' \
&& ret=0
case $state in
subrepo)
_subrepo_fetch_param_subrepo_completion
;;
esac
;;
help)
# ---- Command: help
_arguments -s -C \
'1: :->cmd1' \
'--help[Show command help]' \
'-h[Show command help]' \
&& ret=0
;;
init)
# ---- Command: init
_arguments -s -C \
'1: :->cmd1' \
'2: :->subdir' \
'--help[Show command help]' \
'-h[Show command help]' \
'--remote[Specify remote repository]:remote' \
'-r[Specify remote repository]:remote' \
'--branch[Upstream branch]:branch' \
'-b[Upstream branch]:branch' \
&& ret=0
case $state in
subdir)
_files
;;
esac
;;
pull)
# ---- Command: pull
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[All subrepos]' \
'--branch[Upstream branch]:branch' \
'-b[Upstream branch]:branch' \
'--remote[Specify remote repository]:remote' \
'-r[Specify remote repository]:remote' \
'--update[update]:update' \
'-u[update]:update' \
&& ret=0
case $state in
subrepo)
_subrepo_pull_param_subrepo_completion
;;
esac
;;
push)
# ---- Command: push
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[All subrepos]' \
'--branch[Upstream branch]:branch' \
'-b[Upstream branch]:branch' \
'--remote[Specify remote repository]:remote' \
'-r[Specify remote repository]:remote' \
'--update[update]:update' \
'-u[update]:update' \
&& ret=0
case $state in
subrepo)
_subrepo_push_param_subrepo_completion
;;
esac
;;
status)
# ---- Command: status
_arguments -s -C \
'1: :->cmd1' \
'2: :->subrepo' \
'--help[Show command help]' \
'-h[Show command help]' \
'--quiet[Just print names]:quiet' \
'-q[Just print names]:quiet' \
&& ret=0
case $state in
subrepo)
_subrepo_status_param_subrepo_completion
;;
esac
;;
version)
# ---- Command: version
_arguments -s -C \
'1: :->cmd1' \
'--help[Show command help]' \
'-h[Show command help]' \
&& ret=0
;;
esac
;;
esac
}
_subrepo_branch_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_clean_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_commit_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_fetch_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_pull_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_push_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
_subrepo_status_param_subrepo_completion() {
local __dynamic_completion
local CURRENT_WORD="$words[CURRENT]"
IFS=$'\n' __dynamic_completion=( $( $program 'status' '--quiet' ) )
compadd -X "subrepo:" $__dynamic_completion
}
__subrepo_dynamic_comp() {
local argname="$1"
local arg="$2"
local comp="arg:$argname:(("
local line
while read -r line; do
local name="$line"
local desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'}"
comp="$comp$name"
if [[ -n "$desc" && "$name" != "$desc" ]]; then
comp="$comp\\:"'"'"$desc"'"'
fi
comp="$comp "
done <<< "$arg"
comp="$comp))"
_alternative "$comp"
}