nix-community / comma

Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau]
1.12k stars 50 forks source link

Cannot see which packages contain matching executable without running anything #72

Closed stelcodes closed 4 months ago

stelcodes commented 8 months ago

I frequently check which packages include an executable but I don't want to run the command. Comma shows me what packages contain the executable with fzy in the selector but then I have to send a SIGINT to exit. If there's only package, the command will just run. --print-package only prints the package containing the one chosen executable and runs the command afterward.

What if there was another flag like --list-packages that printed off each package containing the executable and exited immediately after?

Artturin commented 4 months ago

For --list-package Just use nix-locate instead

$ alias "wherefile"="nix-locate -w --top-level --at-root  --"
$ wherefile "/bin/hello"
haskellPackages.hello.out                       990,720 x /nix/store/adhrgz75290hbkwar4n6pa2cmrll0vix-hello-1.0.0.2/bin/hello
mbedtls.out                                     119,784 x /nix/store/9f0dmr40pa3kmxiabxkfaidrbjkp6aqx-mbedtls-3.6.0/bin/hello
mbedtls_2.out                                    48,992 x /nix/store/n9n9jfa6z3s3bqhhlhc2nbgbn9vgbhxw-mbedtls-2.28.8/bin/hello
hello.out                                        55,712 x /nix/store/g1n2vryg06amvcc1avb2mcq36faly0mh-hello-2.12.1/bin/hello
fltk.bin                                        613,144 x /nix/store/g58kncgn911y1yb7v6lklidivysx7b4j-fltk-1.3.8-bin/bin/hello
fltk14.bin                                      885,816 x /nix/store/0v7hyap7nc0g0hpjx96zb8qrkm1l0q75-fltk-1.4.x-2021-12-21-bin/bin/hello

If you want /bin/ prefilled then make a function

Artturin commented 4 months ago

https://github.com/nix-community/comma/pull/79