... | ... | @@ -2,12 +2,12 @@ |
|
|
|
|
|
The OSDU CLI uses the [Python Click](https://click.palletsprojects.com/en/8.0.x/) package to simplify the development experience. Code is located under the src folder with __main__.py containing the main entry point.
|
|
|
|
|
|
The commands displayed in the CLI are automatically loaded based upon the file / folder structure in the _src/osducli/comands_ folder. All modules that contain a __click_command_ function are added as commands with the function docstring being used as the command help text. Subfolders can be used to provide groups of commands. In this case the module __init__.py docstring is used as the group help text.
|
|
|
The commands displayed in the CLI are automatically loaded based upon the file / folder structure in the _src/osducli/comands_ folder. All modules that contain a __click_command_ function are added as commands with the function docstring being used as the command help text. Subfolders can be used to provide groups of commands. In this case the docstring in the module _\_\_init\_\_.py_ is used as the group help text.
|
|
|
|
|
|
__click_command_ functions should be decorated with the following:
|
|
|
|
|
|
- _handle_cli_exceptions_ - this provides common exception handling.
|
|
|
- One of
|
|
|
- One of:
|
|
|
- _global_params_ - this provides --debug and --config parameters and would typically be used if you have a command that doesn't return any output.
|
|
|
- _command_with_output_ - should typically be used when you are returning information. This decorator provides the --output and --query parameters and that allow for customising the output format and specifying a jmes query to filter output. It also includes _global_params_
|
|
|
|
... | ... | @@ -17,4 +17,4 @@ The cliclient.py module contains the _CliOsduClient _class that simplifies inter |
|
|
|
|
|
## Testing
|
|
|
|
|
|
Test cases are provided for certain functionality and are located under the _tests_ folder. Extending coverage is an identified improvement area. |
|
|
Test cases are provided for certain functionality and are located under the _tests_ folder. Extending test coverage is an identified improvement area. |