W3cubDocs

/Elixir 1.11

Mix.Shell.IO

This is Mix's default shell.

It simply prints messages to stdio and stderr.

Summary

Functions

cmd(command, opts \\ [])

Executes the given command and prints its output to stdout as it comes.

error(message)

Prints the given ANSI error to the shell followed by a newline.

info(message)

Prints the given ANSI message to the shell followed by a newline.

print_app()

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

prompt(message)

Prints a message and prompts the user for input.

yes?(message)

Prints a message and asks the user if they want to proceed.

Functions

cmd(command, opts \\ [])

Executes the given command and prints its output to stdout as it comes.

error(message)

Prints the given ANSI error to the shell followed by a newline.

info(message)

Prints the given ANSI message to the shell followed by a newline.

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

prompt(message)

Prints a message and prompts the user for input.

Input will be consumed until Enter is pressed.

yes?(message)

Prints a message and asks the user if they want to proceed.

The user must press Enter or type one of "y", "yes", "Y", "YES" or "Yes".

Examples

if Mix.shell().yes?("Are you sure?") do
  # do something...
end

© 2012 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/mix/1.11.2/Mix.Shell.IO.html