From 439fa651a0460ae5e479d19cb565249a6f98347c Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Sat, 12 Oct 2013 22:24:55 +0400 Subject: [PATCH] renommer utools() en nutools() version interactive --- lib/profile.d/nutools | 64 +++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/lib/profile.d/nutools b/lib/profile.d/nutools index 1421775..d63a032 100644 --- a/lib/profile.d/nutools +++ b/lib/profile.d/nutools @@ -34,29 +34,51 @@ function pcd() { dir="$("@@dest@@/uproject" "get$prop")" || return 1 [ -n "$dir" ] && cd "$dir" } -function utools() { - case "${1:-cycle}" in - 0|d|dis|disable) UTOOLS=;; - 1|e|ena|enable) UTOOLS=1;; - f|full) UTOOLS=f;; - cycle) - case "$UTOOLS" in - "") UTOOLS=1;; - 1) UTOOLS=f;; - f) UTOOLS=;; +function nutools() { + if [ -n "$1" ]; then + case "$1" in + 0|d|dis|disable) UTOOLS=;; + 1|e|ena|enable) UTOOLS=1;; + f|full) UTOOLS=f;; + cycle) + case "$UTOOLS" in + 1) UTOOLS=f;; + f) UTOOLS=;; + *) UTOOLS=1;; + esac + ;; + n|np|nopush) NOPUSH=1;; + push) NOPUSH=;; + p|cyclep) + case "$NOPUSH" in + "") NOPUSH=1;; + *) NOPUSH=;; + esac + ;; esac - ;; - n|np|nopush) NOPUSH=1;; - push) NOPUSH=;; - p|cyclep) - case "$NOPUSH" in - "") NOPUSH=1;; - *) NOPUSH=;; - esac - ;; - esac - echo "UTOOLS=$UTOOLS; NOPUSH=$NOPUSH" 1>&2 + echo "UTOOLS=$UTOOLS; NOPUSH=$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 + case "$prompt" in + Aucun*) UTOOLS=; break;; + Minimum*) UTOOLS=1; break;; + Complet*) UTOOLS=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 + case "$nopush" in + "Après git commit, faire git push"*) NOPUSH=; break;; + "Pas de git push auto"*) NOPUSH=1; break;; + esac + done + fi } +function utools() { nutools "$@"; } # Configuration __uaddpath "@@dest@@" PATH