From 6bcfa7279730d6bc6493150f479a004f5fec5cf2 Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Thu, 5 Oct 2023 09:23:51 -0500 Subject: [PATCH] rpk/transform/init: bail on empty name input This is the more common behavior in RPK, and we want to align this command with that. Signed-off-by: Tyler Rockwood --- src/go/rpk/pkg/cli/transform/init.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/go/rpk/pkg/cli/transform/init.go b/src/go/rpk/pkg/cli/transform/init.go index 2e2a3ce7cdf6d..2ca9605e05d52 100644 --- a/src/go/rpk/pkg/cli/transform/init.go +++ b/src/go/rpk/pkg/cli/transform/init.go @@ -84,13 +84,16 @@ Will initialize a transform project in the foobar directory. if ok { out.Die("there is already a transform at %q, please delete it before retrying", c) } - for name == "" { + if name == "" { suggestion := filepath.Base(path) if suggestion == "." { suggestion = "" } name, err = out.PromptWithSuggestion(suggestion, "name this transform:") out.MaybeDie(err, "unable to determine project name: %v", err) + if name == "" { + out.Die("transform name is required") + } } if lang == "" { langVal, err := out.Pick(project.AllWasmLangs, "select a language:")