From cb8fb2c0bc9e40b6e4910d63e09acd97f26840b5 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Thu, 25 Nov 2021 19:44:43 -0800 Subject: [PATCH] Add newline for read file command if output is stdout --- cmd/itctl/filesystem/read.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/itctl/filesystem/read.go b/cmd/itctl/filesystem/read.go index 5bece4c..76ca80e 100644 --- a/cmd/itctl/filesystem/read.go +++ b/cmd/itctl/filesystem/read.go @@ -46,9 +46,11 @@ var readCmd = &cobra.Command{ log.Fatal().Err(err).Msg("Error moving file or directory") } + var suffix string var out *os.File if args[1] == "-" { out = os.Stdout + suffix = "\n" } else { out, err = os.Create(args[1]) if err != nil { @@ -60,6 +62,8 @@ var readCmd = &cobra.Command{ if err != nil { log.Fatal().Err(err).Msg("Error writing to local file") } + out.WriteString(suffix) + log.Info().Msgf("Read %d bytes in %s", n, time.Since(start)) }, }