req is a text snippet router: given a string, say from your X11 cut buffer, it will classify and extract information contents, and merge that with context information. You write rule files ("ports") in awk to match against this data and to generate a menu of available shell commands.

github.com/robert-figura/req

For @dredmorbius . Feel free to bug me about anything.

I'm not sure if you asked for this, @dredmorbius, but in our short chat about surf I had mentioned that I have this something in awk, which eats urls, filenames, search words, ... all kinds of text snippets to do something with them. Also record them in a history file.

It is similar to plumber, but more flexible, and easily scales to hundreds of rules. You'd want to customize it a lot by writing awk files, so the audience is somewhat limited. I think there might be a high chance you'll love it.

Lots of use cases, @dredmorbius! I've replaced xdg-open with it, bound it to hotkeys to run it on the cut buffer, and pipe all 'open-with' functions through it, have it as mimetype handler, and in $EDITOR and friends.

It suggests programs to open files or urls, evaluate math expressions, runs a calendar, opens search services, runs port scanners or looks up domains, ...

Any single argument you'd give to a command and bothered to write a rule for. It's so versatile, I fear you think I'm nuts.

Heck, there's even an example for an episode calculator, that constructs an url for the next episode or season by replacing SxxEyy in a source url, and then opens that!

I've somewhat abused it to handle hotkeys, and somewhat more to colorize xterms. The latter turned out rather ugly.

If in doubt, forget about the examples, the framework under lib/ and the bin/req frontend are quite mature, as far as gawk allows. Then there's exec.so...

@dredmorbius

Sign in to participate in the conversation
mastodon.cloud

Everyone is welcome as long as you follow our code of conduct! Thank you. Mastodon.cloud is maintained by Sujitech, LLC.