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

chg: Set up the main running function to use handler functions #45

Merged
merged 5 commits into from
Jul 23, 2021

Conversation

cryptaliagy
Copy link
Collaborator

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 calls ctx.run(), the subparser function that was specified would be called whenever a user calls quilla az download <run_id>

@cryptaliagy cryptaliagy marked this pull request as draft July 22, 2021 16:48
@cryptaliagy
Copy link
Collaborator Author

Changing this PR to a draft because I might need to change up some of how the CLI options are parsed to allow this to work effectively and I don't know if it makes sense to do it at this point

@cryptaliagy cryptaliagy marked this pull request as ready for review July 22, 2021 19:16
Copy link
Collaborator

@daniellopezgarcia daniellopezgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cryptaliagy cryptaliagy merged commit 14e0ad4 into main Jul 23, 2021
@cryptaliagy cryptaliagy deleted the feat/parserHandler branch July 23, 2021 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants