From 78176780e0f600d6b2f8b6635ffe5c615ee6dc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 13 Jun 2013 02:26:40 +0200 Subject: [PATCH] Optimize _lp_smart_mark more: case .. esac Use a 'case..esac' in _lp_smart_mark. --- liquidprompt | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/liquidprompt b/liquidprompt index ba8d509..22fe05d 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1309,26 +1309,22 @@ _lp_title() _lp_smart_mark() { local mark - if [[ -n "$LP_MARK_DEFAULT" ]]; then - mark=$LP_MARK_DEFAULT - else - mark="$_LP_MARK_SYMBOL" - fi - if [[ "$1" == "git" ]]; then - mark=$LP_MARK_GIT - elif [[ "$1" == "git-svn" ]]; then - mark="$LP_MARK_GIT$LP_MARK_SVN" - elif [[ "$1" == "hg" ]]; then - mark=$LP_MARK_HG - elif [[ "$1" == "svn" ]]; then - mark=$LP_MARK_SVN - elif [[ "$1" == "fossil" ]]; then - mark=$LP_MARK_FOSSIL - elif [[ "$1" == "bzr" ]]; then - mark=$LP_MARK_BZR - elif [[ "$1" == "disabled" ]]; then - mark=$LP_MARK_DISABLED - fi + case "$LP_VCS_TYPE" in + git) mark="$LP_MARK_GIT" ;; + git-svn) mark="$LP_MARK_GIT$LP_MARK_SVN" ;; + hg) mark="$LP_MARK_HG" ;; + svn) mark="$LP_MARK_SVN" ;; + fossil) mark="$LP_MARK_FOSSIL" ;; + bzr) mark="$LP_MARK_BZR" ;; + disabled) mark="$LP_MARK_DISABLED" ;; + *) + if [[ -n "$LP_MARK_DEFAULT" ]]; then + mark=$LP_MARK_DEFAULT + else + mark="$_LP_MARK_SYMBOL" + fi + ;; + esac echo -ne "${LP_COLOR_MARK}${mark}${NO_COL}" }