diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-17 12:20:32 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-17 12:20:32 +1200 |
commit | f28bdd85fc67f675d3d72e9cbb298333bd4eee9d (patch) | |
tree | e92981176f60c91154ab6935fcb2b0448deecd00 /bash/bashrc.d/prompt.bash | |
parent | Explicitly define all Newsbeuter colors (diff) | |
download | dotfiles-f28bdd85fc67f675d3d72e9cbb298333bd4eee9d.tar.gz dotfiles-f28bdd85fc67f675d3d72e9cbb298333bd4eee9d.zip |
Rewrite svn info parsing using builtins
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 34c9ae87..2a21cb1d 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -147,9 +147,17 @@ prompt() { fi # Determine the repository URL and root directory - local info=$(svn info 2>/dev/null) - local url=$(awk -F': ' '$1 == "URL" {print $2}' <<<"$info") - local root=$(awk -F': ' '$1 == "Repository Root" {print $2}' <<<"$info") + local url root + while IFS=: read key value; do + case $key in + 'URL') + url=${value## } + ;; + 'Repository Root') + root=${value## } + ;; + esac + done < <(svn info 2>/dev/null) # Remove the root from the URL to get what's hopefully the branch # name, removing leading slashes and the 'branches' prefix, and any |