Skip to content

Commit 4d8c058

Browse files
committed
fix(cli+sdk): minor fixes and typo
1 parent a942d54 commit 4d8c058

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

cli/kleinkram/api/routes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ def _update_trigger(
527527
type_: Optional[TriggerType] = None,
528528
config: Optional[TriggerConfig] = None,
529529
) -> None:
530-
if not any([name, description, template_uuid, mission_uuid, type_, config]):
530+
531+
if all(v is None for v in [name, description, template_uuid, mission_uuid, type_, config]):
531532
raise ValueError("at least one field must be updated")
532533

533534
body = {}

cli/kleinkram/cli/_triggers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def update_trigger_cli(
159159
typer.Option(
160160
"--file-patterns",
161161
help="File patterns, provide multiples via '--file-patterns *.bag "
162-
"--file-patters date.bag' (only for FILE triggers)",
162+
"--file-patterns date.bag' (only for FILE triggers)",
163163
),
164164
] = None,
165165
file_events: Annotated[
@@ -198,6 +198,8 @@ def update_trigger_cli(
198198
updated_fields["config"] = TimeConfig(cron=cron_expression)
199199
case TriggerType.WEBHOOK:
200200
updated_fields["config"] = WebhookConfig()
201+
elif any(v is not None for v in [file_patterns, file_events, cron_expression]):
202+
raise typer.BadParameter("Trigger type must be specified when updating config fields. Please provide --type option.")
201203

202204
if not updated_fields:
203205
typer.secho("No fields to update. Please provide at least one field to update.", fg=typer.colors.GREEN)

cli/kleinkram/printing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import kleinkram
3030
from kleinkram.api.client import AuthenticatedClient
31+
from kleinkram.config import get_config
3132
from kleinkram.config import get_shared_state
3233
from kleinkram.core import FileVerificationStatus
3334
from kleinkram.models import ActionTemplate
@@ -504,7 +505,7 @@ def trigger_info_table(trigger: ActionTrigger) -> Table:
504505
case TimeConfig(cron=cron):
505506
table.add_row("time trigger cron expression", cron)
506507
case WebhookConfig():
507-
curr_config = kleinkram.config.get_config()
508+
curr_config = get_config()
508509
url = curr_config.endpoints[curr_config.selected_endpoint].api + f"/hooks/actions/{trigger.uuid}"
509510
table.add_row("webhook trigger url", url)
510511
return table

0 commit comments

Comments
 (0)