Update README
Show more capabilities of the elixir part
This commit is contained in:
17
README.md
17
README.md
@@ -33,24 +33,25 @@ Workdir = geef_repo:workdir(Repo).
|
|||||||
Elixir
|
Elixir
|
||||||
======
|
======
|
||||||
|
|
||||||
There are wrappers for elixir which make use of some elixir-specific
|
Most functions are available from the elixir modules so you can make use of some elixir-specific
|
||||||
things, like `Repository.open!`, or `Reference.resolve!`.
|
things, like `Repository.open!`, or `Reference.resolve!`.
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
alias Geef.Repository
|
alias Geef.Repository
|
||||||
alias Geef.Reference
|
alias Geef.Reference
|
||||||
repo = Repository.open!(".")
|
repo = Repository.open!(".")
|
||||||
ref = Reference.lookup!(repo. "HEAD") |> Reference.resolve!
|
ref = Reference.lookup!(repo, "HEAD") |> Reference.resolve!
|
||||||
```
|
```
|
||||||
|
|
||||||
Of course, you could also do
|
references, objects, etc are elixir records. Trees implement the Access protocol
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
ref = Repository.open! "." |> Reference.lookup! "HEAD" |> Reference.resolve!
|
Reference[name: name] = Reference.lookup!(repo, "refs/heads/master")
|
||||||
|
IO.puts name
|
||||||
|
{:ok, tree} = Tree.lookup(repo, "abcde...")
|
||||||
|
IO.inspect tree["src/geef_pkt.erl"]
|
||||||
```
|
```
|
||||||
|
|
||||||
but then you would leak the repository process.
|
|
||||||
|
|
||||||
CONTRIBUTING
|
CONTRIBUTING
|
||||||
==============
|
==============
|
||||||
|
|
||||||
@@ -61,8 +62,8 @@ for the topic), send a pull request.
|
|||||||
AUTHORS
|
AUTHORS
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Scott Chacon <schacon@gmail.com>
|
* Carlos Martín Nieto <cmn@dwim.me>
|
||||||
Carlos Martín Nieto <cmn@dwim.me>
|
* Scott Chacon <schacon@gmail.com>
|
||||||
|
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
|
|||||||
Reference in New Issue
Block a user