scoop-search icon indicating copy to clipboard operation
scoop-search copied to clipboard

scoop help command raises an exception

Open brunovieira97 opened this issue 3 years ago • 2 comments

When calling scoop help, PowerShell issues an exception caused by duplicate search subcommand.

Only happens if scoop-search is currently installed. Tried without a profile and the exception is still raised.

❯ scoop help
Usage: scoop <command> [<args>]

Some useful commands are:
MethodInvocationException: C:\Users\bruno\scoop\apps\scoop\current\libexec\scoop-help.ps1:29
Line |
  29 |          $commands.add("$command ", $summary) # add padding
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Add" with "2" argument(s): "Item has already been added. Key in
     | dictionary: 'search '  Key being added: 'search '"

brunovieira97 avatar Feb 10 '21 11:02 brunovieira97

Oh boy, after researching it apparently it is because of scoop's alias system. scoop-search gets installed in the same directory as aliases causing scoop to think it is an alias. Long story short it's not really fixable without some horrible workaround.

On the other hand this is a great opportunity to just turn scoop-search into a scoop alias which would remove the need of adding this awkward powershell hook. However this would mean the name would need to change, to scoop-find or something like that. In the end it would be a good change, but might be annoying for people to transition.

Any thoughts?

shilangyu avatar Feb 10 '21 19:02 shilangyu

Based on lukesampson/scoop#4239, another possibility would be to improve Scoop's own search system based on your awesome work.

But that's probably a long discussion on the main repo, and may never see the light of day.

If I understand correctly, your idea is to turn scoop-search into an all new scoop subcommand, meaning the user would be able to use either search (vanilla) or find (this one). That's a nice idea to implement on the meantime, probably less prone to becoming stuck on an issue for a long time.

brunovieira97 avatar Feb 11 '21 19:02 brunovieira97