Skip to content

REPL

Harbor-CLI has a built-in REPL (Read-Eval-Print-Loop) that can be used to interactively run commands. This is useful for testing out commands and exploring the API.

The REPL is automatically generated by click-repl.

Starting the REPL

Start the REPL:

harbor repl

The REPL provides auto-complete for commands and options as you type. Completion can be triggered with the TAB key.

REPL Commands

REPL-specific help can be displayed with the :help command:

> :help
REPL help:

  External Commands:
    prefix external commands with "!"

  Internal Commands:
    prefix internal commands with ":"
    :exit, :q, :quit  exits the repl
    :?, :h, :help     displays general help information

Quit the REPL with the :q/:quit command or press CTRL+D:

> :quit

Application help

The regular application help text can be displayed with --help:

> --help

 Usage: harbor  [OPTIONS] COMMAND [ARGS]...

# ...

Options

To use top-level options, specify them before the subcommand as usual:

> --format json system volumes
{
  "storage": [
    {
      "total": 912470835200,
      "free": 99034193920
    }
  ]
}

Subcommand options are specified after the subcommand as with the regular CLI:

> system volumes --help

 Usage: harbor  system volumes [OPTIONS]

 Get information about the system volumes.

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                  │
╰──────────────────────────────────────────────────────────────────────────────╯