diff --git a/lib/profile.d/bash_prompt b/lib/profile.d/bash_prompt index 1f86c25..3c8a410 100644 --- a/lib/profile.d/bash_prompt +++ b/lib/profile.d/bash_prompt @@ -42,8 +42,8 @@ if [ -n "$UTOOLS_AUTO" ]; then fi branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" [ "$branch" != "master" ] && flag="$flag:$branch" - if [ -n "$UTOOLS_NOPUSH" ]; then - flag="$flag,nopush" + if [ -n "$UTOOLS_VCS_OFFLINE" ]; then + flag="$flag,offline" fi PS1="${PS1:+$PS1,}$flag" git=1 diff --git a/lib/profile.d/nutools b/lib/profile.d/nutools index d32d2d4..904cf33 100644 --- a/lib/profile.d/nutools +++ b/lib/profile.d/nutools @@ -1,14 +1,19 @@ # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 ##@before * +# Traitements automatiques de nutools +# Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants: +# - lib/profile.d/bash_prompt +# - lib/ulib/vcs { git_commit(), git_ensure_branch() } # Faut-il activer les traitements automatiques de utools? Donner à cette # variable la valeur vide pour désactiver les fonctionnalités potentiellement # gourmandes en resources. -# Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants: -# - lib/profile.d/bash_prompt -# - lib/ulib/vcs {git_commit} -: "${UTOOLS_AUTO:=1}" "${UTOOLS_NOPUSH:=}" -export UTOOLS_AUTO UTOOLS_NOPUSH +: "${UTOOLS_AUTO:=1}" +export UTOOLS_AUTO +# Activer le mode offline de git. Par exemple, les modifications ne sont pas +# pousser automatiquement vers l'origine. +: "${UTOOLS_VCS_OFFLINE:=}" +export UTOOLS_VCS_OFFLINE # fonctions utilitaires pour les chemins function __udelpath() { @@ -47,16 +52,16 @@ function nutools() { *) UTOOLS_AUTO=1;; esac ;; - n|np|nopush) UTOOLS_NOPUSH=1;; - push) UTOOLS_NOPUSH=;; + n|np|nopush) UTOOLS_VCS_OFFLINE=1;; + push) UTOOLS_VCS_OFFLINE=;; p|cyclep) - case "$UTOOLS_NOPUSH" in - "") UTOOLS_NOPUSH=1;; - *) UTOOLS_NOPUSH=;; + case "$UTOOLS_VCS_OFFLINE" in + "") UTOOLS_VCS_OFFLINE=1;; + *) UTOOLS_VCS_OFFLINE=;; esac ;; esac - echo "UTOOLS_AUTO=$UTOOLS_AUTO; UTOOLS_NOPUSH=$UTOOLS_NOPUSH" 1>&2 + echo "UTOOLS_AUTO=$UTOOLS_AUTO; UTOOLS_VCS_OFFLINE=$UTOOLS_VCS_OFFLINE" 1>&2 else local PS3 prompt nopush echo "=== Type de prompt ===" 1>&2 @@ -70,10 +75,10 @@ function nutools() { done echo "=== git push automatique ===" 1>&2 PS3="Veuillez choisir le type de push: " - select nopush in "Après git commit, faire git push$([ -z "$UTOOLS_NOPUSH" ] && echo "*")" "Pas de git push auto$([ -n "$UTOOLS_NOPUSH" ] && echo "*")"; do + select nopush in "Après git commit, faire git push$([ -z "$UTOOLS_VCS_OFFLINE" ] && echo "*")" "Pas de git push auto$([ -n "$UTOOLS_VCS_OFFLINE" ] && echo "*")"; do case "$nopush" in - "Après git commit, faire git push"*) UTOOLS_NOPUSH=; break;; - "Pas de git push auto"*) UTOOLS_NOPUSH=1; break;; + "Après git commit, faire git push"*) UTOOLS_VCS_OFFLINE=; break;; + "Pas de git push auto"*) UTOOLS_VCS_OFFLINE=1; break;; esac done fi diff --git a/lib/ulib/vcs b/lib/ulib/vcs index 183066d..1248feb 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -386,7 +386,7 @@ function git_mkdir() { } function git_commit() { local all=auto allnew push=auto nopush args - normyesval nopush "$UTOOLS_NOPUSH" + setyesval nopush "$UTOOLS_VCS_OFFLINE" [ -n "$nopush" ] && push= parse_opts + "${PRETTYOPTS[@]}" \ -a,--all all=1 \