possibilité de lancer les commandes avancées depuis la ligne de commande

This commit is contained in:
Jephté Clain 2015-02-19 15:23:21 +04:00 committed by Jephte CLAIN
parent 72fe4c27a8
commit 0e5bf817a2
1 changed files with 32 additions and 3 deletions

View File

@ -181,11 +181,28 @@ function vcs_vcs_help() {
uecho "uproject $1: Appeler le gestionnaire de version approprié avec les arguments donnés
USAGE
uproject $1 [args]"
uproject $1 [args]
note: les commandes suivantes permettent de lancer des opérations avancées:
$(array_to_lines __VCS_GIT_ADVANCED "" " ")"
}
function vcs_vcs() {
_vcs_showhelp vcs "$@" && return
local i f t
for i in "${__VCS_GIT_ADVANCED_MAP[@]}"; do
splitpair "$i" f t
if [ "$1" == "$f" ]; then
shift
set -- "$t" "$@"
break
fi
done
if array_contains __VCS_GIT_ADVANCED "$1"; then
"$@"
return $?
fi
local type
type="$(_vcs_get_type "$(_vcs_get_dir)")" || return
"$type" "$@"
@ -499,6 +516,18 @@ function git_tag() {
}
# Fonctions avancées de git
__VCS_GIT_ADVANCED_MAP=(
lbs:git_list_branches rbs:git_list_rbranches
gb:git_get_branch ib:git_is_branch
hr:git_has_remote tb:git_track_branch
ic:git_check_cleancheckout ec:git_ensure_cleancheckout
)
__VCS_GIT_ADVANCED=(
git_list_branches git_list_rbranches
git_get_branch git_is_branch
git_has_remote git_track_branch
git_check_cleancheckout git_ensure_cleancheckout
)
function git_list_branches() {
git for-each-ref refs/heads/ --format='%(refname:short)' | csort
}
@ -509,7 +538,7 @@ function git_get_branch() {
git rev-parse --abbrev-ref HEAD 2>/dev/null
}
function git_is_branch() {
[ "$(get_branch)" == "${1:-master}" ]
[ "$(git_get_branch)" == "${1:-master}" ]
}
function git_has_remote() {
[ -n "$(git config --get remote.${1:-origin}.url)" ]
@ -527,7 +556,7 @@ function git_check_cleancheckout() {
[ -z "$(git status --porcelain 2>/dev/null)" ]
}
function git_ensure_cleancheckout() {
check_cleancheckout || die "Vous avez des modifications locales. Enregistrez ces modifications avant de continuer"
git_check_cleancheckout || die "Vous avez des modifications locales. Enregistrez ces modifications avant de continuer"
}
# fonctions pour git annex