Skip to content

Commit cec1abb

Browse files
author
Gabriel Chamon Araujo
authored
Update README.md
1 parent 7e6f4bb commit cec1abb

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# sysrsync
22
Python module that wraps system calls to rsync
33

4+
## Requirements
5+
6+
* rsync
7+
* python 3.6+
8+
9+
**development**:
10+
11+
* pipenv (be sure to have both pipenv and pip upgraded to the latest version)
12+
413
## Usage
514

615
* Basic file sync
716

8-
```
17+
```python
918
import sysrsync
1019

1120
sysrsync.run(source='/home/user/foo.txt',
@@ -15,7 +24,7 @@ sysrsync.run(source='/home/user/foo.txt',
1524

1625
* ssh with options
1726

18-
```
27+
```python
1928
import sysrsync
2029

2130
sysrsync.run(source='/home/user/files',
@@ -27,7 +36,7 @@ sysrsync.run(source='/home/user/files',
2736

2837
* exclusions
2938

30-
```
39+
```python
3140
import sysrsync
3241

3342
sysrsync.run(source='/home/user/files',
@@ -49,11 +58,22 @@ sysrsync.run(source='/home/user/files',
4958
| verbose | bool | `False` | verbose mode: currently prints rsync command before executing |
5059
| **kwargs | dict | Not Applicable | arguments that will be forwarded to call to `sysrsync.get_rsync_command` |
5160

61+
**returns**: `subprocess.CompletedProcess`
62+
63+
**raises**: `RsyncError` when `strict = True` and rsync return code is different than 0 ([Success](https://lxadm.com/Rsync_exit_codes#List_of_standard_rsync_exit_codes))
64+
5265
`sysrsync.get_rsync_command`
5366

5467
| argument | type | default | description |
5568
| --------- | ---- | ------- | ----------- |
69+
| source | str | - | Source folder or file |
70+
| destination | str | - | Destination folder |
71+
| source_ssh | Optional[str] | None | Remote ssh client where source is located |
72+
| destination_ssh | Optional[str] | None | Remote ssh client where destination is located |
73+
| exclusions | Iterable[str] | [] | List of excluded patterns as in rsync's `--exclude` |
74+
| sync_source_contents | bool | True | Abstracts the elusive trailing slash behaviour that `source` normally has when using rsync directly, i.e. when a trailing slash is present in `source`, the folder's content is synchronized with destination. When no trailing slash is present, the folder itself is synchronized with destination. |
75+
| options | Iterable[str] | [] | List of options to be used right after rsync call, e.g. `['-a', '-v']` translates to `rsync -a -v` |
5676

77+
**returns**: `List[str]` -> the compiled list of commands to be used directly in `subprocess.run`
5778

58-
59-
##
79+
**raises**: `RemotesError` when both `source_ssh` and `target_ssh` are set. Normally linux rsync distribution disallows source and destination to be both remotes.

0 commit comments

Comments
 (0)