Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a small change that prints any errors that surface when executing the cli (i.e., `cmd.Execute()`) to stderr rather than stdout. When redirecting streams, its useful to keep errors separated from program output so that in the case of an error the message won't be redirected and is still surfaced. This issue came up for me when using this terraform-docs in a script, where I encountered an error: $ terraform-docs markdown path/not/to/mod > outfile zsh: exit 1 terraform-docs markdown path/not/to/mod > outfile When I ran the above command in my script an error was generated because the path was incorrect, however the error message wasn't printed to my console and the outfile was filled with the error message. The change here modifies the cli's output to instead show: $ terraform-docs markdown path/not/to/mod > outfile Error: Failed to read module directory: Module directory path/not/to/mod does not exist or cannot be read. zsh: exit 1 terraform-docs markdown path/not/to/mod > outfile and the outfile is empty. Signed-off-by: Anthony O'Brien <anthony@bearonis.com>
- Loading branch information