Medic.Check (Medic v1.2.2) View Source

Reusable check functions

Link to this section Summary

Types

Valid return values from a check.

Functions

Usable within a check. If the command exits with a 0 status code, then :ok, is returned. If the command returns a non-zero status code, then {:error, output, remedy} is returned, where output is any text generated by the command.

Link to this section Types

Specs

check_return_t() ::
  :ok
  | :skipped
  | {:warn, output :: binary()}
  | {:error, output :: binary(), remedy :: binary()}

Valid return values from a check.

  • :ok - The check succeeded with no problems.
  • :skipped - Doctor checks for files in .medic/skipped/ to skip a check. Custom checks could return this to notify Doctor that they chose internally to skip the check.
  • {:warn, output} - The check generated warnings, but does not stop Doctor from proceeding.
  • {:error, output, remedy} - The check failed. Output may be stdout and/or stderr generated from shell commands, or custom error output to show to the user. The remedy will by copied into the local paste buffer.

Link to this section Functions

Link to this function

command_succeeds?(command, args, list)

View Source

Specs

command_succeeds?(binary(), [binary()], [{:remedy, binary()}]) ::
  :ok | {:error, binary(), binary()}

Usable within a check. If the command exits with a 0 status code, then :ok, is returned. If the command returns a non-zero status code, then {:error, output, remedy} is returned, where output is any text generated by the command.

Link to this function

in_list?(item, list, list)

View Source
Link to this function

skipped?(module, function, args)

View Source