diff --git a/src/promptforge/cli/commands/registry.py b/src/promptforge/cli/commands/registry.py index e06a802..20ccf4c 100644 --- a/src/promptforge/cli/commands/registry.py +++ b/src/promptforge/cli/commands/registry.py @@ -1,4 +1,7 @@ +"""Registry commands for sharing prompts.""" + import click + from promptforge.registry import LocalRegistry, RemoteRegistry, RegistryEntry from promptforge.core.prompt import Prompt @@ -51,8 +54,9 @@ def registry_add(ctx, prompt_name: str, author: str): @registry.command("search") @click.argument("query") +@click.option("--limit", default=20, help="Maximum results") @click.pass_obj -def registry_search(ctx, query: str): +def registry_search(ctx, query: str, limit: int): """Search local registry.""" registry = LocalRegistry() results = registry.search(query) @@ -61,7 +65,7 @@ def registry_search(ctx, query: str): click.echo("No results found") return - for result in results: + for result in results[:limit]: entry = result.entry click.echo(f"{entry.name} (score: {result.relevance_score})") if entry.description: @@ -79,7 +83,7 @@ def registry_pull(ctx, entry_id: str): if remote.pull(entry_id, local): click.echo(f"Pulled entry {entry_id}") else: - click.echo(f"Entry not found", err=True) + click.echo("Entry not found", err=True) raise click.Abort() @@ -104,4 +108,4 @@ def registry_publish(ctx, prompt_name: str): click.echo(f"Published '{prompt_name}' as {published.id}") except Exception as e: click.echo(f"Publish error: {e}", err=True) - raise click.Abort() \ No newline at end of file + raise click.Abort()