Skip to content

Commit

Permalink
fix: write status messages to stderr
Browse files Browse the repository at this point in the history
- 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`
  • Loading branch information
ycd committed Jan 21, 2021
1 parent 019f7ed commit c173d68
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/toc/toc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c173d68

Please sign in to comment.