Skip to content

Command Line Interface

Oskar Liew edited this page Nov 24, 2021 · 2 revisions

The Command Line Interface (CLI) comes bundled together with the SDK in the Daeploy package. It is based on Typer, a tool for building CLIs that is similar to FastAPI. The design of the Daeploy CLI is fairly straight forward and consists of a central Typer app object. Commands are added to the CLI by decorating funcitons with the app.command() method.

The CLI acts as an interface to the manager API and communicates with it using Requests. To know which manager to communicate with and which token to use, the CLI must be able to handle some state.

Handling State

The state is handled by the config.CliState class which stores tokens and hosts in a configuration file at $home/.config/daeploy/daeployconfig.json. The CLI has a callback function that is run before every command that checks that the user is logged in to a host. Some commands are usable without logging in and they are login, init and test.

Subcommands

To increase usability of the CLI we have tried to keep the number of functions and options to a minimum but it has grown over time to be much larger in scope than we had first planned. To keep the CLI easy to use we should try to collect similar commands under subcommands, like we have for the admin functionality which is located under the daeploy user command.

Clone this wiki locally