From 6b41340f1dba4bba9e40b913e2ef0c50c1b23308 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 30 Jun 2026 11:49:11 +0200 Subject: [PATCH] chore(cli): use cli.Cancelled when cancellikng the command to return non-zero exit code in all cases (#406) Use `cli.Cancelled` in all cases where we cancel an operation instead of Printf && return nil Signed-off-by: Miek Gieben --- cmd/uc/machine/rm.go | 3 +-- cmd/uc/volume/rm.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/uc/machine/rm.go b/cmd/uc/machine/rm.go index 05bcc9f2..bfcb404c 100644 --- a/cmd/uc/machine/rm.go +++ b/cmd/uc/machine/rm.go @@ -136,8 +136,7 @@ func remove(ctx context.Context, uncli *cli.CLI, nameOrID string, opts removeOpt return fmt.Errorf("confirm removal: %w", err) } if !confirmed { - fmt.Println("Cancelled. Machine was not removed.") - return nil + return cli.Cancelled("Cancelled. Machine was not removed.") } } diff --git a/cmd/uc/volume/rm.go b/cmd/uc/volume/rm.go index 74e33d9b..05c7fd83 100644 --- a/cmd/uc/volume/rm.go +++ b/cmd/uc/volume/rm.go @@ -92,8 +92,7 @@ func remove(ctx context.Context, uncli *cli.CLI, names []string, opts removeOpti return fmt.Errorf("confirm removal: %w", err) } if !confirmed { - fmt.Println("Cancelled. No volumes were removed.") - return nil + return cli.Cancelled("Cancelled. No volumes were removed.") } }