diff --git a/chime_frb_api/workflow/utils.py b/chime_frb_api/workflow/utils.py index a1773ca..0da0ae7 100644 --- a/chime_frb_api/workflow/utils.py +++ b/chime_frb_api/workflow/utils.py @@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional import click -from rich import pretty +from rich import pretty, print from rich.console import Console from rich.table import Table @@ -89,6 +89,29 @@ def details(name: Optional[str] = None, all: bool = False): console.print(table) +@buckets.command("view", help="View work in a bucket.") +@click.argument("name", type=str, required=True) +@click.option( + "count", + "-c", + "--count", + type=int, + required=False, + default=3, + help="Number of work to show.", +) +def view(name: str, count: int = 3): + """View work in a bucket. + + Args: + name (str): Name of the bucket. + count (int, optional): Number of work to show. Defaults to 3. + """ + buckets = Buckets() + work = buckets.view(query={"pipeline": name}, projection={}, limit=count) + print(work) + + def create_row(details: Dict[str, Any]) -> List[str]: """Create a row of data for the table.