Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Return Codes on CLI Error #116

Open
cbadke opened this issue Jun 12, 2024 · 1 comment
Open

Inconsistent Return Codes on CLI Error #116

cbadke opened this issue Jun 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@cbadke
Copy link

cbadke commented Jun 12, 2024

Problem description

The CLI is inconsistent with whether or not it returns a non-zero result code when an error occurs during usage.

Steps to reproduce

I'm sure the problem is more wide spread than this but an example is with the files functionality.

/ # trickest --token xxxxx files get
Error: required flag(s) "file" not set
<output truncated>
/ # echo $?
1
/ # trickest --token xxxxx files get --file adf
Error: couldn't find any matches for adf
/ # echo $?
0

Expected behaviour

I would expect all scenarios where the CLI is returning an error message to also return a non-zero return code to the shell.

Environment

Docker image quay.io/trickest/trickest-cli:v1.7.5

@mhmdiaa mhmdiaa added the enhancement New feature or request label Jul 1, 2024
@mhmdiaa
Copy link
Collaborator

mhmdiaa commented Jul 2, 2024

Implemented a partial fix in #120.

The following commands (and all their sub-commands) now consistently return a 1 exit code for errors:

  • files
  • library
  • tools
  • scripts

I've also updated the standard API error handler, which will catch a wide range of potential errors across all commands.

The remaining sub-commands will adopt this approach in a future update as part of a larger refactor (possibly introducing more nuanced exit codes to indicate different types of errors). I'll keep the issue open in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants