Просмотр исходного кода

Update shell comments, rename gitp `branch` to `decoration`

The term "decoration" is the more correct way to lump branches and tags
together.
Weiyi Lou 9 лет назад
Родитель
Сommit
b07904d13c
2 измененных файлов с 11 добавлено и 12 удалено
  1. 5 6
      shell/common/colours
  2. 6 6
      shell/common/git-prompt.sh

+ 5 - 6
shell/common/colours

@@ -18,13 +18,12 @@ elif [[ -n ${ZSH_VERSION-} ]]; then
   cEnd='m%}'
   cEnd='m%}'
 fi
 fi
 
 
-# The arrays will be 1-based because this is ZSH default behaviour.
-# This can be changed with the `KSH_ARRAYS` option, but we do not.
+# Build the colour array.
 # First 16 are the ANSI Terminal colours and bright variants:
 # First 16 are the ANSI Terminal colours and bright variants:
 # Black, Red, Green, Yellow, Blue, Magenta, Cyan, White
 # Black, Red, Green, Yellow, Blue, Magenta, Cyan, White
 for colour in {0..255}; do
 for colour in {0..255}; do
-    FG[$colour]=$cStart"38;5;"$colour$cEnd
-    BG[$colour]=$cStart"48;5;"$colour$cEnd
+  FG[$colour]=$cStart"38;5;"$colour$cEnd
+  BG[$colour]=$cStart"48;5;"$colour$cEnd
 done
 done
 
 
 # Create text effects.
 # Create text effects.
@@ -42,7 +41,7 @@ cnRev=$cStart"27"$cEnd # no-reverse
 
 
 SPECTRUM_TEXT=${SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
 SPECTRUM_TEXT=${SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
 
 
-# Show all 256 colours with colour number
+# Show all as foreground colours
 function spectrum_ls() {
 function spectrum_ls() {
   local line
   local line
   for code in {0..255}; do
   for code in {0..255}; do
@@ -51,7 +50,7 @@ function spectrum_ls() {
   done
   done
 }
 }
 
 
-# Show all 256 colours where the background is set to specific colour
+# Show all as background colours
 function spectrum_bls() {
 function spectrum_bls() {
   local line
   local line
   for code in {0..255}; do
   for code in {0..255}; do

+ 6 - 6
shell/common/git-prompt.sh

@@ -2,7 +2,7 @@
 #
 #
 # Format:
 # Format:
 #
 #
-#     [repo:branch:commit] BARE BISECT/MERGE/REBASE NO-REMOTE/NO-RTB/AHEAD/BEHIND/DIVERGED WIP STASH +±xcru?
+#     [repo:decoration:commit] BARE BISECT/MERGE/REBASE NO-REMOTE/NO-RTB/AHEAD/BEHIND/DIVERGED WIP STASH +±xcru?
 #
 #
 # Usage:
 # Usage:
 #
 #
@@ -82,14 +82,14 @@ function __gitp_cprep() {
   cgYel=$cStart'38;5;220'$cEnd
   cgYel=$cStart'38;5;220'$cEnd
 }
 }
 
 
-# Get location i.e. which repo/branch/commit is this?
+# Get location i.e. which repo/decoration/commit is this?
 function __gitp_location() {
 function __gitp_location() {
   local prefix=${GITP_PREFIX:-'['}
   local prefix=${GITP_PREFIX:-'['}
   local suffix=${GITP_SUFFIX:-"]"}
   local suffix=${GITP_SUFFIX:-"]"}
   local repo=$(__gitp_repo)
   local repo=$(__gitp_repo)
-  local branch=$(__gitp_branch)
-  [[ -z $branch ]] && branch=$(git describe --tags --exact-match 2>/dev/null)
-  echo "$prefix$repo:$branch:$1$suffix"
+  local deco=$(__gitp_branch)
+  [[ -z $deco ]] && deco=$(git describe --tags --exact-match 2>/dev/null)
+  echo "$prefix$repo:$deco:$1$suffix"
 }
 }
 
 
 # Determine if a repo is in the middle of an "operation" e.g. rebase, bisect.
 # Determine if a repo is in the middle of an "operation" e.g. rebase, bisect.
@@ -242,7 +242,7 @@ function __gitp_branch() {
 # This mode will simply display the location information and bare state. It is
 # This mode will simply display the location information and bare state. It is
 # useful for slow machines (e.g. tablets) or slow repositories (e.g. hundreds of
 # useful for slow machines (e.g. tablets) or slow repositories (e.g. hundreds of
 # changed files). For a more permanent setting, set the `GITP_SIMPLE` variable
 # changed files). For a more permanent setting, set the `GITP_SIMPLE` variable
-# to a non-zero string before `__gitp()` is run.
+# to a non-zero string.
 function toggle_gitp_simple() {
 function toggle_gitp_simple() {
   [[ -z $GITP_SIMPLE ]] && GITP_SIMPLE=true || GITP_SIMPLE=''
   [[ -z $GITP_SIMPLE ]] && GITP_SIMPLE=true || GITP_SIMPLE=''
 }
 }