Skip to content

Commit 5e83127

Browse files
committed
docs(README): Updated examples
1 parent 647aca5 commit 5e83127

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

README.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,36 @@ $ pip install --user ptpython
2525
$ ptpython
2626
```
2727

28-
## Usage
28+
## Commands (experimental)
2929

30-
Create a [Repo](https://libvcs.git-pull.com/api.html#creating-a-repo-object) object of the project
31-
to inspect / checkout / update:
30+
Simple [`subprocess`](https://docs.python.org/3/library/subprocess.html) wrappers around `git(1)`,
31+
`hg(1)`, `svn(1)`. Here is [`Git`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git) w/
32+
[`Git.clone`](http://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.clone):
3233

3334
```python
34-
>>> from libvcs.shortcuts import create_repo_from_pip_url, create_repo
35-
36-
# repo is an object representation of a vcs repository.
37-
>>> r = create_repo(
38-
... url='https://www.github.com/vcs-python/libtmux',
39-
... vcs='git',
40-
... dir='/tmp/libtmux'
41-
... )
35+
import pathlib
36+
from libvcs.cmd.git import Git
37+
38+
git = Git(dir=pathlib.Path.cwd() / 'my_git_repo')
39+
git.clone(url='https://github.com/vcs-python/libvcs.git')
4240
```
4341

44-
Initialize via "pip-style URLs":
42+
## States
43+
44+
Create a [`GitRepo`](https://libvcs.git-pull.com/states/git.html#libvcs.states.git.GitRepo) object
45+
of the project to inspect / checkout / update:
4546

4647
```python
47-
>>> r = create_repo_from_pip_url(
48-
... pip_url='git+https://www.github.com/vcs-python/libtmux',
49-
... dir='/tmp/libtmux'
50-
... )
48+
import pathlib
49+
from libvcs.states.git import GitRepo
50+
51+
repo = GitRepo(
52+
url="https://github.com/vcs-python/libvcs",
53+
dir=pathlib.Path().cwd() / "my_repo",
54+
remotes={
55+
'gitlab': 'https://gitlab.com/vcs-python/libvcs'
56+
}
57+
)
5158
```
5259

5360
Update / clone repo:

0 commit comments

Comments
 (0)