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: support for custom commands #8
Conversation
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.
Yeah, I like this and good idea! I think we could make a couple changes though.
@dsherret hmm; I am getting different behavior when I run this locally in Windows. Both the original and modified version pass here, which now that I think about it I need another coffee. |
It's probably finding a |
Of course it is! ..fires up mac..
|
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.
This all looks very good to me. Thanks a lot! I'm just going to make a few small changes to it myself then merge the PR and do a release.
👍 no problem, glad to contribute back where I can. Thanks again for throwing this together! |
|
||
const result = await commandBuilder | ||
// now includes the 'true' command | ||
.command("true && echo yay") |
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.
It would be nice to build in true
and false
by the way :)
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.
I knew you were going to say that :)
I have a few more tasks yet to work through, so, I imagine there will be a PR or two coming with more commands. I'll put those on my list :)
Thanks again for this and all your other PRs! I released version 0.8.0. |
As mentioned in #7, it'd be nice to extend the shell parser to be able to handle additional commands as though they were built-ins/in the system path. Here's a quick take at implementing support by means of extending the
CommandBuilder
with ahandle()
method for registering a custom command handler/callback. This should fit in nicely with the custom builder pattern outlined in the documentation.PR is not so much WIP as at a point where I could use some feedback:
handle
, butcommand()
is obviously taken andcustomCommand()
didn't feel right either.Record<string, CustomCommandHandler>
?