LoginSignup
1
0

More than 5 years have passed since last update.

svnのブランチ名をプロンプトへ

Last updated at Posted at 2012-03-16

__git_ps1と大体同じように使える

$ __my_svn_ps1 [SVN:%s]
__my_parse_svn_branch2() {
    local LANG=C
    local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p')
    local svn_repository_root=$(svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p')
    echo ${svn_url} | sed -e 's#^'"${svn_repository_root}"'##g' | awk '{print $1}'
}

__my_svn_ps1(){
    local svn_branch=$(__my_parse_svn_branch2)
    test "${svn_branch}" == "" || echo ${svn_branch} | xargs printf "$1"
}

参考
* http://hocuspokus.net/2009/07/add-git-and-svn-branch-to-bash-prompt/

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0