# API Reference

## Command

class Command(name=None)

  A `Command` represents a single CLI command.

  argument(key=None)

    Get the value of a command argument.

    Parameters:

      key (str) – The argument name

    Return type:

      mixed

  ask(question, default=None)

    Prompt the user for input.

    Parameters:

      - question (str) – The question to ask

      - default (str or None) – The default value

    Return type:

      str

  call(name, options=None)

    Call another command.

    Parameters:

      - name (str) – The command name

      - options (list or None) – The options

  call_silent(name, options=None)

    Call another command silently.

    Parameters:

      - name (str) – The command name

      - options (list or None) – The options

  choice(question, choices, default=None, attempts=None, multiple=False)

    Give the user a single choice from an list of answers.

    Parameters:

      - question (str) – The question to ask

      - choices (list) – The available choices

      - default (str or None) – The default value

      - attempts (int) – The max number of attempts

      - multiple (int) – Multiselect

    Return type:

      str

  comment(text)

    Write a string as comment output.

    Parameters:

      text (str) – The line to write

  confirm(self, question, default=False, true_answer_regex='(?i)^y')

    Confirm a question with the user.

    Parameters:

      - question (str) – The question to ask

      - default (bool) – The default value

      - true_answer_regex (str) – A regex to match the “yes” answer

    Return type:

      bool

  error(text)

    Write a string as error output.

    Parameters:

      text (str) – The line to write

  info(text)

    Write a string as information output.

    Parameters:

      text (str) – The line to write

  line(text, style=None, verbosity=None)

    Write a string as information output.

    Parameters:

      - text (str) – The line to write

      - style (str) – The style of the string

      - verbosity (None or int str) – The verbosity

  list(elements)

    Write a list of elements.

    Parameters:

      elements (list) – The elements to write a list for

  option(key=None)

    Get the value of a command option.

    Parameters:

      key (str) – The option name

    Return type:

      mixed

  progress_bar(max=0)

    Create a new progress bar

    Parameters:

      max (int) – The maximum number of steps

    Return type:

      ProgressBar

  question(text)

    Write a string as question output.

    Parameters:

      text (str) – The line to write

  render_table(headers, rows, style='default')

    Format input to textual table..

    Parameters:

      - headers (list) – The table headers

      - rows (list) – The table rows

      - style (str) – The table style

  secret(question)

    Prompt the user for input but hide the answer from the console.

    Parameters:

      question (str) – The question to ask

    Return type:

      str

  set_style(name, fg=None, bg=None, options=None)

    Set a new style

    Parameters:

      - name (str) – The name of the style

      - fg (str) – The foreground color

      - bg (str) – The background color

      - options (list) – The options

  table(headers=None, rows=None, style='default')

    Return a `Table` instance.

    Parameters:

      - headers (list) – The table headers

      - rows (list) – The table rows

      - style (str) – The table style

  table_cell(value, **options)

    Return a `TableCell` instance

    Parameters:

      - value (str) – The cell value

      - options (dict) – The cell options

  table_separator()

    Return a `TableSeparator` instance

    Return type:

      TableSeparator

  table_style()

    Return a `TableStyle` instance

    Return type:

      TableStyle

  warning(text)

    Write a string as warning output.

    Parameters:

      text (str) – The line to write