From 552c9cccf57e04b17b40ccde3ed414938afce466 Mon Sep 17 00:00:00 2001 From: pini Date: Thu, 15 Sep 2016 13:55:37 +0300 Subject: [PATCH] mac --- colorize-spec | 12 ++++++------ detoul | 6 +++--- detoul-base | 24 ++++++++++++------------ load-detoul-spec | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/colorize-spec b/colorize-spec index a6f505e..40eb3c2 100755 --- a/colorize-spec +++ b/colorize-spec @@ -7,25 +7,25 @@ regex() { } mark-comments() { - regex "s/(#.*)/\\\e[38;5;22m\1\\\e[0m/g" + regex "s/(#.*)/\\\033[38;5;22m\1\\\033[0m/g" } mark-unsafe-checkouts() { spec="$(cat)" echo "$spec" | head -n 1 - echo "$spec" | tail -n +2 | regex "s/^(\s*checkout)/\\\e[91m\1\\\e[0m/g" + echo "$spec" | tail -n +2 | regex "s/^(\s*checkout)/\\\033[91m\1\\\033[0m/g" } mark-branch-names() { - regex "s/^(\s*(?!exec)${graph_not_comment}+\s+)(${graph_not_comment}+)/\1\\\e[92m\2\\\e[0m/g" + regex "s/^(\s*(?!exec)${graph_not_comment}+\s+)(${graph_not_comment}+)/\1\\\033[92m\2\\\033[0m/g" } mark-execs() { - regex "s/^(\s*exec)(.*)$/\\\e[31m\1\\\e[96m\2\\\e[0m/g" + regex "s/^(\s*exec)(.*)$/\\\033[31m\1\\\033[96m\2\\\033[0m/g" } mark-squash-commits-messages() { - regex "s/^(\s*(?:take|rebase)-squash\s+${graph_not_comment}+\s+)((?:(?!#)\N\{\})+)/\1\\\e[37m\2\\\e[0m/g" + regex "s/^(\s*(?:take|rebase)-squash\s+${graph_not_comment}+\s+)((?:(?!#)\N\{\})+)/\1\\\033[37m\2\\\033[0m/g" } mark-unsafe-checkouts | @@ -35,4 +35,4 @@ mark-unsafe-checkouts | mark-comments #sed -r -e \ # -e \ -# -e "s/^\([[:graph:]]\+\s\+\)\([[:graph:]]\+\)/\1\\\e[92m\2\\\e[0m/g" +# -e "s/^\([[:graph:]]\+\s\+\)\([[:graph:]]\+\)/\1\\\033[92m\2\\\033[0m/g" diff --git a/detoul b/detoul index 51fe2ec..638d5f2 100755 --- a/detoul +++ b/detoul @@ -286,7 +286,7 @@ save-spec() { case "$1" in test) git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 - echo -e "\e[32mIntegration branch succesfully created.\e[0m" + echo -e "\033[32mIntegration branch succesfully created.\033[0m" ;; make) git checkout "$DETOUL_BRANCH" >/dev/null 2>&1 @@ -298,7 +298,7 @@ save-spec() { ;; *) git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 - echo -e "\e[31mUnknown operation '$1'.\e[0m" >&2 + echo -e "\033[31mUnknown operation '$1'.\033[0m" >&2 fail esac quit @@ -309,7 +309,7 @@ save-spec() { stash-pop fi git branch -D "$DETOUL_BRANCH" >/dev/null 2>&1 - echo -e "\e[31mFailure.\e[0m" >&2 + echo -e "\033[31mFailure.\033[0m" >&2 fail fi diff --git a/detoul-base b/detoul-base index 6627ec3..04e7eea 100755 --- a/detoul-base +++ b/detoul-base @@ -21,11 +21,11 @@ make-detoul-dependency() { export DETOUL_COLOR_ALWAYS="1" if ( detoul cat "$1" >/dev/null 2>&1 ); then if ( git ls-tree detoul-spec | grep -q "\s$1$" ); then - echo -e "Making spec '\e[92m$1\e[0m...'" && + echo -e "Making spec '\033[92m$1\033[0m...'" && detoul make "$1" && echo "0" >"$exit_code_file" else - echo -e "\e[93mWarning: there is an archived detoul spec called '\e[92m$1\e[93m'.\e[0m" + echo -e "\033[93mWarning: there is an archived detoul spec called '\033[92m$1\033[93m'.\033[0m" echo "0" >"$exit_code_file" fi else @@ -56,12 +56,12 @@ validate-ref-name() { checkout() { if [ "$first_command" == "1" ]; then - color="\e[0m" + color="\033[0m" first_command=0 else - color="\e[91m" + color="\033[91m" fi - echo -e "${color}Checking out\e[0m '\e[92m$branch\e[0m'..." + echo -e "${color}Checking out\033[0m '\033[92m$branch\033[0m'..." if ( (git branch ; git tag) | grep -q "\b${branch}$" ); then checkout_branch="$branch" else @@ -130,9 +130,9 @@ take() { cached_commit_key="$(detoul-cache hash take $@)" if [ "$3" == "" ]; then if [ "$1" == "" ]; then - echo -e "Taking '\e[92m$branch\e[0m'..." + echo -e "Taking '\033[92m$branch\033[0m'..." else - echo -e "Taking '\e[92m$branch\e[0m' (\e[96m$(echo "$1" | cut -d'-' -f1)\e[0m)..." + echo -e "Taking '\033[92m$branch\033[0m' (\033[96m$(echo "$1" | cut -d'-' -f1)\033[0m)..." fi cached_commit="$(detoul-cache read "$cached_commit_key")" if [ $? -ne 0 ] || ! (git reset --hard "$cached_commit" >/dev/null 2>&1); then @@ -141,7 +141,7 @@ take() { return fi elif [ "$3" == "refresh" ]; then - echo -e "\e[93mAttempting to refresh rerere cache...\e[0m" >&2 + echo -e "\033[93mAttempting to refresh rerere cache...\033[0m" >&2 fi source_branch="$(git show-ref "$branch" | cut -d' ' -f1 | head -n 1)" if [ "${1/squash}" != "$1" ]; then @@ -202,7 +202,7 @@ pick() { branch="${command[1]}" checkout else - echo -e "Picking '\e[92m${command[1]}\e[0m'..." + echo -e "Picking '\033[92m${command[1]}\033[0m'..." ( git cherry-pick "${command[1]}" ) >/dev/null 2>&1 || fail @@ -219,7 +219,7 @@ while read -r line; do export branch="$(autocomplete "${command[1]//\*/.*}")" (make-detoul-dependency "$branch") || fail if ! validate-ref-name "$branch" ; then - echo -e "\e[31mReference not found: '$branch'.\e[0m" >&2 + echo -e "\033[31mReference not found: '$branch'.\033[0m" >&2 fail fi case "${command[0]}" in @@ -239,12 +239,12 @@ while read -r line; do pick ;; exec) - echo -e "\e[91mExecuting\e[0m '\e[92m${line/exec /}\e[0m'..." + echo -e "\033[91mExecuting\033[0m '\033[92m${line/exec /}\033[0m'..." cd "$GIT_WD" bash -c "${line/exec /}" || fail ;; *) - echo -e "\e[31mUnknown directive '${command[0]}'.\e[0m" >&2 + echo -e "\033[31mUnknown directive '${command[0]}'.\033[0m" >&2 fail ;; esac diff --git a/load-detoul-spec b/load-detoul-spec index 263225e..d11a3a7 100755 --- a/load-detoul-spec +++ b/load-detoul-spec @@ -15,7 +15,7 @@ else spec_hash="$(git ls-tree detoul-spec -- .archive/ | grep "\s.archive/$DETOUL_BRANCH$" | xargs echo | cut -d' ' -f3)" fi if [ "$spec_hash" == "" ]; then - echo -e "\e[31mBranch specification file not found.\e[0m" + echo -e "\033[31mBranch specification file not found.\033[0m" exit 1 fi fi