summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-09-02 17:42:17 +0100
committerMichael Allen <michael@michaelallen.io>2015-09-02 17:43:28 +0100
commit393013fba5bc7ec3402de4c1b2faf47dd7493c59 (patch)
tree21a3c739add51acfb329f53bb75f47a757ab1983
parent1342bd1e5fbef270db72f302bd6c380a7fec29ac (diff)
downloadgit-sonar-393013fba5bc7ec3402de4c1b2faf47dd7493c59.tar.gz
git-sonar-393013fba5bc7ec3402de4c1b2faf47dd7493c59.zip
Allow for shell specific rc files
-rwxr-xr-xradar-base.sh8
-rwxr-xr-xtest-colors.sh46
2 files changed, 29 insertions, 25 deletions
diff --git a/radar-base.sh b/radar-base.sh
index 5672e07..25a4113 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -6,7 +6,9 @@ remote=""
rcfile_path="$HOME"
prepare_bash_colors() {
- if [ -f "$rcfile_path/.gitradarrc" ]; then
+ if [ -f "$rcfile_path/.gitradarrc.bash" ]; then
+ source "$rcfile_path/.gitradarrc.bash"
+ elif [ -f "$rcfile_path/.gitradarrc" ]; then
source "$rcfile_path/.gitradarrc"
fi
@@ -34,7 +36,9 @@ prepare_bash_colors() {
}
prepare_zsh_colors() {
- if [ -f "$rcfile_path/.gitradarrc" ]; then
+ if [ -f "$rcfile_path/.gitradarrc.zsh" ]; then
+ source "$rcfile_path/.gitradarrc.zsh"
+ elif [ -f "$rcfile_path/.gitradarrc" ]; then
source "$rcfile_path/.gitradarrc"
fi
diff --git a/test-colors.sh b/test-colors.sh
index 196b60b..59a8704 100755
--- a/test-colors.sh
+++ b/test-colors.sh
@@ -118,27 +118,27 @@ reset_env_vars() {
}
create_rc_file() {
- echo 'GIT_RADAR_COLOR_REMOTE_AHEAD="remote-ahead"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_REMOTE_BEHIND="remote-behind"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_REMOTE_DIVERGED="remote-diverged"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM="not-upstream"' >> .gitradarrc
-
- echo 'GIT_RADAR_COLOR_LOCAL_AHEAD="local-ahead"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_LOCAL_BEHIND="local-behind"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_LOCAL_DIVERGED="local-diverged"' >> .gitradarrc
-
- echo 'GIT_RADAR_COLOR_CHANGES_STAGED="changes-staged"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_CHANGES_UNSTAGED="changes-unstaged"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_CHANGES_CONFLICTED="changes-conflicted"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_CHANGES_UNTRACKED="changes-untracked"' >> .gitradarrc
-
- echo 'export GIT_RADAR_COLOR_BRANCH="branch-color"' >> .gitradarrc
- echo 'export GIT_RADAR_MASTER_SYMBOL="m"' >> .gitradarrc
-
- echo 'GIT_RADAR_COLOR_LOCAL_RESET="local-reset"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_REMOTE_RESET="remote-reset"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_CHANGES_RESET="change-reset"' >> .gitradarrc
- echo 'GIT_RADAR_COLOR_BRANCH_RESET="branch-reset"' >> .gitradarrc
+ echo 'GIT_RADAR_COLOR_REMOTE_AHEAD="remote-ahead"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_REMOTE_BEHIND="remote-behind"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_REMOTE_DIVERGED="remote-diverged"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM="not-upstream"' >> .gitradarrc$1
+
+ echo 'GIT_RADAR_COLOR_LOCAL_AHEAD="local-ahead"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_LOCAL_BEHIND="local-behind"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_LOCAL_DIVERGED="local-diverged"' >> .gitradarrc$1
+
+ echo 'GIT_RADAR_COLOR_CHANGES_STAGED="changes-staged"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_CHANGES_UNSTAGED="changes-unstaged"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_CHANGES_CONFLICTED="changes-conflicted"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_CHANGES_UNTRACKED="changes-untracked"' >> .gitradarrc$1
+
+ echo 'export GIT_RADAR_COLOR_BRANCH="branch-color"' >> .gitradarrc$1
+ echo 'export GIT_RADAR_MASTER_SYMBOL="m"' >> .gitradarrc$1
+
+ echo 'GIT_RADAR_COLOR_LOCAL_RESET="local-reset"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_REMOTE_RESET="remote-reset"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_CHANGES_RESET="change-reset"' >> .gitradarrc$1
+ echo 'GIT_RADAR_COLOR_BRANCH_RESET="branch-reset"' >> .gitradarrc$1
}
test_with_rcfile_bash() {
@@ -147,7 +147,7 @@ test_with_rcfile_bash() {
rcfile_path="$(pwd)"
- create_rc_file
+ create_rc_file ".bash"
prepare_bash_colors
assertEquals "$COLOR_REMOTE_AHEAD" "\x01remote-ahead\x02"
@@ -181,7 +181,7 @@ test_with_rcfile_zsh() {
rcfile_path="$(pwd)"
- create_rc_file
+ create_rc_file ".zsh"
mock_zsh_colors
prepare_zsh_colors