implement mimeo-style regex handlers #60
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #57 and sort of indirectly addresses #56.
I added the ability to associate arbitrary commands with files and URLs that match regular expressions, similar to what another resource opener, mimeo, supports. See my changes to README.md for detailed info on how it would be used.
They would be defined in
~/.config/handlr/config.toml
, which I figured would be fine since it was previously only used for two options.However, I have only implemented this functionality as it pertains to
handlr open
. So they will currently not be included inhandlr list
orhandlr get
or assignable withhandlr set
.Also, I should mention that I used sort of a hack that essentially creates a faux instance of
DesktopEntry
so that I could leverage the existing command execution code without making major changes to it.At one point, I had to update handlr's dependencies to fix an issue with the regex crate, so I had to fix a few lines of unrelated code due to a breaking change in clap.
Edit: I think updating Clap makes this pull request address #53 as well.