3 ms·
Nicely done! I do a pretty similar version of this with command-| in textmate, but I've wished for/thought about building a command like this to speed up the p
by traviscj 8y ago
Nicely done!
I do a pretty similar version of this with command-| in textmate, but I've wished for/thought about building a command like this to speed up the process!
The textmate approach does have the advantage (or perhaps disadvantage, for large enough inputs!) of emitting immutable "views" of the data at each step, rather than (presumably?) re-evaluating the pipeline each time, which is nice if the steps of the pipeline are the slow part, or to go back 2 steps and start a new pipeline. Maybe a potential future flag? :-)
Automatically emitting an `up<N>.sh` script is super clever too!
- akavel 8y agoCan you please elaborate a bit on the textmate approach? I don't fully grasp it from this description yet... while it totally sounds interesting...
- traviscj 8y agoI (partially) recreated your `seq 1 15` example here [1] -- no sleep, but my lshw wasn't as interesting as yours :-) I'm hitting command-shift-| to bring up the "filter through command" dialog. [1]: https://tcj.io/i/textmate_piping.gif https://tcj.io/i/textmate_piping.gif
- akavel 8y agoOk, I get it now. Thanks! :)
- em-bee 8y agoi have not used textmate, but the description let me come up with this idea. maybe it's useful: consider the command A | B | C | D when you process it in up, split the command at the | and process each one separately. that is first run A; save the output into a buffer (BA) then pipe BA into B, save that into BB, and so on, until you have 4 buffers containing the outputs of A; A|B; A|B|C; and A|B|C|D; now when the user edits, you can see which section is changed. say the user changes the command C into C1, so the pipeline becomes: A|B|C1|D at this point you can pipe buffer BB (which has the output from A|B) into C1; write that into a new buffer BC1; and pipe that into D; the old buffers C and D can be removed at this point, or you can keep them around in case the user undoes their change and goes back to an old version. greetings, eMBee.