mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
cli: remove extraneous trailing newline from nomad fmt (#20318)
When `nomad fmt` writes to stdout instead of overwriting a file, the command was using the `UI` output, which appends an extra newline. This results in extra trailing newlines when using `nomad fmt` as part of a pipeline or editor plugin. Update the command to write directly to stdout when in the stdout mode. Fixes: https://github.com/hashicorp/nomad/issues/20307
This commit is contained in:
@@ -280,7 +280,7 @@ func (f *FormatCommand) processFile(path string, r io.Reader) {
|
||||
}
|
||||
|
||||
if f.writeStdout {
|
||||
f.Ui.Output(string(out))
|
||||
formattedFile.WriteTo(os.Stdout)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user