cli

cli.PORT = 8080

A CLI for developing and deploying an app deeply integrated with this repository’s structure. Written to be python version agnostic.

cli.build_dev_command(use_cache=False)[source]
Parameters:

use_cache (bool, optional) – Whether to use Docker image cache. Default: False.

Returns:

Command to build dev image.

Return type:

str

cli.build_prod_command()[source]
Returns:

Command to build prod image.

Return type:

str

cli.container_id_command()[source]
Returns:

Command to get docker container id.

Return type:

str

cli.destroy_dev_command()[source]
Returns:

Command to destroy dev container and image.

Return type:

str

cli.destroy_prod_command()[source]
Returns:

Command to destroy prod image.

Return type:

str

cli.docker_exec(tty=False)[source]
Parameters:

tty (bool, optional) – Include –tty flag. Default: False.

Returns:

Partial command to call ‘docker exec’.

Return type:

str

cli.enter_repo()[source]
Returns:

Command to enter repo.

Return type:

str

cli.exit_repo()[source]
Returns:

Command to return to original directory.

Return type:

str

cli.get_illegal_mode_command()[source]
Returns:

Command to report that the mode given is illegal.

Return type:

str

cli.get_info()[source]

Parses command line call.

Returns:

Mode and arguments.

Return type:

tuple[str]

cli.image_id_command()[source]
Returns:

Command to get docker image id.

Return type:

str

cli.line(text, sep=' ')[source]

Convenience function for formatting a given block of text as series of commands.

Parameters:
  • text (text) – Block of text.

  • sep (str, optional) – Line separator. Default: ‘ ‘.

Returns:

Formatted command.

Return type:

str

cli.main()[source]

Print different commands to stdout depending on mode provided to command.

Return type:

None

cli.prod_command(args)[source]
Returns:

Command to start prod container.

Return type:

str

cli.pull_command(tag='dev-latest')[source]
Parameters:

tag (str, optional) – Tag prefix. Default: ‘dev-latest’.

Returns:

Command to pull Docker image from registry.

Return type:

str

cli.push_command(mode='dev', suffix='$VERSION')[source]
Parameters:
  • mode (str, optional) – Mode. Default: ‘dev’.

  • suffix (str, optional) – Tag suffix. Default: ‘$VERSION’.

Returns:

Command to push Docker image to registry.

Return type:

str

cli.quickstart_command()[source]

Returns a command which prints the quickstart guide.

Returns:

quickstart command.

Return type:

str

cli.remove_command()[source]
Returns:

Command to remove container.

Return type:

str

cli.remove_container()[source]
Returns:

Command to remove container.

Return type:

str

cli.resolve(commands)[source]

Convenience function for creating single commmand from given commands and resolving ‘{…}’ substrings.

Parameters:

commands (list[str]) – List of commands.

Returns:

Resolved command.

Return type:

str

cli.restart_command()[source]
Returns:

Command to restart container.

Return type:

str

cli.start()[source]
Returns:

Command to start container if it is not yet running.

Return type:

str

cli.start_command()[source]
Returns:

Command to start container.

Return type:

str

cli.state_command()[source]
Returns:

Command to get state of app.

Return type:

str

cli.stop()[source]
Returns:

Command to shutdown container.

Return type:

str

cli.stop_command()[source]
Returns:

Command to stop container.

Return type:

str

cli.version_commit_command(args=[])[source]
Parameters:

args (list[str], optional) – List containing a target branch. Default: [‘master’].

Returns:

Git tag and commit command.

Return type:

str

cli.version_variable()[source]
Returns:

Command to set version variable from pyproject.toml.

Return type:

str

cli.x_tools_command(command, args=[], tty=False)[source]

Runs a x_tools command.

Parameters:
  • command (str) – x_tools command

  • args (list, optional) – List of arguments to be passed to the command. Default: []

  • tty (bool, optional) – Include docker –tty flag. Default: False.

Returns:

x_tools command.

Return type:

str

cli.zsh_command()[source]
Returns:

Command to run a zsh session inside container.

Return type:

str

cli.zsh_complete_command()[source]
Returns:

Command to generate and install zsh completions.

Return type:

str

cli.zsh_root_command()[source]
Returns:

Command to run a zsh session as root inside container.

Return type:

str

cli.zshrc_tools(command, args=[])[source]

Creates a tools command string that sources zshrc first.

Parameters:
  • command (str) – command

  • args (list, optional) – List of arguments to be passed to the command. Default: []

Returns:

command.

Return type:

str