proycon / vocage

A minimalistic spaced-repetion vocabulary trainer (flashcards) for the terminal
GNU General Public License v3.0
142 stars 10 forks source link

Could it be possible to add a metadata feature to execute shell commands in the background? #7

Open Matthew-Tate-Scarbrough opened 3 years ago

Matthew-Tate-Scarbrough commented 3 years ago

In short, a feature that would allow you to enter shell syntax into the card deck. I was thinking something convoluted like this:

\#--columns russian english spanish
\#--!get_sound (sleep [&] ; gst-play-1.0 audio/[&].opus)
\#--showcolumns !get_sound(3,russian),russian

The idea, of course, is that the first argument would pass through the seconds desired to sleep before playing the sound in the background, and then the second would be whatever the text of the first column is, and also display the information of the first column.

So, in other words, what would be passed to the shell would be, in the case that the Russian word is «красный»:

sleep 3 ; gst-play-1.0 audio/красный.opus

Having such a simple solution to pass arguments to the shell would also allow spawning pictures with an external program, such as feh, and using an exclamation point/bang (!) would help further denote them. It goes without saying, but obviously all searching is done relative $PWD. This would still allow easily zipping folders with tar and sharing them.

proycon commented 3 years ago

I like this idea (and am open to pull requests). I'm not sure about the syntax yet though. It's a bit too convoluted to integrate it into --showcolumns, we'd better make an --execcolumns or something. Also I think this would need to be an explicit opt-in option (disabled by default) because running shell commands is of course a security risk.

Matthew-Tate-Scarbrough commented 3 years ago

I agree completely. If I were comfortable with Rust, I would figure it out and make a pull request yesterday.