zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

README.md (2455B)


      1 [![Hex version badge](https://img.shields.io/hexpm/v/erlex.svg)](https://hex.pm/packages/erlex)
      2 [![License badge](https://img.shields.io/hexpm/l/erlex.svg)](https://github.com/asummers/erlex/blob/master/LICENSE.md)
      3 [![Build status badge](https://img.shields.io/circleci/project/github/asummers/erlex/master.svg)](https://circleci.com/gh/asummers/erlex/tree/master)
      4 [![Code coverage badge](https://img.shields.io/codecov/c/github/asummers/erlex/master.svg)](https://codecov.io/gh/asummers/erlex/branch/master)
      5 
      6 # Erlex
      7 
      8 Convert Erlang style structs and error messages to equivalent Elixir.
      9 
     10 Useful for pretty printing things like Dialyzer errors and Observer
     11 state. NOTE: Because this code calls the Elixir formatter, it requires
     12 Elixir 1.6+.
     13 
     14 ## Documentation
     15 [Hex Docs](https://hexdocs.pm/erlex).
     16 
     17 ## Changelog
     18 
     19 Check out the [Changelog](https://github.com/asummers/erlex/blob/master/CHANGELOG.md).
     20 
     21 ## Installation
     22 
     23 The package can be installed from Hex by adding `erlex` to your list
     24 of dependencies in `mix.exs`:
     25 
     26 ```elixir
     27 def deps do
     28   [
     29     {:erlex, "~> 0.2"},
     30   ]
     31 end
     32 ```
     33 
     34 ## Usage
     35 
     36 Invoke `Erlex.pretty_print/1` with the input string.
     37 
     38 ```elixir
     39 iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map()) -> 'Elixir.Plug.Conn':t()"
     40 iex> Erlex.pretty_print(str)
     41 (Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
     42 ```
     43 
     44 While the lion's share of the work is done via invoking
     45 `Erlex.pretty_print/1`, other higher order functions exist for further
     46 formatting certain messages by running through the Elixir formatter.
     47 Because we know the previous example is a type, we can invoke the
     48 `Erlex.pretty_print_contract/1` function, which would format that
     49 appropriately for very long lines.
     50 
     51 ```elixir
     52 iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map(), map() | atom(), non_neg_integer(), binary(), binary(), binary(), binary(), binary()) -> 'Elixir.Plug.Conn':t()"
     53 iex> Erlex.pretty_print_contract(str)
     54 (
     55   Plug.Conn.t(),
     56   binary() | atom(),
     57   Keyword.t() | map(),
     58   map() | atom(),
     59   non_neg_integer(),
     60   binary(),
     61   binary(),
     62   binary(),
     63   binary(),
     64   binary()
     65 ) :: Plug.Conn.t()
     66 ```
     67 ## Contributing
     68 
     69 We welcome contributions of all kinds! To get started, click [here](https://github.com/asummers/erlex/blob/master/CONTRIBUTING.md).
     70 
     71 ## Code of Conduct
     72 
     73 Be sure to read and follow the [code of conduct](https://github.com/asummers/erlex/blob/master/code-of-conduct.md).