Add optional callbacks to the command behaviour

This commit is contained in:
Daniil Fedotov 2016-11-04 11:29:14 +00:00
parent aaabab1fe9
commit 603dfd4cf0
1 changed files with 10 additions and 2 deletions

View File

@ -25,5 +25,13 @@ defmodule RabbitMQ.CLI.CommandBehaviour do
@callback aliases() :: Keyword.t
# Coerces run/2 return value into the standard command output form
# that is then formatted, printed and returned as an exit code.
@callback output(any, Map.t) :: :ok | {:ok, any} | {:stream, Enum.t} | {:error, ExitCodes.exit_code, [String.t]}
# There is a default implementation for this callback in DefaultOutput module
@callback output(any, Map.t) :: :ok | {:ok, any} | {:stream, Enum.t} |
{:error, ExitCodes.exit_code, [String.t]}
@optional_callbacks formatter: 0,
scopes: 0,
usage_additional: 0
@callback formatter() :: Atom.t
@callback scopes() :: [Atom.t]
@callback usage_additional() :: String.t | [String.t]
end