Skip to content

gitea.cli.project.main

main

CLI commands for managing projects.

Functions:

gitea.cli.project.main.register_commands

register_commands() -> None

Register project-related commands to the project_app.

Source code in src/gitea/cli/project/main.py
def register_commands() -> None:
    """Register project-related commands to the project_app."""
    from gitea.cli.project.column.create import create_column_command  # noqa: PLC0415
    from gitea.cli.project.column.issues import list_column_issues_command  # noqa: PLC0415
    from gitea.cli.project.column.list import list_columns_command  # noqa: PLC0415
    from gitea.cli.project.create import create_command  # noqa: PLC0415
    from gitea.cli.project.delete import delete_command  # noqa: PLC0415
    from gitea.cli.project.edit import edit_command  # noqa: PLC0415
    from gitea.cli.project.get import get_command  # noqa: PLC0415
    from gitea.cli.project.issue.add import add_issue_command  # noqa: PLC0415
    from gitea.cli.project.issue.move import move_issue_command  # noqa: PLC0415
    from gitea.cli.project.issue.remove import remove_issue_command  # noqa: PLC0415
    from gitea.cli.project.issues import list_project_issues_command  # noqa: PLC0415
    from gitea.cli.project.list import list_command  # noqa: PLC0415
    from gitea.cli.project.show import show_command  # noqa: PLC0415

    project_app.command("create", help="Create a project.")(create_command)
    project_app.command("list", help="List projects.")(list_command)
    project_app.command("get", help="Get a project.")(get_command)
    project_app.command("show", help="Show a project with its columns and their card counts.")(show_command)
    project_app.command("edit", help="Edit a project.")(edit_command)
    project_app.command("delete", help="Delete a project.")(delete_command)
    project_app.command("issues", help="List a project's issues, grouped by column.")(list_project_issues_command)

    column_app.command("create", help="Create a column in a project.")(create_column_command)
    column_app.command("list", help="List a project's columns.")(list_columns_command)
    column_app.command("issues", help="List the issues in a project's column.")(list_column_issues_command)

    project_app.add_typer(column_app, name="column", help="Commands for managing project columns.")

    issue_app = typer.Typer(name="issue", help="Commands for managing project issues.", rich_markup_mode="rich")
    issue_app.command(
        "add",
        help="Add an issue to a project column. This is what puts an issue on a board that has no card for it.",
    )(add_issue_command)
    issue_app.command(
        "move",
        help=(
            "Move an issue's card between a project's columns. The issue has to be on the project already, "
            "since a move relocates the card it has there; pass --add-if-missing to put it in the target column "
            "when it has none."
        ),
    )(move_issue_command)
    issue_app.command(
        "remove",
        help=(
            "Take an issue's card off a project. --column-id is the column the card is in, and is found on the "
            "board when it is omitted - where the --column-id of 'add' and 'move' is the column the card is "
            "going to."
        ),
    )(remove_issue_command)
    project_app.add_typer(issue_app, name="issue", help="Commands for managing project issues.")