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.

33 line
1.2 KiB

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