diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2021-03-20 09:17:20 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2021-03-20 09:17:20 -0400 |
| commit | c17a496567eb1824937726a50f73ddeeb0b5a520 (patch) | |
| tree | b08bb7ff3438db795f01eab6a22799e54c143271 /internal/cmd | |
| parent | efca627b22d28dc58b295482c9e052ebba2f0c2b (diff) | |
Stop printing newline on stderr when outputting to stdout
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'internal/cmd')
| -rw-r--r-- | internal/cmd/main.go | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/internal/cmd/main.go b/internal/cmd/main.go index 3246d808..88184699 100644 --- a/internal/cmd/main.go +++ b/internal/cmd/main.go @@ -2,7 +2,6 @@ package cmd import ( "context" - "fmt" "io" "os" "os/exec" @@ -106,12 +105,6 @@ func NewGomplateCmd() *cobra.Command { cmd.SilenceErrors = true cmd.SilenceUsage = true - // print a newline to stderr for convenience if the output is going - // to stdout, since otherwise the shell prompt may look wrong - if consoleOutput(cfg) { - fmt.Fprintf(cmd.ErrOrStderr(), "\n") - } - log.Debug().Int("templatesRendered", gomplate.Metrics.TemplatesProcessed). Int("errors", gomplate.Metrics.Errors). Dur("duration", gomplate.Metrics.TotalRenderDuration). @@ -127,14 +120,6 @@ func NewGomplateCmd() *cobra.Command { return rootCmd } -// TODO: consider only doing this if stdout doesn't have a trailing newline -// already. -func consoleOutput(cfg *config.Config) bool { - consoleOnly := len(cfg.OutputFiles) == 0 || (len(cfg.OutputFiles) == 1 && cfg.OutputFiles[0] == "-") - usingDirs := cfg.InputDir != "" && cfg.OutputDir != "" - return consoleOnly && !usingDirs && !cfg.ExecPipe && cfg.Stdout == os.Stdout -} - // InitFlags - initialize the various flags and help strings on the command. // Note that the defaults set here are ignored, and instead defaults from // *config.Config's ApplyDefaults method are used instead. Changes here must be |
