Fossil SCM
Update the fossil_prompt.sh script so that it keeps the username and hostname part of the prompt green and only changes the path from red to green.
Commit
cca805fa894784cc983bea387a6b8844bb8b90d3c1b2dbce77778e7b8baf344f
Parent
b39475b6253408c…
1 file changed
+5
-14
+5
-14
| --- www/fossil_prompt.sh | ||
| +++ www/fossil_prompt.sh | ||
| @@ -1,6 +1,5 @@ | ||
| 1 | - | |
| 2 | 1 | #------------------------------------------------------------------------- |
| 3 | 2 | # get_fossil_data() |
| 4 | 3 | # |
| 5 | 4 | # If the current directory is part of a fossil checkout, then populate |
| 6 | 5 | # a series of global variables based on the current state of that |
| @@ -26,27 +25,20 @@ | ||
| 26 | 25 | #------------------------------------------------------------------------- |
| 27 | 26 | # set_prompt() |
| 28 | 27 | # |
| 29 | 28 | # Set the PS1 variable. If the current directory is part of a fossil |
| 30 | 29 | # checkout then the prompt contains information relating to the state |
| 31 | -# of the checkout. | |
| 30 | +# of the checkout. | |
| 32 | 31 | # |
| 33 | 32 | # Otherwise, if the current directory is not part of a fossil checkout, it |
| 34 | 33 | # is set to a fairly standard bash prompt containing the host name, user |
| 35 | 34 | # name and current directory. |
| 36 | 35 | # |
| 37 | 36 | function set_prompt() { |
| 38 | 37 | get_fossil_data |
| 39 | - if [ -n "$fossil_info_project_name" ] ; then | |
| 40 | - project=$fossil_info_project_name | |
| 41 | - checkout=`echo $fossil_info_checkout | sed 's/^\(........\).*/\1/'` | |
| 42 | - date=`echo $fossil_info_checkout | sed 's/^[^ ]* *..//' | sed 's/:[^:]*$//'` | |
| 43 | - tags=$fossil_info_tags | |
| 44 | - local_root=`echo $fossil_info_local_root | sed 's/\/$//'` | |
| 45 | - local=`pwd | sed "s*${local_root}**" | sed "s/^$/\//"` | |
| 46 | - | |
| 47 | - # Color the first part of the prompt blue if this is a clean checkout. | |
| 38 | + if [ -n "$fossil_info_project_name" ] ; then | |
| 39 | + # Color the path part of the prompt blue if this is a clean checkout | |
| 48 | 40 | # Or red if it has been edited in any way at all. Set $c1 to the escape |
| 49 | 41 | # sequence required to change the type to the required color. And $c2 |
| 50 | 42 | # to the sequence that changes it back. |
| 51 | 43 | # |
| 52 | 44 | if [ -n "`fossil chang`" ] ; then |
| @@ -53,13 +45,12 @@ | ||
| 53 | 45 | c1="\[\033[1;31m\]" # red |
| 54 | 46 | else |
| 55 | 47 | c1="\[\033[1;34m\]" # blue |
| 56 | 48 | fi |
| 57 | 49 | c2="\[\033[0m\]" |
| 58 | - | |
| 59 | - PS1="$c1${project}.${tags}$c2 ${checkout} (${date}):${local}$c1\$$c2 " | |
| 50 | + PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:$c1\w\$$c2 " | |
| 60 | 51 | else |
| 61 | - PS1="\u@\h:\w\$ " | |
| 52 | + PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\w\$ " | |
| 62 | 53 | fi |
| 63 | 54 | } |
| 64 | 55 | |
| 65 | 56 | PROMPT_COMMAND=set_prompt |
| 66 | 57 |
| --- www/fossil_prompt.sh | |
| +++ www/fossil_prompt.sh | |
| @@ -1,6 +1,5 @@ | |
| 1 | |
| 2 | #------------------------------------------------------------------------- |
| 3 | # get_fossil_data() |
| 4 | # |
| 5 | # If the current directory is part of a fossil checkout, then populate |
| 6 | # a series of global variables based on the current state of that |
| @@ -26,27 +25,20 @@ | |
| 26 | #------------------------------------------------------------------------- |
| 27 | # set_prompt() |
| 28 | # |
| 29 | # Set the PS1 variable. If the current directory is part of a fossil |
| 30 | # checkout then the prompt contains information relating to the state |
| 31 | # of the checkout. |
| 32 | # |
| 33 | # Otherwise, if the current directory is not part of a fossil checkout, it |
| 34 | # is set to a fairly standard bash prompt containing the host name, user |
| 35 | # name and current directory. |
| 36 | # |
| 37 | function set_prompt() { |
| 38 | get_fossil_data |
| 39 | if [ -n "$fossil_info_project_name" ] ; then |
| 40 | project=$fossil_info_project_name |
| 41 | checkout=`echo $fossil_info_checkout | sed 's/^\(........\).*/\1/'` |
| 42 | date=`echo $fossil_info_checkout | sed 's/^[^ ]* *..//' | sed 's/:[^:]*$//'` |
| 43 | tags=$fossil_info_tags |
| 44 | local_root=`echo $fossil_info_local_root | sed 's/\/$//'` |
| 45 | local=`pwd | sed "s*${local_root}**" | sed "s/^$/\//"` |
| 46 | |
| 47 | # Color the first part of the prompt blue if this is a clean checkout. |
| 48 | # Or red if it has been edited in any way at all. Set $c1 to the escape |
| 49 | # sequence required to change the type to the required color. And $c2 |
| 50 | # to the sequence that changes it back. |
| 51 | # |
| 52 | if [ -n "`fossil chang`" ] ; then |
| @@ -53,13 +45,12 @@ | |
| 53 | c1="\[\033[1;31m\]" # red |
| 54 | else |
| 55 | c1="\[\033[1;34m\]" # blue |
| 56 | fi |
| 57 | c2="\[\033[0m\]" |
| 58 | |
| 59 | PS1="$c1${project}.${tags}$c2 ${checkout} (${date}):${local}$c1\$$c2 " |
| 60 | else |
| 61 | PS1="\u@\h:\w\$ " |
| 62 | fi |
| 63 | } |
| 64 | |
| 65 | PROMPT_COMMAND=set_prompt |
| 66 |
| --- www/fossil_prompt.sh | |
| +++ www/fossil_prompt.sh | |
| @@ -1,6 +1,5 @@ | |
| 1 | #------------------------------------------------------------------------- |
| 2 | # get_fossil_data() |
| 3 | # |
| 4 | # If the current directory is part of a fossil checkout, then populate |
| 5 | # a series of global variables based on the current state of that |
| @@ -26,27 +25,20 @@ | |
| 25 | #------------------------------------------------------------------------- |
| 26 | # set_prompt() |
| 27 | # |
| 28 | # Set the PS1 variable. If the current directory is part of a fossil |
| 29 | # checkout then the prompt contains information relating to the state |
| 30 | # of the checkout. |
| 31 | # |
| 32 | # Otherwise, if the current directory is not part of a fossil checkout, it |
| 33 | # is set to a fairly standard bash prompt containing the host name, user |
| 34 | # name and current directory. |
| 35 | # |
| 36 | function set_prompt() { |
| 37 | get_fossil_data |
| 38 | if [ -n "$fossil_info_project_name" ] ; then |
| 39 | # Color the path part of the prompt blue if this is a clean checkout |
| 40 | # Or red if it has been edited in any way at all. Set $c1 to the escape |
| 41 | # sequence required to change the type to the required color. And $c2 |
| 42 | # to the sequence that changes it back. |
| 43 | # |
| 44 | if [ -n "`fossil chang`" ] ; then |
| @@ -53,13 +45,12 @@ | |
| 45 | c1="\[\033[1;31m\]" # red |
| 46 | else |
| 47 | c1="\[\033[1;34m\]" # blue |
| 48 | fi |
| 49 | c2="\[\033[0m\]" |
| 50 | PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:$c1\w\$$c2 " |
| 51 | else |
| 52 | PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\w\$ " |
| 53 | fi |
| 54 | } |
| 55 | |
| 56 | PROMPT_COMMAND=set_prompt |
| 57 |