From c877207f20142666aed258eccfcf496467e3266b Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Tue, 25 Feb 2014 05:34:54 +0400 Subject: [PATCH] renommer UTOOLS en UTOOLS_AUTO et NOPUSH en UTOOLS_NOPUSH bug avec git_commit qui ne tenait plus compte de UTOOLS_NOPUSH --- lib/profile.d/bash_prompt | 14 ++++++------- lib/profile.d/nutools | 44 +++++++++++++++++++-------------------- ulib/.ulib_version | 2 +- ulib/vcs | 5 +++-- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/profile.d/bash_prompt b/lib/profile.d/bash_prompt index aced07c..1f86c25 100644 --- a/lib/profile.d/bash_prompt +++ b/lib/profile.d/bash_prompt @@ -14,7 +14,7 @@ if [ -n "$UTOOLS_BASH_PROMPT" ]; then fi GENERATE_PS1='function __genps1() { local cvs svn git uinst woinst suffix p="$PWD" -if [ -n "$UTOOLS" ]; then +if [ -n "$UTOOLS_AUTO" ]; then PS1= while [ "$p" != "$HOME" -a "$p" != "" ]; do if [ -z "$cvs" -a -d "$p/CVS" ]; then @@ -22,7 +22,7 @@ if [ -n "$UTOOLS" ]; then cvs=1 fi if [ -z "$svn" -a -d "$p/.svn" ]; then - if [ "$UTOOLS" != "f" ]; then + if [ "$UTOOLS_AUTO" != "f" ]; then flag="?svn" elif [ -n "$(svn status -q --ignore-externals 2>/dev/null)" ]; then flag="*svn" @@ -33,7 +33,7 @@ if [ -n "$UTOOLS" ]; then svn=1 fi if [ -z "$git" -a -d "$p/.git" ]; then - if [ "$UTOOLS" != "f" ]; then + if [ "$UTOOLS_AUTO" != "f" ]; then flag="?git" elif [ -n "$(git status -s 2>/dev/null)" ]; then flag="*git" @@ -42,7 +42,7 @@ if [ -n "$UTOOLS" ]; then fi branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" [ "$branch" != "master" ] && flag="$flag:$branch" - if [ -n "$NOPUSH" ]; then + if [ -n "$UTOOLS_NOPUSH" ]; then flag="$flag,nopush" fi PS1="${PS1:+$PS1,}$flag" @@ -87,7 +87,7 @@ fi case "$TERM" in xterm*|rxvt|Eterm|eterm) PROMPT_COMMAND=' -if [ -n "$UTOOLS" ]; then +if [ -n "$UTOOLS_AUTO" ]; then echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $( if [ -f build.properties ]; then if grep -q "^project\(_\|\.\)name=" build.properties; then @@ -114,7 +114,7 @@ eval "$GENERATE_PS1" ;; screen) PROMPT_COMMAND=' -if [ -n "$UTOOLS" ]; then +if [ -n "$UTOOLS_AUTO" ]; then echo -ne "\033_[screen] ${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $(if [ -f build.properties ]; then if grep -q "^project\(_\|\.\)name=" build.properties; then if grep -q "^project\.name=" build.properties; then @@ -140,7 +140,7 @@ eval "$GENERATE_PS1" ;; *) PROMPT_COMMAND=' -if [ -n "$UTOOLS" ]; then +if [ -n "$UTOOLS_AUTO" ]; then if [ -f build.properties ]; then if grep -q "^project\(_\|\.\)name=" build.properties; then if grep -q "^project\.name=" build.properties; then diff --git a/lib/profile.d/nutools b/lib/profile.d/nutools index d63a032..6604389 100644 --- a/lib/profile.d/nutools +++ b/lib/profile.d/nutools @@ -7,8 +7,8 @@ # Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants: # - lib/profile.d/bash_prompt # - ulib/vcs {git_commit} -: "${UTOOLS:=1}" "${NOPUSH:=}" -export UTOOLS NOPUSH +: "${UTOOLS_AUTO:=1}" "${UTOOLS_NOPUSH:=}" +export UTOOLS_AUTO UTOOLS_NOPUSH # fonctions utilitaires pour les chemins function __udelpath() { @@ -37,43 +37,43 @@ function pcd() { function nutools() { if [ -n "$1" ]; then case "$1" in - 0|d|dis|disable) UTOOLS=;; - 1|e|ena|enable) UTOOLS=1;; - f|full) UTOOLS=f;; + 0|d|dis|disable) UTOOLS_AUTO=;; + 1|e|ena|enable) UTOOLS_AUTO=1;; + f|full) UTOOLS_AUTO=f;; cycle) - case "$UTOOLS" in - 1) UTOOLS=f;; - f) UTOOLS=;; - *) UTOOLS=1;; + case "$UTOOLS_AUTO" in + 1) UTOOLS_AUTO=f;; + f) UTOOLS_AUTO=;; + *) UTOOLS_AUTO=1;; esac ;; - n|np|nopush) NOPUSH=1;; - push) NOPUSH=;; + n|np|nopush) UTOOLS_NOPUSH=1;; + push) UTOOLS_NOPUSH=;; p|cyclep) - case "$NOPUSH" in - "") NOPUSH=1;; - *) NOPUSH=;; + case "$UTOOLS_NOPUSH" in + "") UTOOLS_NOPUSH=1;; + *) UTOOLS_NOPUSH=;; esac ;; esac - echo "UTOOLS=$UTOOLS; NOPUSH=$NOPUSH" 1>&2 + echo "UTOOLS_AUTO=$UTOOLS_AUTO; UTOOLS_NOPUSH=$UTOOLS_NOPUSH" 1>&2 else local PS3 prompt nopush echo "=== Type de prompt ===" 1>&2 PS3="Veuillez choisir le type de prompt: " - select prompt in Aucun$([ -z "$UTOOLS" ] && echo "*") Minimum$([ "$UTOOLS" == 1 ] && echo "*") Complet$([ "$UTOOLS" == f ] && echo "*"); do + select prompt in Aucun$([ -z "$UTOOLS_AUTO" ] && echo "*") Minimum$([ "$UTOOLS_AUTO" == 1 ] && echo "*") Complet$([ "$UTOOLS_AUTO" == f ] && echo "*"); do case "$prompt" in - Aucun*) UTOOLS=; break;; - Minimum*) UTOOLS=1; break;; - Complet*) UTOOLS=f; break;; + Aucun*) UTOOLS_AUTO=; break;; + Minimum*) UTOOLS_AUTO=1; break;; + Complet*) UTOOLS_AUTO=f; break;; esac 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 "$NOPUSH" ] && echo "*")" "Pas de git push auto$([ -n "$NOPUSH" ] && echo "*")"; do + select nopush in "Après git commit, faire git push$([ -z "$UTOOLS_NOPUSH" ] && echo "*")" "Pas de git push auto$([ -n "$UTOOLS_NOPUSH" ] && echo "*")"; do case "$nopush" in - "Après git commit, faire git push"*) NOPUSH=; break;; - "Pas de git push auto"*) NOPUSH=1; break;; + "Après git commit, faire git push"*) UTOOLS_NOPUSH=; break;; + "Pas de git push auto"*) UTOOLS_NOPUSH=1; break;; esac done fi diff --git a/ulib/.ulib_version b/ulib/.ulib_version index 2bd5a0a..4099407 100644 --- a/ulib/.ulib_version +++ b/ulib/.ulib_version @@ -1 +1 @@ -22 +23 diff --git a/ulib/vcs b/ulib/vcs index 7667426..5ae8425 100644 --- a/ulib/vcs +++ b/ulib/vcs @@ -363,8 +363,9 @@ function git_mkdir() { git mkdir "$@" } function git_commit() { - local all=auto push=auto args - normyesval nopush "$NOPUSH" + local all=auto push=auto nopush args + normyesval nopush "$UTOOLS_NOPUSH" + [ -n "$nopush" ] && push= parse_opts + "${PRETTYOPTS[@]}" \ -a,--all all=1 \ -c,--cached all= \