From f0988a210c3885245bead602c4e18ba6210b04d5 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Wed, 9 Feb 2022 11:25:07 -0500 Subject: [PATCH] Fix issue with `tink template update` using stdin --- cmd/tink-cli/cmd/template/update.go | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/cmd/tink-cli/cmd/template/update.go b/cmd/tink-cli/cmd/template/update.go index 58a0461d6..feb98f763 100644 --- a/cmd/tink-cli/cmd/template/update.go +++ b/cmd/tink-cli/cmd/template/update.go @@ -59,26 +59,21 @@ $ tink template update 614168df-45a5-11eb-b13d-0242ac120003 --path /tmp/example. func updateTemplate(id string) { req := template.WorkflowTemplate{Id: id} - if filePath != "" { - data, err := readTemplateData() - if err != nil { - log.Fatalf("readTemplateData: %v", err) - } + data, err := readTemplateData() + if err != nil { + log.Fatalf("readTemplateData: %v", err) + } - if data != "" { - wf, err := workflow.Parse([]byte(data)) - if err != nil { - log.Fatal(err) - } - req.Name = wf.Name - req.Data = data + if data != "" { + wf, err := workflow.Parse([]byte(data)) + if err != nil { + log.Fatal(err) } - } else { - log.Fatal("Nothing is provided in the file path") + req.Name = wf.Name + req.Data = data } - _, err := client.TemplateClient.UpdateTemplate(context.Background(), &req) - if err != nil { + if _, err := client.TemplateClient.UpdateTemplate(context.Background(), &req); err != nil { log.Fatal(err) } fmt.Println("Updated Template: ", id)