Normalize logging, output, and error reporting

- Return errors as errors, not print to stdout and return nil
- Ensure errors and warnings are always written to stderr, not stout
- Do not print progress to stdout unless stdout is a terminal
This commit is contained in:
Mislav Marohnić 2021-08-12 14:37:23 +02:00
parent 41e223869e
commit 20d75f0ff9
9 changed files with 52 additions and 51 deletions

View file

@ -22,7 +22,7 @@ var rootCmd = &cobra.Command{
func Execute() {
if os.Getenv("GITHUB_TOKEN") == "" {
fmt.Println("The GITHUB_TOKEN environment variable is required. Create a Personal Access Token at https://github.com/settings/tokens/new?scopes=repo and make sure to enable SSO for the GitHub organization after creating the token.")
fmt.Fprintln(os.Stderr, "The GITHUB_TOKEN environment variable is required. Create a Personal Access Token at https://github.com/settings/tokens/new?scopes=repo and make sure to enable SSO for the GitHub organization after creating the token.")
os.Exit(1)
}