Skip to content

Commit

Permalink
feat(cli): better no resp handle (keephq#1000)
Browse files Browse the repository at this point in the history
Co-authored-by: Shahar Glazner <[email protected]>
  • Loading branch information
pehlicd and shahargl authored Mar 22, 2024
1 parent e51408e commit 4200eae
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions keep/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ def list_workflows(info: Info):
raise Exception(f"Error getting workflows: {resp.text}")

workflows = resp.json()
if len(workflows) == 0:
click.echo(click.style("No workflows found.", bold=True))
return

# Create a new table
table = PrettyTable()
# Add column headers
Expand Down Expand Up @@ -609,6 +613,10 @@ def list_workflow_executions(info: Info):
raise Exception(f"Error getting workflow executions: {resp.text}")

workflow_executions = resp.json()
if len(workflow_executions) == 0:
click.echo(click.style("No workflow executions found.", bold=True))
return

# Create a new table
table = PrettyTable()
# Add column headers
Expand Down Expand Up @@ -661,6 +669,10 @@ def get_workflow_execution_logs(info: Info, workflow_execution_id: str):
workflow_executions = resp.json()

workflow_execution_logs = workflow_executions[0].get("logs", [])
if len(workflow_execution_logs) == 0:
click.echo(click.style("No logs found for this workflow execution.", bold=True))
return

# Create a new table
table = PrettyTable()
# Add column headers
Expand Down Expand Up @@ -696,6 +708,9 @@ def list_mappings(info: Info):
raise Exception(f"Error getting mappings: {resp.text}")

mappings = resp.json()
if len(mappings) == 0:
click.echo(click.style("No mappings found.", bold=True))
return

# Create a new table
table = PrettyTable()
Expand Down

0 comments on commit 4200eae

Please sign in to comment.