Argx.Defconfig (Argx v1.0.1)
Reuse arg config rule by name.
- config name, arg name and type are necessary.
defconfig(Rule, id(:integer))Ruleis config name.:Rule,Ruleor"Rule"are acceptable.idis arg name.:stringis type.
:optionaldeclare arg's value that can be nil.defconfig(Rule, id(:integer, :optional)):autodeclare that argx convert it to integer value automatically if it is compatible."1"to1"1.2"to1.21to1.01totrue0tofalse"1"totrue"0"tofalsedefconfig(Rule, id(:integer, :auto))
:emptyempty value the same as nil, the following values are empty.00.0""%{}[]defconfig(Rule, id(:integer, :empty))
- range: there are 2 ways to set value's range.
10..20, between 10 and 20, also include begin value and end value.20, equal to 20.defconfig(Rule, id(:integer, 10..20)):list,:mapand:stringvalue calculate it's length or size.:integerand:floatvalue compare it's value directly.:booleanvalue will be ignored.
- default: there are 3 ways to set value's default value.
- a value, such as:
1. - local function.
- remote function, module name should be fully-qualified name, such as:
YourProject.Helper.defconfig(Rule, id(:integer) || 0) defconfig(Rule, id(:integer) || get_default_id()) defconfig(Rule, id(:integer) || YourProject.Helper.get_default_id())
- a value, such as:
- multi configs: define them in one rule.
defconfig(Rule, [id(:integer), name(:string)])