Mix.Shell behaviour View Source
Defines Mix.Shell
contract.
Link to this section Summary
Functions
Executes the given command
as a shell command and
invokes the callback
for the streamed response
Returns the printable app name
Callbacks
Executes the given command and returns its exit status
Executes the given command and returns its exit status
Prints the given ANSI error to the shell
Prints the given ANSI message to the shell
Prints the current application to the shell if it was not printed yet
Prompts the user for input
Prompts the user for confirmation
Link to this section Functions
cmd(command, options \\ [], callback) View Source
Executes the given command
as a shell command and
invokes the callback
for the streamed response.
This is most commonly used by shell implementations but can also be invoked directly.
Options
:stderr_to_stdout
- redirects stderr to stdout, defaults to true:env
- a list of environment variables, defaults to[]
:quiet
- overrides the callback to no-op
printable_app_name() View Source
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 avoid printing the application name
multiple times.
Link to this section Callbacks
cmd(command) View Source
Executes the given command and returns its exit status.
cmd(command, options) View Source
Executes the given command and returns its exit status.
Options
:print_app
- whenfalse
, does not print the app name when the command outputs something:stderr_to_stdout
- whenfalse
, does not redirect stderr to stdout:quiet
- whentrue
, do not print the command output:env
- environment options to the executed command
error(message)
View Source
error(message :: IO.ANSI.ansidata()) :: :ok
error(message :: IO.ANSI.ansidata()) :: :ok
Prints the given ANSI error to the shell.
info(message)
View Source
info(message :: IO.ANSI.ansidata()) :: :ok
info(message :: IO.ANSI.ansidata()) :: :ok
Prints the given ANSI message to the shell.
print_app()
View Source
print_app() :: :ok
print_app() :: :ok
Prints the current application to the shell if it was not printed yet.
prompt(message) View Source
Prompts the user for input.
yes?(message) View Source
Prompts the user for confirmation.