feat: default to build command when no subcommand is given
This commit is contained in:
parent
4def49350e
commit
1f75c72a96
1 changed files with 16 additions and 2 deletions
|
|
@ -5,10 +5,11 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Annotated
|
||||
from typing import Annotated, override
|
||||
|
||||
import click
|
||||
import typer
|
||||
from typer.core import TyperGroup
|
||||
|
||||
from hokusai.builder import BuildEvent, BuildResult, run_build
|
||||
from hokusai.config import ProjectConfig, load_config
|
||||
|
|
@ -16,7 +17,20 @@ from hokusai.graph import build_graph, get_build_order
|
|||
from hokusai.providers.registry import get_all_models
|
||||
from hokusai.state import state_filename
|
||||
|
||||
app = typer.Typer(name="hokusai", help="AI artifact build tool.")
|
||||
|
||||
class _DefaultBuildGroup(TyperGroup): # type: ignore[misc]
|
||||
"""Typer group that defaults to the 'build' command."""
|
||||
|
||||
@override
|
||||
def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:
|
||||
if not args or (args[0] not in self.commands and not args[0].startswith("-")):
|
||||
args = ["build", *args]
|
||||
return super().parse_args(ctx, args)
|
||||
|
||||
|
||||
app = typer.Typer(
|
||||
name="hokusai", help="AI artifact build tool.", cls=_DefaultBuildGroup
|
||||
)
|
||||
|
||||
_CONFIG_SUFFIX = ".hokusai.yaml"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue