You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.2 KiB

  1. -module({{name}}_prv).
  2. -export([init/1, do/1, format_error/1]).
  3. -define(PROVIDER, {{name}}).
  4. -define(DEPS, [app_discovery]).
  5. %% ===================================================================
  6. %% Public API
  7. %% ===================================================================
  8. -spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
  9. init(State) ->
  10. Provider = providers:create([
  11. {name, ?PROVIDER}, % The 'user friendly' name of the task
  12. {module, ?MODULE}, % The module implementation of the task
  13. {bare, true}, % The task can be run by the user, always true
  14. {deps, ?DEPS}, % The list of dependencies
  15. {example, "rebar3 {{name}}"}, % How to use the plugin
  16. {opts, []}, % list of options understood by the plugin
  17. {short_desc, "{{desc}}"},
  18. {desc, "{{desc}}"}
  19. ]),
  20. {ok, rebar_state:add_provider(State, Provider)}.
  21. -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
  22. do(State) ->
  23. {ok, State}.
  24. -spec format_error(any()) -> iolist().
  25. format_error(Reason) ->
  26. io_lib:format("~p", [Reason]).