From a4ce497435da9f0e2b321d04f90eed592c030302 Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Sun, 20 Oct 2024 23:47:02 +0000 Subject: [PATCH] fix:[#153] tasks: remove newline from inputs Co-authored-by: nellfs --- cmd/tasks.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/tasks.go b/cmd/tasks.go index 9366ec1..2036707 100644 --- a/cmd/tasks.go +++ b/cmd/tasks.go @@ -379,6 +379,7 @@ func newTask(cmd *cobra.Command, args []string) error { cmdr.Info.Println(vso.Trans("tasks.stacks.new.info.askName")) reader := bufio.NewReader(os.Stdin) name, _ = reader.ReadString('\n') + name = strings.TrimSuffix(name, "\n") if name == "" { cmdr.Error.Println(vso.Trans("tasks.stacks.new.error.emptyName")) return nil @@ -394,6 +395,7 @@ func newTask(cmd *cobra.Command, args []string) error { cmdr.Info.Println(vso.Trans("tasks.stacks.new.info.askDescription")) reader := bufio.NewReader(os.Stdin) description, _ = reader.ReadString('\n') + description = strings.TrimSuffix(description, "\n") if description == "" { cmdr.Error.Println(vso.Trans("tasks.stacks.new.error.emptyDescription")) return nil @@ -409,6 +411,7 @@ func newTask(cmd *cobra.Command, args []string) error { cmdr.Info.Println(vso.Trans("tasks.stacks.new.info.askCommand")) reader := bufio.NewReader(os.Stdin) command, _ = reader.ReadString('\n') + command = strings.TrimSuffix(command, "\n") if command == "" { cmdr.Error.Println(vso.Trans("tasks.stacks.new.error.emptyCommand")) return nil