Introduction

Anatomy of Hatcher Commands

The Hatcher CLI is built around a hierarchy of commands. The top-level command specified the type of object with which the user wishes to interact. Each level of command narrows down the interaction until the final command specifies the actual interaction the user wishes to perform. In most cases there are only two levels of commands: The object type and the interaction. For example, if the user wishes to create a new Brood API token, the following command might be used:

$ hatcher api-tokens create hatcher-tutorial

The api-tokens command specifies that the user is interacting with API tokens, followed by the create sub-command to create a new token. Following the create sub-command is the only required argument for this command, the name of the new token.

An example of a more complex command involving multiple sub-commands is when an administrator wishes to allow a team to access a new repository:

$ hatcher teams repositories add enthought internal-dev-team internal-dev-repository

Here, the teams command specifies that the user is interacting with a team. The repositories sub-command specifies that the user is manipulating the repositories that a team has access to. Finally, the user is adding access to a repository from a team with the add command. All arguments following this are the required arguments for this interaction.

Getting help

For information on a specific command, the --help option can be provided at any level:

$ hatcher --help
Usage: hatcher [OPTIONS] COMMAND [ARGS]...

  A command-line interface to Brood.

Options:
  -u, --url TEXT       The URL of the Brood server.  [required]
  -U, --username TEXT  Username for authentication.
  -p, --password TEXT  Password for authentication. If --username is given but
                       password is omitted, hatcher will prompt for a
                       password.
  -k, --insecure       Disable SSL certificate validation.
  --command-tree       Print the full hatcher command tree.
  --version            Show the version and exit.
  --help               Show this message and exit.

Commands:
  api-tokens     Perform API token actions
  apps           Perform operations on apps.
  eggs           Perform operations on eggs.
  organizations  Perform operations on organizations.
  repositories   Perform operations on repositories.
  runtimes       Perform operations on runtimes.
  teams          Perform operations on a team.
  users          Perform operations on users.

Or for getting help on a sub-command:

$ hatcher eggs list --help
Usage: hatcher eggs list [OPTIONS] ORGANIZATION REPOSITORY PLATFORM

  List all eggs in a repository

Options:
  --help  Show this message and exit.

For a quick overview of all commands supported by Hatcher, the --command-tree option can be used. This simply prints the tree of commands understood by Hatcher, along with the command’s argument specification:

$ hatcher --command-tree
hatcher
    api-tokens
        create         [OPTIONS] NAME
        delete         [OPTIONS] NAME
        list           [OPTIONS]
    apps
        list           [OPTIONS] ORGANIZATION REPOSITORY PLATFORM
        metadata       [OPTIONS] ORGANIZATION REPOSITORY PLATFORM APP_ID VERSION
        upload         [OPTIONS] ORGANIZATION REPOSITORY FILENAME
    eggs
        batch-upload   [OPTIONS] ORGANIZATION REPOSITORY PLATFORM [EGGS]...
        delete         [OPTIONS] ORGANIZATION REPOSITORY PLATFORM NAME VERSION
        download       [OPTIONS] ORGANIZATION REPOSITORY PLATFORM NAME VERSION [DESTINATION]
        list           [OPTIONS] ORGANIZATION REPOSITORY PLATFORM
        upload         [OPTIONS] ORGANIZATION REPOSITORY PLATFORM FILENAME
...