πŸ”Œ Application Programming Interface#

main apps core module.

error(text, **kwargs)#

Display an error message.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.secho

Return type:

None

info(text, **kwargs)#

Display an info message.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.secho

Return type:

None

warning(text, **kwargs)#

Display a warning.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.secho

Return type:

None

comment(text, **kwargs)#

Display a comment.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.secho

Return type:

None

prompt(text, **kwargs)#

Prompt the user.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.prompt

Return type:

Any

confirm(text, **kwargs)#

Prompt the user for a confirmation.

Parameters:
  • text (str) – Text to display

  • **kwargs (Any) – Additional parameters passed to click.confirm

Return type:

bool

class AppStyles#

Bases: object

Styles used in aplication.

ERROR#

Style for errors ({"fg": "red", "bold": True} by default).

WARNING#

Style for warnings ({"fg": "yellow", "bold": True} by default).

INFO#

Style for informations ({"fg": "bright_magenta"} by default).

COMMENT#

Style for comments ({"fg": "green"} by default).

QUESTION#

Style for questions ({"fg": "cyan"} by default).

class Group(name=None, commands=None, invoke_without_command=False, no_args_is_help=None, subcommand_metavar=None, chain=False, result_callback=None, **kwargs)#

Bases: Group

Group class for the GALACTIC app.

It does two things:

  • it detects plugins from the galactic.apps.cli.main group.

  • it adds an epilog to all added commands.

add_command(cmd, name=None)#

Add a command to the group.

This method also sets the epilog of the command to the application’s epilog. It is useful for commands that are part of the application and should inherit the application’s epilog.

Parameters:
  • cmd (Command) – The command to add

  • name (str | None, default: None) – The name of the command (if None, the name of the command is used)

Return type:

None

classmethod detect_plugins()#

Detect plugins from the galactic.apps.cli.main group.

Return type:

None

get_command(ctx, cmd_name)#

Get a command by name.

Parameters:
  • ctx (Context) – The click context

  • cmd_name (str) – The name of the command to get

Returns:

The command if found, otherwise None

Return type:

click.Command | None

list_commands(ctx)#

List commands in the group.

Parameters:

ctx (Context) – The click context

Returns:

List of command names in the group

Return type:

list[str]