Getting started
View SourceThis guide is an introduction to the Etiquette library and,
more specifically, to how to use the Etiquette.Spec module
to create packet specifications.
Adding Etiquette to a project
Adding Etiquette as a dependency is very straightforward.
Simply add:etiquette to the mix.exs file in your project.
defp deps do
[
{:etiquette, "~> 0.1.0"}
]
endNext, install the dependencies by running
mix deps.getAfter that, to use the formatter rules of the library, add the following to the
.formatter.exs file in your project:
[
# Add this line to enable the Etiquette formatter rules.
import_deps: [:etiquette],
# Default Elixir project rules
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]With all that done, now all it takes to use the
Etiquette.Spec is to use
Etiquette.Spec in a module:
defmodule PacketSpec do
use Etiquette.Spec
packet "Example packet" do
field "First field", 4
field "Second field", 4
end
endTo learn about all the possibilities provided by
Etiquette.Spec, keep reading the guides that follow.