Closed paulfioravanti closed 1 year ago
Hi Paul, nice to see you here!
Thanks for the suggestion, but to me personally, regex search-and-replace feels too far from the core business of generating a paper tape to be included in the plugin itself.
Maybe it would make more sense to delegate to an external tool that specializes in text transformation, like sed
?
$ tail -f tapey_tape.txt | sed -E "s/^{:COMMAND:SHELL:bash -ci 'osascript \\\$STENO_COMMAND\/([a-z\/]+)\/([a-z-]+\.scpt.*)'}(.*)$/{:COMMAND: \2}\3/"
Thanks for creating a great tool! Totally understand about the boundaries around Tapey Tape's core functionality, and thanks for the idea of delegating to an external filter (definitely better than eval
)! I'll give that a try and see how it goes, and hopefully I can get rid of my fork :)
Just to close the loop on this, I did end up going back to default Tapey Tape, and extracting the code out to a shell file, which I'm calling from a dedicated iTerm2 terminal profile (which is assigned to a hotkey so I can call up a Tapey Tape window whenever I need one):
Looks great!
In my steno dictionaries, I use a lot of commands that use the the
COMMAND:SHELL:
syntax from the Plover Run Shell plugin, wrapped in abash -ci '...'
command (for reasons). Those entries can have quite long values like:Tapey Tape outputting these values as-is to the log is absolutely fine from a functionality standpoint. However, when I'm in the situation of having limited horizontal room in the terminal that's showing the tape, I find I'd rather remove some of the cruft and have the above entries outputting like the following so they can fit on a single line:
I've been able to do this in a terribly evil way on my Tapey Tape fork to get me over the line (but really,
eval
just needs to go). Mytapey-tape.json
contains extra evil config to make those transformations possible:So yeah...anyway, this brings up the reason for submitting the issue:
Do you have any opinion around the transformation of entry values before they get output to the tape: having a presentation layer, or set of user-specified conditions (like my evil config, but not evil), of some sort? I can see that transformation of entry values already happens to a subtle degree when a
*
is added to a value when a translation is corrected:https://github.com/rabbitgrowth/plover-tapey-tape/blob/c31338c35f1e0b8a4c5a9783f684ace0323e1ced/plover_tapey_tape.py#L336
But what about for use cases like above, where having an abbreviated (or some other transformed) version of the value is desired? Is that kind of thing desired within Tapey Tape?