diff options
author | Leonid Volnitsky <Leonid@Volnitsky.com> | 2009-07-01 20:00:45 +0300 |
---|---|---|
committer | Leonid Volnitsky <Leonid@Volnitsky.com> | 2009-07-01 20:00:45 +0300 |
commit | d2b9f309bb213db2ed64484c78a6627834bbcd5c (patch) | |
tree | bb7979c25f3dea5ca2b18803d95b79ad3e560a8f /git-prompt.sh | |
parent | -- cwd_truncate() -- no external cmd implementation (diff) | |
download | git-prompt-d2b9f309bb213db2ed64484c78a6627834bbcd5c.tar.gz git-prompt-d2b9f309bb213db2ed64484c78a6627834bbcd5c.tar.bz2 git-prompt-d2b9f309bb213db2ed64484c78a6627834bbcd5c.zip |
cwd_cmd selector
Diffstat (limited to 'git-prompt.sh')
-rwxr-xr-x | git-prompt.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/git-prompt.sh b/git-prompt.sh index eb6a11b..ce09210 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -160,7 +160,7 @@ cwd_truncate() { [[ $truncate_pwd != "on" ]] && return - local pwd_length=10 + local pwd_length=$1 # Get the current working directory. We'll format it in $dir. local dir="$PWD" @@ -196,7 +196,7 @@ cwd_truncate() { dir="$tilde/...$directory" fi - pwd="$dir" + cwd="$dir" } @@ -576,9 +576,12 @@ prompt_command_function() { set_shell_title "$PWD/" parse_vcs_status - #truncate_working_directory - cwd_truncate - PS1="$colors_reset$rc$head_local$label$color_who_where$dir_color$pwd$tail_local$dir_color> $colors_reset" + + # if cwd_cmd have back-slash, then assign it value to cwd + # else eval cmd_cmd, cwd should have path after exection + eval "${cwd_cmd/\\/cwd=\\\\}" + + PS1="$colors_reset$rc$head_local$label$color_who_where$dir_color$cwd$tail_local$dir_color> $colors_reset" unset head_local tail_local pwd } |