From 1df7939d4c8dcd3a192178178d7c552d1935b436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 5 Jun 2013 01:46:01 +0200 Subject: [PATCH] Better elixir example in README --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 771b6f1..d978ba7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ in it. $ git clone git://github.com/carlosmn/geef.git $ cd geef $ make + $ mix # if you want to build the elixir modules The API looks basically like this: @@ -32,15 +33,24 @@ Workdir = geef_repo:workdir(Repo). Elixir ====== -Some effort is made to let elixir programmers use the library in a -more OO fashion. As an example, you can resolve a reference by calling -a `resolve` method on it. +There are wrappers for elixir which make use of some elixir-specific +things, like `Repository.open!`, or `Reference.resolve!`. ```elixir -{ :ok, original_ref } = :geef_ref.lookup(repo, refname) -{ :ok, resolved_ref } = original_ref.resolve() +alias Geef.Repository +alias Geef.Reference +repo = Repository.open!(".") +ref = Reference.lookup!(repo. "HEAD") |> Reference.resolve! ``` +Of course, you could also do + +```elixir +ref = Repository.open! "." |> Reference.lookup! "HEAD" |> Reference.resolve! +``` + +but then you would leak the repository process. + CONTRIBUTING ==============