Closed ldub closed 2 years ago
Latest commit: f5ee025340fbe54c48485ed1a73139a771be2983
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
cmd-ts | ✅ Ready (Inspect) | Visit Preview | May 17, 2022 at 5:47AM (UTC) |
Hey! Happy that it provides value to you too! 😁 this PR looks great. Do you want to create a changeset so it will be added to the changelog? (I've been toying with changesets for a while and it's amazing 😁 )
you know what I'm just gonna merge and release and set up changesets in this repo because I'm not sure it is set up correctly yet 😁
Hey @Schniz,
I really like your package. You've created the best argument parser in the typescript world, IMO.
However, sometimes it is necessary to be able to use runtime objects after parsing, which aren't available during command creation.
I've got this lovely command here, but if my
client
for some third party service gets created at a later point, I can't use theclient
in the command handler.In general, it would be extremely useful if it was possible to use your package to handle typesafe command registration and parsing, and retrieve the parse result directly, instead of only being able to pipe it through the handler.
This PR exposes exactly this functionality, via a
parse
function on the runner. Would you consider merging and supporting this functionality? There is really no alternative for this kind of thing. Usingio-ts
directly in each project would be a pain and would require recreating a ton of the work you already did.Another option would be to give the runner the ability to overload the handler when
run
is called, as opposed to only being able to supply it when the command is created.