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
feat: onFinishCommand handler #1473
Conversation
03e2507
to
b449cd1
Compare
@bcoe Perhaps redundant with #1452? Or perhaps not if #1452 only lands in yargsa... Not incompatible, anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. Would you mind checking/fixing the few points @Goodluckhf and I mentioned?
rather than adding additional functionality to yargs for handling async behavior, I'd rather see us combine efforts here and figure out what an async-first version of yargs might look like. |
@mleguen @petrgrishin if there was a stop gap between a fully async version of yargs, and something better than what we have today, I'd be open to this too; but would love for folks to collaborate and figure out what those two versions of the library are. |
@bcoe @petrgrishin Sure, this was the idea behind my comments on this issue. I feel however that yargsa and this issue are complementary:
I would then recommend sticking here to a standard sync API, ie:
And applications using promise-returning command handler should be encouraged to use yargsa. What would you think of this? |
@mleguen your suggestion of using this work as an intermediate step towards a fully async API seems reasonable to me (my wish would be for us to get down to a healthier number of open issues on the existing yargs API, before we made the sweeping change proposed in yargsa). @petrgrishin would you be open to addressing some of the code review brought up here? |
19cd8d6
to
f1d41ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petrgrishin Thanks!
0a2e98f
to
7560bd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
7560bd9
to
cfdf498
Compare
Great feature! When will a version with this feature be released? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petrgrishin Small typo in the docs
### Example | ||
``` | ||
yargs | ||
.comand('cmd', ..., async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, should be command
not comand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dapplion. Mind doing a small PR to fix this typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petrgrishin this is released now, take it for a spin and make sure it's working for you? One thought for the future, should we potentially make |
Example usage: