stylance-rs icon indicating copy to clipboard operation
stylance-rs copied to clipboard

Programmatic usage

Open numfin opened this issue 1 year ago • 1 comments

Could you make stylance-cli functionality into library so i can put it inside build.rs ? This way i can use any version (even from git) of stylance generator functionality without installing binary on system

numfin avatar Jun 07 '24 17:06 numfin

I have nothing against supporting library usage of this lib so I'll consider adding this in the future.

I recommend checking out cargo-run-bin which is a nice tool for installing binaries per rust project instead of globally, it could serve as an alternative workaround for your issue. I have not tried it with stylance but have used it with other binary tools with success.

basro avatar Jun 08 '24 14:06 basro

Yeah, simply publishing a second crate, probably stylance-cli, with a lib.rs that exports the run function is enough for me. I'm not even using it in build.rs, just a cargo xtask custom script

ActuallyHappening avatar Jan 23 '25 10:01 ActuallyHappening

As you suggested I've split stylance-cli run function into lib.rs. This is released in v0.5.4. When including as a dependency you should disable the default features so that it wont bring dependencies that are only needed for the binary (such as tokio).

Let me know if this worked out for you.

basro avatar Jan 23 '25 11:01 basro

@basro im not sure im going to use rust frontend in near future because of ecosystem immaturity, but its really nice you managed to do lib extraction!!! Glad to see development is happening <3

numfin avatar Jan 26 '25 16:01 numfin

I'll close this issue as completed.

basro avatar Jan 27 '25 12:01 basro