marwanhawari / stew

🥘 An independent package manager for compiled binaries.
MIT License
185 stars 14 forks source link

Feature Request: Include Forks #5

Closed typkrft closed 2 years ago

typkrft commented 2 years ago

stew search lazydocker does not return lazydocker-high-contrast, which is a fork of lazydocker, for instance. An option to search through forks would be nice.

marwanhawari commented 2 years ago

Can you provide a link to that fork? I can't seem to find it.

Under the hood I'm just using the Github search API, so I'm limited by what the API provides.

typkrft commented 2 years ago

https://github.com/ThomasLachaux/lazydocker-high-contrast

Completely understand. It does work installing it directly so that's great.

marwanhawari commented 2 years ago

Yeah it looks like stew install ThomasLachaux/lazydocker-high-contrast works fine. I'm not sure why it doesn't show up with the GitHub search API. It doesn't even show up when I search for it on the GitHub website.

Closing this issue.

typkrft commented 2 years ago

If you do an advance search and select the option "and" returning forks it'll show up. I'm not sure if the API has a similar feature.

Looking at the search query it adds forks true to the url.

marwanhawari commented 2 years ago

Oh yeah good catch! Here's what the API URL looks like: https://api.github.com/search/repositories?q=lazydocker-high-contrast+fork:true

Can you make a PR? The getGithubSearchJSON function needs to be modified

typkrft commented 2 years ago

I'll look into it when I have some free time, probably not anytime soon. I don't really know anything about go. I tried to concatenate it, but I seem to be breaking something. Also it would probably be ideal to add a flag, then when some searched for lazydocker, the forks populate and I believe that would be this url https://api.github.com/repos/jesseduffield/lazydocker/forks so basically the repo with /forks gives the relevant JSON.

marwanhawari commented 2 years ago

Oh I see, you want the ability to browse the forks of a specific repo. That's a whole different endpoint than the search API and probably something that isn't within the scope of the project.

I still think that stew should include forks in the search results though and that can be accomplished by adding +fork:true to the end of the search API URL. It would make it so that stew search lazydocker-high-contrast would actually show the https://github.com/ThomasLachaux/lazydocker-high-contrast repo. It would be a small PR.

There was a problem with my regex pattern for validating search queries but I just pushed a commit and it should be fixed now (so adding +fork:true should work now).