From c173d684267f2bebff8c0966d9c53e2acd7df961 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Fri, 22 Jan 2021 00:22:45 +0300 Subject: [PATCH] fix: write status messages to stderr - closes: #2 Write status messages to standard error instead, this changes allows users to pipe the output to a new file, from stdout using `--append=false` --- pkg/toc/toc.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/toc/toc.go b/pkg/toc/toc.go index 9305a3a..38449d7 100644 --- a/pkg/toc/toc.go +++ b/pkg/toc/toc.go @@ -56,16 +56,15 @@ func (t *toc) logic() { } if t.Options.Append == true { - err = t.writeToFile(string(resp)) - if err != nil { + if err = t.writeToFile(string(resp)); err != nil { color.Red(err.Error()) os.Exit(1) } + color.Green("✔ Table of contents generated successfully") } else { fmt.Print(t.String()) } - color.HiGreen("✔ Table of contents generated successfully.") } func (t *toc) String() (s string) {