I do progressive filtering a lot. It's convenient to have all the intermediate results somewhere temporarily.
What I do is typing the command in one acme window with the working directory, and middle mouse swipe it. Acme shows the result of that command in a +Errors window with the same working directory. I change the name of this new popped up window (to something like `+Errors-cmd`, type a command that operates on the file name `/mnt/acme/$winid/body`, and middle mouse swipe it again. Acme shows the result of the new command under `+Errors` again. Rinse and repeat until I'm satisfied. I guess this way it gives a convenient temporary place for all the intermediate texts. I can of course edit them in place if I want.
Hmm, is there a straightforward way to be a bit more careful without detracting from the usefulness? What about a default blacklist of commands with the ability to override it through a config file?
I don't think a blacklist could possibly be comprehensive enough. I think you'd have to use some OS permission-limiting system to prevent it and any subprocesses it spawns from have any write access to the filesystem.
Author here: I hope something like that (syscall/capabilities limits) could work. If it is possible, it would just mostly solve the problem, I believe. I'm kinda starting to realize, that probably any command modifying some external state is potentially somewhat risky already, by potentially spinning some exponential feedback loop. (One person on lobste.rs mentioned that foo.bak.bak.bak.bak files could easily get created.) Regardless, I'm generally considering adding a shortcut/option to pause/unpause, and only execute on Ctrl-Enter when paused.
I hate to jump straight to Docker, but that seems to be a quick way to restrict access to the local file system. This of course limits utility, but would be much safer. Plus I think the usefulness of a tool like up is primarily in munging the input text anyway.
Docker is an obviously bad solution to this. If you can run a docker file you defacto have root on that computer ^1.
Firejail could do exactly the same thing, but without requiring the user running it download an entire second operating system, or requiring them to have root. Also, the sandboxing mechanisms that docker uses are just generally available and aren't hard to use, so if they went that way they may as well just use the actual syscalls that do what they want instead of importing and entire other operating system to run your commands. This is where my rant about docker, and the habits it encourages, would go. If I could figure out a way to phrase it politely. 1: https://github.com/moby/moby/issues/9976
Yes this is an amazingly dangerous and stupid idea. Sure it looks cool but so does a Lamborghini until it catches fire or you crash it into a tree at 150mph.
Giving a user an opportunity to correct mistakes before they kill themselves is a major feature of Unix. Sure when you’ve decided you know what you’re talking about but don’t it will quite obediently shoot your face off. We don’t want to make that bit easier though. Edit: please don’t take this as derision but more factual. It certainly looks cool and opens the idea for further discussion.
Stupid is too harsh, and I don't want to discourage anyone from contributing to open source, but I'm not sure this is all that useful either (at least not to me). Is the utility in not having to press Enter because this'll do it for me between every character? I can only think that the reason people like it so much is because it looks cool or most people don't know how to use command line editing keybindings effectively and like that they won't have to hit up arrow and move slowly across the command to edit. The fact that it doesn't have readline support, timestamped history support, or output the output of the last command to stdout at the end already seem like feature losses when compared to using a shell normally.
I disagree. The example in the GIF is something I've done many times, usually with a bunch of temporary files. Where the commands are side-effect free and relatively cheap, but the specifics are fiddly, this looks to be really useful. But not universally applicable, no!
I think at the point something like this becomes useful though, I've usually just dropped into writing a Python script - which more often then not is the right choice because there's a high probability I'm going to need to do more things soon anyway if it's getting that complicated.
Actually it’s more RTFM before you drive the car. A powerful skill many have forgotten which is supplanted by autonomous tools to make tripping over claymores easier.
After watching the GIF on the README.md I was like "WHERE HAVE YOU BEEN ALL MY LIFE" (actually just the past 10'ish years)!!!
Then I was like, I bet quite a few ancient wizards out there have some pretty amazing techniques they have picked up over the year. And that it would be great to be a "fly on the wall" watching some of these wizards do simple tasks. And that a YouTube channel watching them do simple tasks could be quite revealing and therefore very educational. Paul Irish did something like this a few years ago and I still use a bunch of the tools he introduced into my purview. Really, really improved productivity!
> And that a YouTube channel watching them do simple tasks could be quite revealing and therefore very educational.
Does such a channel exist? All I've ever found has been tutorials. I want to watch unix veterans use the tools. I've found that to be the best way to learn. Hell, that's how I learned vim.
Not a series, but a great one-off video by Gary Bernhardt, A Raw View into my Unix Hackery, linked below. I haven't bought his courses, but based on what I've seen of his talks and free material, they may get you part of the way (but I don't think all of the way) to what you're describing.
If anyone has taken his courses, I'm sure they could give better feedback on those. Either way, watch the video. https://vimeo.com/11202537
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.sh` script is super clever too!
I (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.
i 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.
Comments (217) 34 threads
Earlier commentsWhat I do is typing the command in one acme window with the working directory, and middle mouse swipe it. Acme shows the result of that command in a +Errors window with the same working directory. I change the name of this new popped up window (to something like `+Errors-cmd`, type a command that operates on the file name `/mnt/acme/$winid/body`, and middle mouse swipe it again. Acme shows the result of the new command under `+Errors` again. Rinse and repeat until I'm satisfied.
I guess this way it gives a convenient temporary place for all the intermediate texts. I can of course edit them in place if I want.
You know it probably, but there is also a mouse chord for piping selected text into a command. (2-1)
2-1 is just a concatenation of two strings and run the whole string. I wouldn't call it pipe.
As is stated in the README, if you write 'rm' or anything like it... oopsie oops.
...? :D
Continue this thread — 1 reply
Of course, much more thought is needed to try something like this. Somebody could as well use awk with its system command to do whatever..
Continue this thread — 1 reply
Firejail could do exactly the same thing, but without requiring the user running it download an entire second operating system, or requiring them to have root. Also, the sandboxing mechanisms that docker uses are just generally available and aren't hard to use, so if they went that way they may as well just use the actual syscalls that do what they want instead of importing and entire other operating system to run your commands.
This is where my rant about docker, and the habits it encourages, would go. If I could figure out a way to phrase it politely.
1: https://github.com/moby/moby/issues/9976
Continue this thread — 3 replies
[0]: https://gist.github.com/cocagne/4088467
Continue this thread — 2 replies
The only solution that I would find acceptable would be not to execute incomplete commands as they're typed.
Giving a user an opportunity to correct mistakes before they kill themselves is a major feature of Unix. Sure when you’ve decided you know what you’re talking about but don’t it will quite obediently shoot your face off. We don’t want to make that bit easier though.
Edit: please don’t take this as derision but more factual. It certainly looks cool and opens the idea for further discussion.
Continue this thread — 2 replies
Continue this thread — 1 reply
That's the complete opposite philosphy of Unix. That's, in fact, MIT/LISP philosophy.
Unix' Motto is DIE fast.
Continue this thread — 2 replies
Continue this thread — 10 more replies
Then I was like, I bet quite a few ancient wizards out there have some pretty amazing techniques they have picked up over the year. And that it would be great to be a "fly on the wall" watching some of these wizards do simple tasks. And that a YouTube channel watching them do simple tasks could be quite revealing and therefore very educational.
Paul Irish did something like this a few years ago and I still use a bunch of the tools he introduced into my purview. Really, really improved productivity!
Does such a channel exist? All I've ever found has been tutorials. I want to watch unix veterans use the tools. I've found that to be the best way to learn. Hell, that's how I learned vim.
https://www.youtube.com/watch?v=qsWY-8n9igM
https://www.youtube.com/watch?v=_NUO4JEtkDw
https://www.youtube.com/watch?v=blpCz9HsUaA
If anyone has taken his courses, I'm sure they could give better feedback on those. Either way, watch the video.
https://vimeo.com/11202537
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.sh` script is super clever too!
[1]: https://tcj.io/i/textmate_piping.gif
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.
All comments shown.
Couldn't load more comments. Check your connection and try again.