Fix recipe list display and handle missing uploaded_at
- Show full Recipe ID instead of truncated - Display friendly name with version hash when available - Make uploaded_at optional to avoid KeyError - Improve recipe list format with one recipe per block Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
23
artdag.py
23
artdag.py
@@ -1654,13 +1654,19 @@ def list_recipes(limit, offset):
|
|||||||
end = offset + len(recipes)
|
end = offset + len(recipes)
|
||||||
click.echo(f"Showing {start}-{end}" + (" (more available)" if has_more else ""))
|
click.echo(f"Showing {start}-{end}" + (" (more available)" if has_more else ""))
|
||||||
click.echo()
|
click.echo()
|
||||||
click.echo(f"{'Name':<20} {'Version':<8} {'Variables':<10} {'Recipe ID':<24}")
|
|
||||||
click.echo("-" * 70)
|
|
||||||
|
|
||||||
for recipe in recipes:
|
for recipe in recipes:
|
||||||
recipe_id = recipe["recipe_id"][:20] + "..."
|
recipe_id = recipe["recipe_id"]
|
||||||
var_count = len(recipe.get("variable_inputs", []))
|
var_count = len(recipe.get("variable_inputs", []))
|
||||||
click.echo(f"{recipe['name']:<20} {recipe['version']:<8} {var_count:<10} {recipe_id}")
|
friendly_name = recipe.get("friendly_name", "")
|
||||||
|
|
||||||
|
click.echo(f"Name: {recipe['name']}")
|
||||||
|
click.echo(f" Version: {recipe.get('version', 'N/A')}")
|
||||||
|
if friendly_name:
|
||||||
|
click.echo(f" Friendly Name: {friendly_name}")
|
||||||
|
click.echo(f" Variables: {var_count}")
|
||||||
|
click.echo(f" Recipe ID: {recipe_id}")
|
||||||
|
click.echo()
|
||||||
|
|
||||||
|
|
||||||
@cli.command("recipe")
|
@cli.command("recipe")
|
||||||
@@ -1684,12 +1690,15 @@ def show_recipe(recipe_id):
|
|||||||
click.echo(f"Failed to get recipe: {e}", err=True)
|
click.echo(f"Failed to get recipe: {e}", err=True)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
click.echo(f"Name: {recipe['name']}")
|
click.echo(f"Name: {recipe.get('name', 'Unnamed')}")
|
||||||
click.echo(f"Version: {recipe['version']}")
|
click.echo(f"Version: {recipe.get('version', 'N/A')}")
|
||||||
|
if recipe.get("friendly_name"):
|
||||||
|
click.echo(f"Friendly Name: {recipe['friendly_name']}")
|
||||||
click.echo(f"Description: {recipe.get('description', 'N/A')}")
|
click.echo(f"Description: {recipe.get('description', 'N/A')}")
|
||||||
click.echo(f"Recipe ID: {recipe['recipe_id']}")
|
click.echo(f"Recipe ID: {recipe['recipe_id']}")
|
||||||
click.echo(f"Owner: {recipe.get('owner', 'N/A')}")
|
click.echo(f"Owner: {recipe.get('owner', 'N/A')}")
|
||||||
click.echo(f"Uploaded: {recipe['uploaded_at']}")
|
if recipe.get("uploaded_at"):
|
||||||
|
click.echo(f"Uploaded: {recipe['uploaded_at']}")
|
||||||
|
|
||||||
if recipe.get("variable_inputs"):
|
if recipe.get("variable_inputs"):
|
||||||
click.echo("\nVariable Inputs:")
|
click.echo("\nVariable Inputs:")
|
||||||
|
|||||||
Reference in New Issue
Block a user