forked from Elara6331/itd
Add newline for read file command if output is stdout
This commit is contained in:
parent
38119435f1
commit
cb8fb2c0bc
@ -46,9 +46,11 @@ var readCmd = &cobra.Command{
|
|||||||
log.Fatal().Err(err).Msg("Error moving file or directory")
|
log.Fatal().Err(err).Msg("Error moving file or directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var suffix string
|
||||||
var out *os.File
|
var out *os.File
|
||||||
if args[1] == "-" {
|
if args[1] == "-" {
|
||||||
out = os.Stdout
|
out = os.Stdout
|
||||||
|
suffix = "\n"
|
||||||
} else {
|
} else {
|
||||||
out, err = os.Create(args[1])
|
out, err = os.Create(args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -60,6 +62,8 @@ var readCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Error writing to local file")
|
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))
|
log.Info().Msgf("Read %d bytes in %s", n, time.Since(start))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user