From 4f4a8d9de59271976bd5bbbbd1ba91cd758505fb Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Wed, 14 Aug 2024 19:47:54 +0200 Subject: [PATCH] Add autogenerated warning Signed-off-by: Andrei Kvapil --- pkg/commands/template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/commands/template.go b/pkg/commands/template.go index b1838f1..ec28aaa 100644 --- a/pkg/commands/template.go +++ b/pkg/commands/template.go @@ -130,7 +130,7 @@ func templateWithFiles(args []string) func(ctx context.Context, c *client.Client if !templateCmdFlags.endpointsFromArgs { GlobalArgs.Endpoints = modelineConfig.Endpoints } - fmt.Printf("nodes: %v, endpoints: %v, templates: %v", GlobalArgs.Nodes, GlobalArgs.Endpoints, templateCmdFlags.templateFiles) + fmt.Printf("- talm: file=%s, nodes=%s, endpoints=%s, templates=%s\n", configFile, GlobalArgs.Nodes, GlobalArgs.Endpoints, templateCmdFlags.templateFiles) if len(GlobalArgs.Nodes) < 1 { return errors.New("nodes are not set for the command: please use `--nodes` flag or configuration file to set the nodes to run the command against") @@ -147,7 +147,6 @@ func templateWithFiles(args []string) func(ctx context.Context, c *client.Client } if templateCmdFlags.inplace { - fmt.Printf("- talm: file=%s, nodes=%s, endpoints=%s, templates=%s\n", configFile, GlobalArgs.Nodes, GlobalArgs.Endpoints, templateCmdFlags.templateFiles) err = os.WriteFile(configFile, []byte(output), 0o644) fmt.Fprintf(os.Stderr, "Updated.\n") } else { @@ -215,8 +214,9 @@ func generateOutput(ctx context.Context, c *client.Client, args []string) (strin if err != nil { return "", fmt.Errorf("failed to generate modeline: %w", err) } + warn := "# THIS FILE IS AUTOGENERATED. DO NOT EDIT IT!" - output := fmt.Sprintf("%s\n%s", modeline, string(result)) + output := fmt.Sprintf("%s\n%s\n%s\n", modeline, warn, string(result)) return output, nil }