Skip to main content

CLI Reference

Codezero can be used via the Desktop app or the CLI. If you installed the Desktop app you also have the CLI.

This section is about getting up and running with the CLI.

Configure the CLI

Before you get started, you need to log in to your Codezero account.

czctl auth login

Getting Help

The CLI is invoked via the czctl command. To get more information about individual commands, see the associated command under References (e.g. Consume), or run:

czctl help

Starting the Codezero daemon

Start the Codezero daemon (background service) by running:

czctl start
note

For MacOS and Linux Codezero requires sudo access to modify your local network settings.

For Windows you'll need to run czctl as an Administrator as it needs to modify your local network settings. You can do this by starting a Command Prompt or Windows PowerShell with Run as Administrator.

Get the current status

To get the current status of Codezero that includes the authenicated user, organization and Teamspace run:

czctl status

Run commands

The czctl command loosely follows the conventions of the kubectl command, where each command references a Kubernetes resource (like a deployment or service), and where a namespace is given with a -n flag.

Use czctl <command> --help to see the options available for a given command.

Most czctl commands take the form czctl <command> <sub-command>, and czctl <command> <sub-command> --help will display the argument(s) and flag(s) available for that command.

Some examples:

czctl serve list --help
czctl consume edit --help
czctl space select --help

Auth

The Auth command allows you to log in and out of Codezero.

Usage

czctl auth [SUB-COMMAND]

Examples

czctl auth login

Sub-commands

Sub-commandDescription
loginLogin to Codezero
logoutLogout from Codezero

Flags

FlagsDescription
--tokenIf set, app will not try to open a browser window for login and will use the provided token.

Cleanup

Stops the Codezero Daemon and removes any residual Networking components:

Usage

czctl cleanup

Completion

Generate the autocompletion script for czctl for the specified shell.

See each sub-command's help for details on how to use the generated script.

Usage

czctl completion [SUB-COMMAND]

Sub-commands

Sub-commandDescription
bashGenerate the autocompletion script for bash
fishGenerate the autocompletion script for fish
powershellGenerate the autocompletion script for powershell
zshGenerate the autocompletion script for zsh

Example

To load zsh completions in your current shell session:

source <(czctl completion zsh)

Compose

Applies all the serve sessions/consume rules from a compose file.

Usage

czctl compose start

Flags

FlagsDescription
--filePath to the compose file (default "codezero-compose.yaml")

Consume

Manage consume rules.

All

Consume all services.

Usage

czctl consume all

Apply

Apply consume rules from a file.

Usage

czctl consume apply source_file [flags]

Flags

FlagsDescription
--primary-namespaceThe primary namespace used for services consume

Edit

Edit consume rules.

Usage

czctl consume edit

List

List consumed services.

Usage

czctl consume list

View

View consume rules.

Usage

czctl consume view

Daemon

Manage Codezero daemon.

Usage

czctl daemon [SUB-COMMAND]

Example

czctl daemon start

Sub-commands

Sub-commandDescription
installInstall the Codezero daemon as a background service
restartRestart the Codezero daemon
runRun the Codezero daemon in the foreground
startStart the Codezero daemon
stopStop the Codezero daemon
uninstallUninstall the Codezero daemon background service

Diagnostics

Package system diagnostics for support team.

Usage

czctl diagnostics

Organization

Manage Organizations.

List

List organizations

Usage

czctl organization list

Select

Changes the current organization

You can use this command to change the current organization. If you don't provide a name or there are multiple spaces with the same name, you will be interactively prompted to select one.

Usage

czctl organization select [organization name] [flags]

Examples

czctl organization select MyOrg

Arguments

ArgumentsDescription
organization nameThe name of the organization.

Flags

FlagsDescription
--id stringSelect by organization ID

Primary Namesapce

Manage primary namespace.

Clear

Clear the currently selected primary namespace.

Usage

czctl primary-namespace clear

Select

Change the current primary namespace.

Usage

czctl primary-namespace select [namespace]

Examples

czctl primary-namespace select my-namespace

Arguments

ArgumentsDescription
namespaceThe name of the Kubernetes namespace.

Reset

Removes all consume and serve sessions.

Usage

czctl reset

Restart

Restarts the Codezero daemon if it is running. If it is not running, does nothing.

Usage

czctl restart

Serve

Manage served resources.

Serving a resource

Usage

czctl serve [namespace/name] [local_port:]remote_port [...[local_port_n:]remote_port_n] [flags]

Example

czctl serve my-namespace/frontend 8080

Flags

FlagsDescription
--condition stringCondition based on type
--condition-type stringCondition type (default | user | header) (default "user")
--removeRemove served resource

The --condition-type flag defines when the resource is served from the local endpoint. Only the header condition type requires the additional --condition flag.

  • When setting the condition type to default, all traffic is routed to the local resource instead of the cluster resource.
  • Opting for the user condition type directs only HTTP traffic containing the x-c6o-userid: YOUR_USER_ID header to the local resource. You can see your current user ID by running czctl status.
  • For the header condition type, any traffic matching the specified HTTP header provided via the --condition flag will be directed to the local resource.

List

List served resources.

Usage

czctl serve list

Services

Services commands.

List

List services.

Usage

czctl services list

Space

Manage Spaces.

List

List spaces.

Usage

czctl space list

Select

Changes the current space

You can use this command to change the current space. If you don't provide a name or there are multiple spaces with the same name, you will be interactively prompted to select one.

Usage

czctl space select [flags]

Example

czctl space select pre-production

Flags

FlagsDescription
--id stringSelect by space ID

Start

Starts the Codezero daemon, does nothing if daemon is already running

Usage

czctl start

Status

Returns the status of the Codezero daemon. If the daemon is not running, it will exit with code 1. Otherwise, it will exit with code 0.

Usage

czctl status

Stop

Stops the Codezero daemon. Does nothing if daemon is not running.

Usage

czctl stop

Tutorial

Starts the tutorial for Codezero.

Usage

czctl tutorial

Version

Shows the current product version.

Usage

czctl version