twitchdev / twitch-cli

The official Twitch CLI to make developing on Twitch easier.
Apache License 2.0
612 stars 71 forks source link

Add exit codes for failed commands #245

Closed Xemdo closed 1 year ago

Xemdo commented 1 year ago

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem/Feature

Addresses #239 by adding exit codes for all failed commands. This also adds in exit codes to twitch api, which will return exit code 1 when an API returns a non-2xx status code.

All errors will print to stdout to make it consistent across the entire program. Different features present data in different ways for different reasons, and it would take a rework of most things to write it in a way that print errors to stdout. For example, twitch api get users will return a non-zero error code (because it returned a 400) but it will still write the JSON output to stdout instead of stderr.

Description of Changes:

Checklist