| | |
| | | |
| | | @cli.command() |
| | | @click.argument("packages", nargs=-1, required=True) |
| | | @click.option( |
| | | "--include-repo", |
| | | is_flag=True, |
| | | default=False, |
| | | help="Check managed repository for existing packages (skip if present)", |
| | | ) |
| | | @pass_context |
| | | def add(ctx: Context, packages: tuple[str, ...]) -> None: |
| | | def add(ctx: Context, packages: tuple[str, ...], include_repo: bool) -> None: |
| | | """Add and build new packages from the AUR.""" |
| | | config = ctx.config |
| | | |
| | | async def _add() -> None: |
| | | async with AURClient() as aur: |
| | | async with Builder(config, aur) as builder: |
| | | repo = RepoManager(config) |
| | | |
| | | repo = RepoManager(config) |
| | | async with Builder(config, aur, repo=repo) as builder: |
| | | results = [] |
| | | for package in packages: |
| | | console.print(f"[bold blue]Adding package:[/] {package}") |
| | | result = await builder.add_package(package) |
| | | result = await builder.add_package(package, include_repo=include_repo) |
| | | results.append(result) |
| | | |
| | | if result.status == BuildStatus.SUCCESS: |
| | | repo.add_packages(result) |
| | | console.print(f"[green]✓[/] {package} added successfully") |
| | | if len(result.artifacts) > 1: |
| | | console.print(f"[green]✓[/] {package} processed successfully ({len(result.artifacts)} artifacts registered)") |
| | | else: |
| | | console.print(f"[green]✓[/] {package} processed successfully") |
| | | elif result.status == BuildStatus.SKIPPED: |
| | | console.print(f"[yellow]⏭[/] {package} skipped (already in official repos or installed)") |
| | | console.print(f"[yellow]⏭[/] {package} skipped (already in managed repository)") |
| | | else: |
| | | console.print(f"[red]✗[/] {package} failed: {result.error}") |
| | | |