10ffa4fe992e56a93396ed8914eba74821bb2cca

Author
Christian Ferbar <christian.ferbar@gmx.net>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add README to svn plugin

Diff

 1diff --git a/plugins/svn/README.md b/plugins/svn/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..b8eff70f56b2413a4ba2431572a9a4286737e2f1
 4--- /dev/null
 5+++ b/plugins/svn/README.md
 6@@ -0,0 +1,64 @@
 7+# `svn` plugin
 8+
 9+This plugin adds some utility functions to display additional information regarding your current
10+svn repsitiory. See http://subversion.apache.org/ for the full svn documentation.
11+
12+## Functions
13+
14+| Command                | Description                             |
15+|:-----------------------|:----------------------------------------|
16+|svn_prompt_info         | prompt for some themes                  |
17+|in_svn                  | within svn directory                    |
18+|svn_get_repo_name       |                                         |
19+|svn_get_branch_name     | branch name (see caveats)              |
20+|svn_get_rev_nr          | revision number                         |
21+|svn_dirty               | changes in this subversion repo         |
22+
23+## Caveats
24+
25+The plugin expects the first directory to be the current branch / tag / trunk. So, it returns
26+the first path element if you don't use branches.
27+
28+## Usage
29+
30+To use it, add `svn` to your plugins array:
31+```sh
32+plugins=(... svn)
33+```
34+
35+### Agnoster theme git-like prompt
36+
37+Enable the svn plugin and add the followind lines to your ```~/.zshrc```
38+
39+```shell
40+prompt_svn() {
41+    local rev branch
42+    if in_svn; then
43+        rev=$(svn_get_rev_nr)
44+        branch=$(svn_get_branch_name)
45+        if [ `svn_dirty_choose_pwd 1 0` -eq 1 ]; then
46+            prompt_segment yellow black
47+            echo -n "$rev@$branch"
48+            echo -n "±"
49+        else
50+            prompt_segment green black
51+            echo -n "$rev@$branch"
52+        fi
53+    fi
54+}
55+```
56+
57+override the agnoster build_prompt() function:
58+
59+```shell
60+build_prompt() {
61+    RETVAL=$?
62+    prompt_status
63+    prompt_context
64+    prompt_dir
65+    prompt_git
66+    prompt_svn
67+    prompt_end
68+}
69+```
70+