Skip to content

Commit

Permalink
Add autogenerated warning
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed Aug 14, 2024
1 parent 2ad8e25 commit 4f4a8d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/commands/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 4f4a8d9

Please sign in to comment.