Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master'

84582af
Dirk Alders 1 year ago
parent
commit
9cefc25565
1 changed files with 24 additions and 20 deletions
  1. 24
    20
      giti

+ 24
- 20
giti View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 #
3
-usage="Usage: $0 [-n | no details] [-r | repeat]"
3
+ usage="Usage: $0 [-n | no details] [-r | repeat]"
4 4
 while getopts "hnrs" options; do
5 5
   case $options in
6 6
     n ) NO_DETAILS="True";;
@@ -58,36 +58,40 @@ else
58 58
       git_url="$(git config --get remote.origin.url 2> /dev/null)"
59 59
       if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
60 60
         git_status_color="$COLOR_RED"
61
-        git_status_text="local changes"
61
+        git_status_text="local changes"
62 62
       elif [[ $git_status =~ "Your branch is behind" ]]; then
63 63
         git_status_color="$COLOR_YELLOW"
64
-        git_status_text="pull required"
64
+        git_status_text="pull required"
65 65
       elif [[ $git_status =~ "Your branch is ahead of" ]]; then
66 66
         git_status_color="$COLOR_YELLOW"
67
-        git_status_text="push required"
67
+        git_status_text="push required"
68 68
       elif [[ $git_status =~ "nothing to commit" ]]; then
69 69
         git_status_color="$COLOR_DARKGREEN"
70
-        git_status_text="╡ clean ╞════════"
70
+        git_status_text="clean        "
71 71
       else
72 72
         git_status_color="$COLOR_OCHRE"
73
-        git_status_text="╡ unknown ╞══════"
73
+        git_status_text="unknown      "
74 74
       fi
75 75
     fi
76 76
 
77
-    echo -e "$git_status_color╔═══$git_status_text════════════════════════════════════════════════════════════════"
78
-    echo -e "$git_status_color║ $COLOR_GREEN($git_branch)  $COLOR_CYAN$git_url"
77
+    if [[ $NO_DETAILS ]]; then
78
+      echo -e "$git_status_color╠══$COLOR_GREEN($git_branch)$git_status_color - $git_status_text - $COLOR_CYAN$git_url$COLOR_WHITE\n\b"
79
+    else
80
+      echo -e "$git_status_color╔═══╡ $git_status_text ╞════════════════════════════════════════════════════════════════"
81
+      echo -e "$git_status_color║ $COLOR_GREEN($git_branch)  $COLOR_CYAN$git_url"
79 82
 
80
-    if [[ ! $git_diff == "" && $NO_DETAILS != "True" ]]; then
81
-      echo -e "$git_status_color╠════════════════════════════════════════════════════════════════════════════════════"
82
-      IFS=$'\n'
83
-      for ENTRY in $git_diff; do 
84
-        if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "R "* ]]; then
85
-          echo -e "$git_status_color║ $COLOR_DARKYELLOW$ENTRY"
86
-        else
87
-          echo -e "$git_status_color║ $COLOR_YELLOW$ENTRY"
88
-        fi
89
-      done
90
-    fi
91
-    echo -e "$git_status_color╚════════════════════════════════════════════════════════════════════════════════════$COLOR_WHITE\n \b"
83
+      if [[ ! $git_diff == "" ]]; then
84
+        echo -e "$git_status_color╠════════════════════════════════════════════════════════════════════════════════════"
85
+        IFS=$'\n'
86
+        for ENTRY in $git_diff; do 
87
+          if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "R "* ]]; then
88
+            echo -e "$git_status_color║ $COLOR_DARKYELLOW$ENTRY"
89
+          else
90
+            echo -e "$git_status_color║ $COLOR_YELLOW$ENTRY"
91
+          fi
92
+        done
93
+      fi
94
+      echo -e "$git_status_color╚════════════════════════════════════════════════════════════════════════════════════$COLOR_WHITE\n \b"
92 95
     fi
96
+  fi
93 97
 fi

Loading…
Cancel
Save