1.7.8.3 declare(Resource, Max)

-spec declare(resource(), pos_integer()) -> ok.

Declare a new resource type identified by token Resource with initial capacity Max. This function should be called by the plugin in its ‘init/0’ callback.

In order to make the resource capacity configurable by the user, it should be also declared in the plugin’s configuration model as a value of non_neg_integer() type and with anvl_resource metatype. For example:

project_model() ->
 #{git =>
    #{max_jobs =>
       {[value, cli_param, anvl_resource],
           #{ type => non_neg_integer()
            , default => 5
            , cli_operand => "j-git"
            , anvl_resource => git
            }},
     ...

Then the user can adjust the capacity via CLI: anvl --j-git 10 ...

JavaScript license information