chg: Set up the main running function to use handler functions #45
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.
A very small PR with no associated issue because it's just a little thing I noticed.
While we do enable users and plugins to add options to the parser, one use case that is currently not properly supported is to use subparsers to add functionality to Quilla that is not directly related to validations. For example, if a developer would like to add a command such as
quilla az
that enables users to download the images from their azure blob storage, their plugin would not actually require running any validations.In these cases, the plugin is adding functionality that is intimately coupled with Quilla, but the proper execution flow of Quilla should be interrupted to enable this. To that affect, this PR addresses this need by using the concept of "handler functions"- Default functions that are set at the parser level which dictate the "main" execution flow after the Context object is created.
Going back to the blob storage download plugin, a plugin author could create a subparser for their plugin that allows users to have the command
quilla az download <run_id>
, and set the subparser's handler function to be one of their own. Then, when Quilla callsctx.run()
, the subparser function that was specified would be called whenever a user callsquilla az download <run_id>