Open mntn-xyz opened 3 months ago
Just wanted to add, os/exec is a straightforward way to run external commands safely, and avoids many of the potential escaping pitfalls you'd otherwise encounter.
Just to confirm that I understood your idea:
You'd like to have a way to run custom commands from within items that you're viewing inside neonmodem -- similar to the existing open
command -- and you would like to be able what parameters these custom commands would retrieve?
If I understood this right, then this feature is fine by me. Alongside of the existing open
command, there could be a open with ...
command that allows running user-specified commands. Each command would require a unique hotkey, so the user could press the open with...
hotkey (e.g. uppercase O
) followed by the command's hotkey to execute it.
Wdyt?
Yes, you got it exactly. With this, Neonmodem could serve as the frontend/viewer for feeds, and a hotkey could be pressed to send the details of the selected item to an external app for processing.
The open with
approach you suggested should work well.
A few other use cases I thought of:
All should be possible with this feature.
This would be a great tool for reviewing and collecting research/resources, finding news to repost to socials, and so on, especially once RSS support is added. To do this, users need a way to save and organize specific feed items for later access, preferably from outside the application. Rather than build an interface for those use cases (impossible to imagine every scenario), it would make sense to add a custom command/shortcut handler that passes information about the currently selected or viewed article to another program. This would open up infinite possibilities via scripting.
My suggestion is to have users define optional hotkeys, with a command associated with each hotkey. Substitution would be used on the command to provide information about the feed and item.
Rough examples of values that might be provided for substitution:
For a simple example, if you set up a command as
nb bookmark
with arguments${item-url} --tags incoming
then the hotkey would append the item url to nb bookmarks with the "incoming" tag. Or a user may pass it to a script that allows them to enter tags before saving the url, and so on. It would be nice if the script could have an interactive console, but having the user rely on screen or tmux for this would probably be adequate.Happy to work on this if you think there is a chance for inclusion!