Mix v1.1.1 Mix.Shell behaviour

Defines Mix.Shell contract.

Summary

Functions

An implementation of the command callback that is shared across different shells

Returns the printable app name

Callbacks

Executes the given command and returns its exit status

Executes the given command and returns its exit status

Warns about the given error message

Informs the given message

Prints the current application to shell if it was not printed yet

Prompts the user for input

Asks the user for confirmation

Functions

cmd(command, options \\ [], callback)

An implementation of the command callback that is shared across different shells.

printable_app_name()

Returns the printable app name.

This function returns the current application name but only if the application name should be printed.

Calling this function automatically toggles its value to false until the current project is re-entered. The goal is to exactly avoid printing the application name multiple times.

Callbacks

cmd(command)

Specs

cmd(command :: String.t) :: integer

Executes the given command and returns its exit status.

cmd(command, options)

Specs

cmd(command :: String.t, options :: Keyword.t) :: integer

Executes the given command and returns its exit status.

Options

  • :print_app - when false, does not print the app name when the command outputs something

  • :stderr_to_stdout - when false, does not redirect stderr to stdout

  • :quiet - when true, do not print the command output

  • :env - environment options to the executed command
error(message)

Specs

error(message :: IO.ANSI.ansidata) :: any

Warns about the given error message.

info(message)

Specs

info(message :: IO.ANSI.ansidata) :: any

Informs the given message.

print_app()

Specs

print_app :: any

Prints the current application to shell if it was not printed yet.

prompt(message)

Specs

prompt(message :: String.t) :: String.t

Prompts the user for input.

yes?(message)

Specs

yes?(message :: String.t) :: boolean

Asks the user for confirmation.