chmln / handlr

A better xdg-utils
MIT License
608 stars 24 forks source link

'open' assumes same mimetype for all args #26

Closed benmaddison closed 3 years ago

benmaddison commented 3 years ago

When opening multiple paths with handlr open p0 ... pn, the handler found for p0 will be used for all subsequent paths p1 ... pn.

This obviously breaks in cases where the paths are of multiple different types.

I would suggest that the correct behaviour should be:

  1. group paths by mimetype and associated handler
  2. for each unique handler, determine if it supports multiple file (e.g. nvim):
    • if yes: open all associated paths with a single instance of the handler
    • if no: open an instance of the handler for each path

Let me know if the above sounds right, and I'll attempt a PR?

benmaddison commented 3 years ago

@chmln please would you let me have your thoughts on this? I'm happy to try to implement, but I'd like your buy-in before I do.

chmln commented 3 years ago

@benmaddison Yes that sounds good! However I would just group arguments by the associated handler and ignore the mime type.

For example, if we have handlr open style.css index.html and neovim is the handler for both, there's no need to separate the two arguments by mime type

benmaddison commented 3 years ago

@benmaddison Yes that sounds good! However I would just group arguments by the associated handler and ignore the mime type.

Great. I'll try find some time to work on an implementation.

For example, if we have handlr open style.css index.html and neovim is the handler for both, there's no need to separate the two arguments by mime type

Sorry, I should have explained better - I should have said grouped by handler. I think we're on the same page.