more coloring

This commit is contained in:
Ville Rantanen
2015-07-27 20:44:27 +03:00
parent 0d14e02140
commit aab5d49d2e

View File

@@ -27,25 +27,31 @@ done
PRC="cat" PRC="cat"
hash highbeam 2> /dev/null && PRC="highbeam" hash highbeam 2> /dev/null && PRC="highbeam"
export HB_RULES='"^\[.\]" "$G" \ 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* [X] | Install | color and view extensions to your ~/.hgrc
[c] Commit changes to local repository [q] | Quit |
[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
* Requires arguments * Requires arguments
' | $PRC ' | $PRC
@@ -68,16 +74,16 @@ case "$CMD" in
find "$@" \( -type d -name .hg -prune \) -o -type f -print find "$@" \( -type d -name .hg -prune \) -o -type f -print
} }
[[ -z "$@" ]] && { [[ -z "$@" ]] && {
hg status -mard hg status -mard $COLORSTR
} }
read -e -p "Commit message: " MSG read -e -p "Commit message: " MSG
hg commit -m "$MSG" "$@" hg commit -m "$MSG" "$@"
;; ;;
d) d)
hg diff --color always "$@"| $LESS hg diff $COLORSTR "$@" | $LESS
;; ;;
l) l)
hg log -G --color always "$@" | $LESS hg log -G $COLORSTR "$@" | $LESS
;; ;;
m) m)
hg merge "$@" hg merge "$@"
@@ -99,7 +105,7 @@ case "$CMD" in
hg update "$@" hg update "$@"
;; ;;
s) s)
hg status --color always "$@" | $LESS hg status $COLORSTR "$@" | $LESS
;; ;;
t) t)
thg "$@"& thg "$@"&
@@ -115,15 +121,17 @@ case "$CMD" in
grep -q "^[extensions]" ~/.hgrc && { grep -q "^[extensions]" ~/.hgrc && {
sed '0,/^\[extensions\]/s//[extensions]\ncolor=/' ~/.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 "hgk\s*=" ~/.hgrc || {
grep -q "^[extensions]" ~/.hgrc && { grep -q "^[extensions]" ~/.hgrc && {
sed '0,/^\[extensions\]/s//[extensions]\nhgk=/' ~/.hgrc sed '0,/^\[extensions\]/s//[extensions]\nhgk=/' ~/.hgrc
} || { } || {
echo -e "[extensions]\nhgk=" echo -e "[extensions]\nhgk=" >> ~/.hgrc
} }
echo "Added X view support"
} }
;; ;;
*) *)