mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-26 21:51:05 +01:00
Clean up svn README
This commit is contained in:
parent
364019a3c9
commit
f573247a59
1 changed files with 53 additions and 50 deletions
|
@ -1,42 +1,45 @@
|
||||||
# `svn` plugin
|
# `svn` plugin
|
||||||
|
|
||||||
This plugin adds some utility functions to display additional information regarding your current
|
This plugin adds some utility functions to display additional information regarding your current
|
||||||
svn repsitiory. See http://subversion.apache.org/ for the full svn documentation.
|
svn repository. See http://subversion.apache.org/ for the full svn documentation.
|
||||||
|
|
||||||
|
To use it, add `svn` to your plugins array:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... svn)
|
||||||
|
```
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|:-----------------------|:----------------------------------------|
|
|:----------------------|:--------------------------------------------|
|
||||||
|svn_prompt_info | prompt for some themes |
|
| `svn_prompt_info` | Shows svn prompt in themes |
|
||||||
|in_svn | within svn directory |
|
| `in_svn` | Checks if we're in an svn repository |
|
||||||
|svn_get_repo_name | |
|
| `svn_get_repo_name` | Get repository name |
|
||||||
|svn_get_branch_name | branch name (see caveats) |
|
| `svn_get_branch_name` | Get branch name (see [caveats](#caveats)) |
|
||||||
|svn_get_rev_nr | revision number |
|
| `svn_get_rev_nr` | Get revision number |
|
||||||
|svn_dirty | changes in this subversion repo |
|
| `svn_dirty` | Checks if there are changes in the svn repo |
|
||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
The plugin expects the first directory to be the current branch / tag / trunk. So, it returns
|
The plugin expects the first directory to be the current branch / tag / trunk. So it returns
|
||||||
the first path element if you don't use branches.
|
the first path element if you don't use branches.
|
||||||
|
|
||||||
## Usage
|
## Usage on themes
|
||||||
|
|
||||||
To use it, add `svn` to your plugins array:
|
To use this in the `agnoster` theme follow these instructions:
|
||||||
```sh
|
|
||||||
plugins=(... svn)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Agnoster theme git-like prompt
|
1. Enable the svn plugin
|
||||||
|
|
||||||
Enable the svn plugin and add the followind lines to your ```~/.zshrc```
|
2. Add the following lines to your `zshrc` file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
prompt_svn() {
|
prompt_svn() {
|
||||||
local rev branch
|
local rev branch
|
||||||
if in_svn; then
|
if in_svn; then
|
||||||
rev=$(svn_get_rev_nr)
|
rev=$(svn_get_rev_nr)
|
||||||
branch=$(svn_get_branch_name)
|
branch=$(svn_get_branch_name)
|
||||||
if [ `svn_dirty_choose_pwd 1 0` -eq 1 ]; then
|
if [[ $(svn_dirty_choose_pwd 1 0) -eq 1 ]]; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
echo -n "$rev@$branch"
|
echo -n "$rev@$branch"
|
||||||
echo -n "±"
|
echo -n "±"
|
||||||
|
@ -45,13 +48,13 @@ prompt_svn() {
|
||||||
echo -n "$rev@$branch"
|
echo -n "$rev@$branch"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
override the agnoster build_prompt() function:
|
3. Override the agnoster `build_prompt()` function:
|
||||||
|
|
||||||
```shell
|
```zsh
|
||||||
build_prompt() {
|
build_prompt() {
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
prompt_status
|
prompt_status
|
||||||
prompt_context
|
prompt_context
|
||||||
|
@ -59,6 +62,6 @@ build_prompt() {
|
||||||
prompt_git
|
prompt_git
|
||||||
prompt_svn
|
prompt_svn
|
||||||
prompt_end
|
prompt_end
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue