marcosnils / bin

Effortless binary manager
MIT License
712 stars 47 forks source link

Filter logic not working properly for helix #181

Open Susensio opened 11 months ago

Susensio commented 11 months ago

I'm trying to install helix from https://github.com/helix-editor/helix/releases but I get no proper matches, I think it could be due to being compressed in tar.xz

bin install github.com/helix-editor/helix
   • Getting latest release for helix-editor/helix

Multiple matches found, please select one:

 [1] helix-23.10-x86_64.AppImage
 [2] helix-23.10-x86_64.AppImage.zsync
 Select an option: 
marcosnils commented 11 months ago

hey there! bin supports xz. Seems like what's happening here is that our filtering logic is not picking up the correct files for some reason. If you run bin install -a https://github.com/helix-editor/helix, you should be able to manually pick the release.

Do you mind editing the title of the issue so we can work on a fix? :pray:

Susensio commented 11 months ago

Done. How can I help? Can you reproduce the bug?

Susensio commented 11 months ago

Output with debug enabled

   • debug logs enabled, version: 0.17.2
commit: f7265c40a7b245a698a7eee603234ece8e1c7c86
built at: 2023-10-03T08:53:00Z
built by: goreleaser

   • Config directory is: /home/susensio/.config/bin
   • Download path set to /home/susensio/.local/bin
   • Getting latest release for helix-editor/helix
   • Keeping helix-23.10-x86_64.AppImage.zsync (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321490) with highest score 26
   • Keeping helix-23.10-x86_64.AppImage (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321501) with highest score 26
   • Removing helix-23.10-x86_64-windows.zip (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321505) with score 11 lower than 26
   • Removing helix-23.10-x86_64-macos.tar.xz (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321509) with score 11 lower than 26
   • Removing helix-23.10-x86_64-linux.tar.xz (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321515) with score 21 lower than 26
   • Removing helix-23.10-source.tar.xz (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321525) with score 1 lower than 26
   • Removing helix-23.10-aarch64-macos.tar.xz (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321530) with score 6 lower than 26
   • Removing helix-23.10-aarch64-linux.tar.xz (URL https://api.github.com/repos/helix-editor/helix/releases/assets/132321531) with score 16 lower than 26

Multiple matches found, please select one:

 [1] helix-23.10-x86_64.AppImage
 [2] helix-23.10-x86_64.AppImage.zsync
 Select an option:

My machine specs:

OS: Debian GNU/Linux trixie/sid x86_64
Kernel: 6.5.0-4-amd64
Packages: 3347 (dpkg), 7 (flatpak), 1 (cargo), 5 (snap)
Shell: fish 3.6.1
DE: GNOME 44.5 (wayland)
WM: Mutter
WM Theme: Adwaita
Terminal: tmux
marcosnils commented 11 months ago

Done. How can I help? Can you reproduce the bug?

yes, I can reproduce the bug. As commented above, if you do bin install -a https://github.com/helix-editor/helix bin will allow you the select the corresponding xz file.

Susensio commented 11 months ago

Done. How can I help? Can you reproduce the bug?

yes, I can reproduce the bug. As commented above, if you do bin install -a https://github.com/helix-editor/helix bin will allow you the select the corresponding xz file.

Yes I did it and it worked perfectly. Thank you.

I have a question about bin internals. Is this info about what resource is being selected stored somewhere? That is, in a future bin update, does it remember what selection I made and what binary to use?

marcosnils commented 11 months ago

I have a question about bin internals. Is this info about what resource is being selected stored somewhere? That is, in a future bin update, does it remember what selection I made and what binary to use?

yes, if you run bin --debug at the very top you'll see here the config directory is placed.

yozachar commented 3 months ago

It's similar for fish-shell

$ bin --debug i github.com/fish-shell/fish-shell
   • debug logs enabled, version: 0.18.0
commit: 91ae3e63bc1e2a499a832ba5f4e44d3c071b1345
built at: 2024-07-15T03:21:39Z
built by: goreleaser

   • Config directory is: $HOME/.config/bin
   • Download path set to $HOME/.local/bin
   • Getting latest release for fish-shell/fish-shell
   ⨯ command failed            error=Could not find any compatible files

$ bin --debug i -a github.com/fish-shell/fish-shell
   • debug logs enabled, version: 0.18.0
commit: 91ae3e63bc1e2a499a832ba5f4e44d3c071b1345
built at: 2024-07-15T03:21:39Z
built by: goreleaser

   • Config directory is: $HOME/.config/bin
   • Download path set to $HOME/.local/bin
   • Getting latest release for fish-shell/fish-shell
   • --all flag was supplied, skipping scoring

Multiple matches found, please select one:

 [1] fish-3.7.1.app.zip
 [2] fish-3.7.1.pkg
 [3] fish-3.7.1.tar.xz
 [4] fish-3.7.1.tar.xz.asc
marcosnils commented 3 months ago

It's similar for fish-shell

In this case I think the "Could not find any compatible files" makes a bit more sense given that bin could not automatically select a given that the user could perfectly chose between the zip , pkg org xz one.

Having said that, I think it would be reasonable to fallback to manual selection - same as supplying -a - if a match could not be found.

@yozachar WDYT?

yozachar commented 3 months ago

Having said that, I think it would be reasonable to fallback to manual selection - same as supplying -a - if a match could not be found.

@yozachar WDYT?

Yes, that sounds right. The -a flag could be counted redundant, after it's function becomes the default fallback. But this behavior must not hamper, debugging the scoring logic, if and when required.


As for github.com/fish-shell/fish-shell, a solution to https://github.com/marcosnils/bin/issues/109 is befitting.