Argx.WithCheck (Argx v1.0.1)
Usage
configs
keyword is necessary and it's content is not empty.define configs directly or reuse rules by name.
wrap multi functions that have different guards.
defmodule YourProject do import YourProject.Argx with_check configs( Rule, id(:integer, :optional, :auto, :empty, 1..99) || get_default_id() ) do def get(id) when is_integer(id) do {:ok, id} end def get(id) when is_bitstring(id) do {:ok, String.to_integer(id)} end end end
Configuration
config Argx
or Argx.WithCheck
module.
- set shared arg configs module.
- set warn flag.
use Argx.WithCheck, share: YourProject.ArgConfigs, warn: false