News for hackers. Stuff that matters.
Re:Become Shell Literate by mattmanser on Saturday December 12, 2020 @02:01PM (#25400554)
On top of that, his opening example is so easy if you use a GUI for Git it's mind-boggling.

It'd literally be click status column to sort, click top entry, shift-click bottom deleted file, right-click, restore. Done, a couple of seconds without even thinking about it.

And somehow this simple task in a GUI inspired a blog post about how useful the shell is.

I'm not going to deny a shell is extremely useful, and knowing far more than I do makes you a better programmer, but there's also using the right tool for the job.

Re:Become Shell Literate by natrys on Saturday December 12, 2020 @04:05PM (#25401704)
The point of the article clearly is about how a few general purpose shell tools can combine together to be the "right" tool in so many different usecases for which they weren't specifically designed for. You can argue for more specialized tool, and that's okay. But saying just "this" task inspired this blog post clearly misses the point of the article, which is generality.

In any case there are like a bazillion of GUI git tools. Are you certain each and all of them support this feature? If someone doesn't know any of them, what are the odds the first GUI tool they install has this feature? The hidden cost of finding the "right" tool is overlooked in its advocacy.

Re:Become Shell Literate by mattmanser on Sunday December 13, 2020 @06:01PM (#25411325)
And there are a bazillion CLI tools, you can't use that defence.
Re:Become Shell Literate by dan-robertson on Saturday December 12, 2020 @02:10PM (#25400626)
That relies on there being a sufficiently versatile gui which isn’t guaranteed. Here’s some features that your example requires which I often don’t see in guis:

1. Tables you can sort

2. Tables you can sort on the thing you actually care about

3. Being able to select multiple entries and act on your selection

It’s not too hard to imagine criteria which could make the problem much harder for a gui, e.g. only doing the operation in a subdirectory (if the sorting is stable this isn’t so bad), or only on files not in a subdirectory (stable sorting won’t help here, you’d need the gui to let you eg search for / and then remove those things from your current selection), or only operating on .h files (you’d need a search->select feature again), or doing an operation that the gui doesn’t support on multiple files, or passing the list to some other tool (maybe you want to search makefiles for references to the deleted files).

Something that a gui may be able to handle but that often screws up shells would be file names with newlines or spaces in them.

Re:Become Shell Literate by mattmanser on Sunday December 13, 2020 @06:04PM (#25411364)
It might not be hard to imagine it, but it's not actually that common an occurrence.

When's the last time you accidentally delete 200 files and needed to restore them? Probably because you were using a shell...

Oh yeah, and if you accidentally delete folder in a GUI? Usually you can just press ctrl-z, undo!

Re:Become Shell Literate by turbinerneiter on Saturday December 12, 2020 @02:15PM (#25400675)
In the end, your are gonna write regex either way :D
Re:Become Shell Literate by addicted on Saturday December 12, 2020 @04:15PM (#25401779)
Now do it across 5 projects. Or help explain to all your teammates how to do it.

With the shell, the second time you do it is a few keystrokes, if even. Wanna do it across multiple projects, it’s super easy without ever loading any of them in your IDE.

Wanna share it with teammates, you simply need to pass a script file to them, and they can do it without having to do anything.

And now finally if you need to incorporate this behavior in your headless CI? It’s the same script, instead of having to putz about with the CI configurations or whatever.

Re:Become Shell Literate by mattmanser on Sunday December 13, 2020 @06:02PM (#25411334)
a) It's not a common task

b) a few keystrokes === a few clicks

Re:Become Shell Literate by boogies on Saturday December 12, 2020 @02:05PM (#25400579)
> Done, a couple of seconds without even thinking about it.

This was originally done in a couple of seconds without deeply thinking about it (hence originally using grep instead of `awk '/re/'`).

(Edit: quote)