Skip to content

Commit

Permalink
console: write error messages to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Feb 27, 2021
1 parent f162e61 commit c16b2d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ proc showVersion =
quit(0)

proc showError*(s: string) =
stdout.styledWrite(fgRed, "Error: ")
stdout.write(s)
stdout.write("\n\n")
stderr.styledWrite(fgRed, "Error: ")
stderr.write(s)
stderr.write("\n\n")
showHelp(exitCode = 1)

func formatOpt(kind: CmdLineKind, key: string, val = ""): string =
Expand Down
6 changes: 3 additions & 3 deletions src/helpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ proc getSortedSubdirs*(dir: string): seq[string] =
sort result

template writeError*(description: string, details: string) =
stdout.styledWriteLine(fgRed, description & ":")
stdout.writeLine(details)
stdout.write "\n"
stderr.styledWriteLine(fgRed, description & ":")
stderr.writeLine(details)
stderr.write "\n"
result = false

0 comments on commit c16b2d7

Please sign in to comment.