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

Any plan to publish as a library crate? #194

Closed
fujidaiti opened this issue May 30, 2023 · 6 comments
Closed

Any plan to publish as a library crate? #194

fujidaiti opened this issue May 30, 2023 · 6 comments
Labels
C-question Category: Further information is requested

Comments

@fujidaiti
Copy link

I think it would be nice to be able to use the functionality of sd from Rust code. Yes, we can do it with std::process::Command or something, but it is not type safe.

@PeterlitsZo
Copy link

What is your meaning, please? Do you mean that we should publish it as a Rust library?

@fujidaiti
Copy link
Author

fujidaiti commented May 30, 2023

I would be happy if this were the case. For example, std::fs::create_dir could be used to do the same thing as the mkdir command, but inside Rust code. However, there is no straightforward way to do the same thing in Rust as the sd or sed commands, as far as I know. So it would be useful if the sd command could be a function (like sd::replace(...)) and published as a library.

@PeterlitsZo
Copy link

PeterlitsZo commented May 30, 2023

I think it is a good idea... @CosmicHorrorDev do you think so? I think I can work on it. It sounds funny for me.

@CosmicHorrorDev
Copy link
Collaborator

I could see it being useful. I think go ahead and start on it if you want 👍

PeterlitsZo added a commit to PeterlitsZo/chmln-sd that referenced this issue Jun 1, 2023
PeterlitsZo added a commit to PeterlitsZo/chmln-sd that referenced this issue Jun 2, 2023
Add config builder, test and support `&str` argument.
@dev-ardi
Copy link
Contributor

I don't think converting sd into a library is a good move as it introduces the burden of maintaining a stable public API, making future changes more cumbersome and necessitating in-depth versioning management.

The regex crate already offers a better solution for finding and replacing, the only thing that sd adds on top of it as a library would be file mmaping.

The crate maintainers will need to document the API and add additional tests beyond what's typical for CLI usage
This also opens the door for feature creep as library users will request more general features.

I personally don't think it's worth it for the future of the crate.

@CosmicHorrorDev CosmicHorrorDev added the C-question Category: Further information is requested label Oct 22, 2023
@CosmicHorrorDev
Copy link
Collaborator

Now that the last release is out I think I have to say that I changed by mind and don't think we should publish a library crate any time in the near future. There's too many ongoing and planned changes going on in sd right now, so I don't foresee a stable usable interface that won't be a pain to both depend on and maintain

This may change in the future, but I'll be closing this for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants