gitea.cli.main
main
Main entry point for the python-gitea CLI application.
Classes
gitea.cli.main.LoggingLevel
Bases: StrEnum
Logging levels for the CLI.
Functions:
gitea.cli.main.setup_logging
Set up logging with Rich handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
LoggingLevel
|
Logging level. |
INFO
|
Source code in src/gitea/cli/main.py
gitea.cli.main.version_callback
Print the package version and exit when the flag is set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the |
required |
Raises:
| Type | Description |
|---|---|
Exit
|
When the version has been printed. |
Source code in src/gitea/cli/main.py
gitea.cli.main.main
main(
ctx: Context,
config_path: Annotated[
str | None,
Option(
"--config-path",
help="Path to the configuration file. If not provided, it uses the path specified by `PYTHON_GITEA_CONFIG_PATH`. If the environment variable is not defined, it uses the default location.",
),
] = None,
verbose: Annotated[
LoggingLevel,
Option(
"--verbose", "-v", help="Set verbosity level."
),
] = LoggingLevel.INFO,
output: Annotated[
OutputFormat,
Option(
"--output",
"-o",
envvar="PYTHON_GITEA_OUTPUT",
help="Output format for command results. `json` emits the `{data, metadata}` envelope for every subcommand.",
),
] = OutputFormat.TEXT,
version: Annotated[
bool,
Option(
"--version",
help="Show the version of python-gitea and exit.",
callback=version_callback,
is_eager=True,
),
] = False,
) -> None
Enter the CLI application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
Typer context. |
required |
config_path
|
Annotated[str | None, Option('--config-path', help='Path to the configuration file. If not provided, it uses the path specified by `PYTHON_GITEA_CONFIG_PATH`. If the environment variable is not defined, it uses the default location.')]
|
Path to the configuration file. |
None
|
verbose
|
Annotated[LoggingLevel, Option('--verbose', '-v', help='Set verbosity level.')]
|
Verbosity level for logging. |
INFO
|
output
|
Annotated[OutputFormat, Option('--output', '-o', envvar='PYTHON_GITEA_OUTPUT', help='Output format for command results. `json` emits the `{data, metadata}` envelope for every subcommand.')]
|
Output format shared by every subcommand. |
TEXT
|
version
|
Annotated[bool, Option('--version', help='Show the version of python-gitea and exit.', callback=version_callback, is_eager=True)]
|
Whether to print the version and exit. Handled by |
False
|
Source code in src/gitea/cli/main.py
gitea.cli.main.register_commands
Register CLI commands.