From aab5d49d2e0d5be7091867aa6e5bb7217d67c7c2 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Mon, 27 Jul 2015 20:44:27 +0300 Subject: [PATCH] more coloring --- bin/hgmenu | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/bin/hgmenu b/bin/hgmenu index 76e8193..cd37b87 100755 --- a/bin/hgmenu +++ b/bin/hgmenu @@ -27,25 +27,31 @@ done PRC="cat" hash highbeam 2> /dev/null && PRC="highbeam" export HB_RULES='"^\[.\]" "$G" \ +"|.*|" "$W" \ +"^#\s.*" "$Y" \ ' +COLORED=0 +grep -q "color\s*=" ~/.hgrc && { + COLORED=1 + COLORSTR="--color always" +} +echo '# Mercurial: -echo 'Mercurial: +[a] | Add | files to track* +[c] | Commit | changes to local repository +[d] | Difference | of current and previous versions +[l] | Log | +[m] | Merge | conflicting change sets +[p] | Pull | changes from remote repository +[P] | Push | changes to remote repository +[r] | Remove | files* +[u] | Update | from local repository +[s] | Status | +[t] | Thg | X repository viewer +[v] | View | internal X viewer -[a] Add files to track* -[c] Commit changes to local repository -[d] Difference of current and previous versions -[l] Log -[m] Merge conflicting change sets -[p] Pull changes from remote repository -[P] Push changes to remote repository -[r] Remove files* -[u] Update from local repository -[s] Status -[t] Start thg, graphical repository viewer -[v] View, internal graphical viewer - -[X] Add the required extensions to your ~/.hgrc -[q] Quit +[X] | Install | color and view extensions to your ~/.hgrc +[q] | Quit | * Requires arguments ' | $PRC @@ -68,16 +74,16 @@ case "$CMD" in find "$@" \( -type d -name .hg -prune \) -o -type f -print } [[ -z "$@" ]] && { - hg status -mard + hg status -mard $COLORSTR } read -e -p "Commit message: " MSG hg commit -m "$MSG" "$@" ;; d) - hg diff --color always "$@"| $LESS + hg diff $COLORSTR "$@" | $LESS ;; l) - hg log -G --color always "$@" | $LESS + hg log -G $COLORSTR "$@" | $LESS ;; m) hg merge "$@" @@ -99,7 +105,7 @@ case "$CMD" in hg update "$@" ;; s) - hg status --color always "$@" | $LESS + hg status $COLORSTR "$@" | $LESS ;; t) thg "$@"& @@ -115,15 +121,17 @@ case "$CMD" in grep -q "^[extensions]" ~/.hgrc && { sed '0,/^\[extensions\]/s//[extensions]\ncolor=/' ~/.hgrc } || { - echo -e "[extensions]\ncolor=" + echo -e "[extensions]\ncolor=" >> ~/.hgrc } + echo "Added color support" } grep -q "hgk\s*=" ~/.hgrc || { grep -q "^[extensions]" ~/.hgrc && { sed '0,/^\[extensions\]/s//[extensions]\nhgk=/' ~/.hgrc } || { - echo -e "[extensions]\nhgk=" + echo -e "[extensions]\nhgk=" >> ~/.hgrc } + echo "Added X view support" } ;; *)