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

Refactor async support to return (possible) promise directly #1513

Merged
merged 1 commit into from May 6, 2021

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented May 5, 2021

Pull Request

Problem

The promise returned by an async action handler was being stored in root command and retrieved after parsing. This pattern does not extend to adding other async callbacks, such as discussed in #1197.

Solution

Return the action handler result directly (rather than storing).

Factor out the preparation code from .parse() so can be called symmetrically from .parseAsync(). Use simple async and await pattern in `.parseAsync().

abetomo
abetomo approved these changes May 6, 2021
Copy link
Collaborator

@abetomo abetomo left a comment

It’s nice.

@shadowspawn shadowspawn added the pending release label May 6, 2021
@shadowspawn shadowspawn added this to the v8.0.0 milestone May 6, 2021
@shadowspawn shadowspawn merged commit 59c8153 into tj:release/8.x May 6, 2021
12 checks passed
@shadowspawn shadowspawn deleted the feature/refactor-async-2 branch May 6, 2021
@shadowspawn shadowspawn removed the pending release label Jun 25, 2021
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.

None yet

2 participants