| OLD | NEW |
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 | 2 |
| 3 REMOTE=$(pwd)/demo_repo | 3 REMOTE=$(pwd)/demo_repo |
| 4 | 4 |
| 5 unset GIT_DIR | 5 unset GIT_DIR |
| 6 | 6 |
| 7 # Helper functions | 7 # Helper functions |
| 8 set_user() { | 8 set_user() { |
| 9 export GIT_AUTHOR_EMAIL="$1@chromium.org" | 9 export GIT_AUTHOR_EMAIL="$1@chromium.org" |
| 10 export GIT_AUTHOR_NAME="$1" | 10 export GIT_AUTHOR_NAME="$1" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 # run a visible command | 43 # run a visible command |
| 44 run() { | 44 run() { |
| 45 pcommand "$@" | 45 pcommand "$@" |
| 46 "$@" | 46 "$@" |
| 47 } | 47 } |
| 48 | 48 |
| 49 comment() { | 49 comment() { |
| 50 echo "###COMMENT### $@" | 50 echo "###COMMENT### $@" |
| 51 } | 51 } |
| 52 | 52 |
| 53 # run a command and print its output without printing the command itself |
| 54 output() { |
| 55 "$@" |
| 56 } |
| 57 |
| 53 # run a silent command | 58 # run a silent command |
| 54 silent() { | 59 silent() { |
| 55 if [[ $DEBUG ]] | 60 if [[ $DEBUG ]] |
| 56 then | 61 then |
| 57 "$@" | 62 "$@" |
| 58 else | 63 else |
| 59 "$@" > /dev/null 2> /dev/null | 64 "$@" > /dev/null 2> /dev/null |
| 60 fi | 65 fi |
| 61 } | 66 } |
| 62 | 67 |
| 63 # add a file with optionally content | 68 # add a file with optionally content |
| 64 add() { | 69 add() { |
| 65 local CONTENT=$2 | 70 local CONTENT=$2 |
| 66 if [[ ! $CONTENT ]] | 71 if [[ ! $CONTENT ]] |
| 67 then | 72 then |
| 68 CONTENT=$(python -c 'import random, string; \ | 73 CONTENT=$(python -c 'import random, string; \ |
| 69 print "".join(random.sample(string.lowercase, 16))') | 74 print "".join(random.sample(string.lowercase, 16))') |
| 70 fi | 75 fi |
| 71 echo "$CONTENT" > $1 | 76 echo "$CONTENT" > $1 |
| 72 silent git add $1 | 77 silent git add $1 |
| 73 } | 78 } |
| 74 | 79 |
| 75 # Add a special callout marker at the given line offset to indicate to | 80 # Add a special callout marker at the given line offset to indicate to |
| 76 # filter_demo_output.py to add a callout at that offset. | 81 # filter_demo_output.py to add a callout at that offset. |
| 77 callout() { | 82 callout() { |
| 78 echo -e "\x1b[${1}c" | 83 echo -e "\x1b[${1}c" |
| 79 } | 84 } |
| OLD | NEW |