Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The aim of these changes is to provide a simple and elegant way of integrating the essential basic logic of error handling and common options into a CLI command. These changes also complement unit testing.
Description
All the CLI commands implemented so far share a number of common features. Firstly, they all use the same error handling logic (using the @error_handler decorator). Secondly, all these commands share a number of common options, such as the cluster endpoint (--endpoint), the output format option (--output) and the debug flag (--debug). For the moment, implementing these behaviors requires the addition of numerous decorators above each function defining a command.
The aim of these changes is to streamline the code by providing a single decorator that abstracts this complexity.
The aim is to centralize this logic to lighten the code and simplify future modifications.
In addition, a number of unit tests are missing. These changes add a number of them and significantly improve test coverage.
Testing
A number of unit tests have been added to ensure that the changes made do not alter the proper operation of the CLI. In addition, manual tests have been performed to validate end-to-end functionality.
Impact
These changes have no impact on the rest of the ArmoniK project. They are purely internal to this project.
Checklist