Ecobolic

A small library to help your chatbot's users.

This library aims to provide a simple way of declaring and accessing documentations meant for users. This was build mainly to ease the implementation of the well-known help command, that many chat-bots provide.

Usage

Declaring

The first step is to use the Ecbolic module in the module you want to declare your documentations:

defmodule TestModule do
use Ecbolic

Then you can add document your functions like this:

@doc help: "returns `:world`"
@doc """
It's thanks to the 1.7 elixir update that we can add meta data to the @doc annotation
"""
def hello, do: :world

At the start of your Application, or whenever you need it, you must load the documentation with with load_help/0

Testmodule.load_help()

Accessing

To access the documentations you can call the function Ecbolic.help, which comes in a variaty of forms:

Example

iex> Ecbolic.help(:hello)
"returns `:world`"

Formating

The module Ecbolic.Pretty provides some basic formating:

iex(1)> Ecbolic.Pretty.format(:hello)
"hello - returns `world`"

You can provide your own format as a second parameter to Ecbolic.Pretty.format/2. The default format is ":f - :h"

Currently these are the tokens available for formating:

Installation

If available in Hex, the package can be installed by adding ecbolic to your list of dependencies in mix.exs:

def deps do
[
{:ecbolic, "~> 0.1.0"}
]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ecbolic.