helix-editor / nucleo

A fast and convenient fuzzy matcher library for rust
Mozilla Public License 2.0
899 stars 28 forks source link

Standalone CLI - toy project #20

Closed TornaxO7 closed 1 year ago

TornaxO7 commented 1 year ago

Hi! I saw your reddit post about nucleo and I got curious about writing a standalone cli version as a little "side project" (as "coding-breaks" beside learning for my exams). I've already started but I didn't create this issue at the beginning because I don't know how far I'll get or if it will turn into a mature cli program at all.

However, you said in this answer:

So somebody else could also contribute that (although if somebody does this, please reach out first).

So I'm writing this issue, just in case you may be interested in it and want to use some of my code if you start to write the standalone cli of nucleo. Here's the link to my repo: https://github.com/TornaxO7/nucle

If you have some suggestions/hints/questions, feel free to ask.

pascalkuthe commented 1 year ago

If you are just working on this for fun (and to see how far you get) then feel free to experiment. I am glad you are working on this, I don't have the time to write a CLI right now so having an exmaple of how to use the high level API that is a bit more self containted then helix would be nice.

With my commetn about reaching out first I mostly wanted to prevent people reading my comment and going off to write the entire CLI withoult any communication with me and then being upset when the CLI does not align with my visiion and I don't endup merging it.

That kind if basic communcation sounds like basic common sense but sadly we had this exact situation happen multliple times with helix so I like to just leave a not like that whenever I say I am open to contributions.

If you have some suggestions/hints/questions, feel free to ask.

I would suggest you heavily reference the implementation (file picker) in helix. It's pretty much there reference implementation right now.

I saw you used walkdir, I would suggest using ignore not only is it good at ignoring stuff you don't need but it also runs in parallel so its a lot faster. Compared to fzf item injection is completely lock and wait-free in nucleo so it will scale nicely across multiple threads. I am not sure if (or how much) faster it is then just doing fd | fzf (or fd | nucleo) that is somehting I was quite interested in. You may be able to event just use fd as a library and reexport their CLI flags (not sure if the fd codebase allows that but rust codebases often do).

If you do hope to upstream this eventually I would also suggest that you copy the helix-tui library from helix. It's what I intend on using (since I will be doing more work on that anyway so all my work there also benefits nucleo automatically).

But in general if you just do some experimentation for youself and are ok with the results not neccesiraily being merged into this repo, just go wild and do whatever you want. I am always happy to see people use nulceo! Just wanted to make sure there were the right expectations.

I will convert this to a discussion since its not really anything actionable (and more a discussion :D)