Live data from Hacker News

Show HN: Oh-heck, a terminal command for when you forget other terminal commands

oh-heck.dev

121–130 of 132 posts

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#121

Earlier quoted context omitted.

this fails to embody the 3 great virtues of a programmer

Yeah, but it's also practical, so who's really winning here?

I don't know because I'm from the "if you need to write down multiple examples of how to use a command in order to move forward with it indefinitely, then it has an absolutely terrible UI and that is in fact the root problem you should be fixing" school of thought.

I'm the kind of person that prefers wrapping commands with terrible UI in functions with much better UI though https://github.com/pmarreck/pac . Like who the fuck thought that "pacman -Syyu" (where the number of y's semantically changes the meaning) would be a great idea? An idiot, a sadist or an autist, that's who. Certainly not someone who actually cares about normal humans.

In my opinion, instead of writing all these helper or cheatsheet functions as constant reminders of how bad the TUI (text user interface) is on these commands, someone should release a library of wrappers that wraps all of these turds (I'm sorry, "diamonds in the rough") in sensible and consistent TUI with consistent option formats, autocompletes, maybe some inline documentation while you type the command, etc. And then we wouldn't need all these band-aid tools.

I can say as an Arch fan but pacman command-tool despiser (did I mention that it doesn't at all try to stop you from easily breaking your dependency structure JUST in order to support some very corner use-cases?), prior to writing pac I was "man pacman"'ing for months, and after I finished it I haven't needed to do that EVER. (Yet.)

The "ip" command is an example of one I'd say has a good TUI.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#122

Slightly related is https://cheat.sh/ [0], which returns real-world examples of how to use a given command. The results are nicely formatted and color-coded. Give it a try in your terminal: curl https://cheat.sh/rsync I've found it to be really handy for things like awk, rsync, ssh, and others with byzantine parameters. Not to mention it's free. [0] https://github.com/chubin/cheat.sh

tldr.sh is a similar project.

https://github.com/tldr-pages/tldr

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#123

McFly uses either a neural net or fzf along with sqlite and clever script hooks to do basically everything you may need: https://github.com/cantino/mcfly

Wow, thanks for the tip! This looks really useful, I've been using fzf for a long time and it works well but this seems like a clear improvement to that

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#124
post #6

And here's a command that tries to fix up a mistake after you type it. Like this one, it's also named like what you might say afterwards. https://github.com/nvbn/thefuck

This is great. Is there an easy "open source terminal emulator" where I can run this after I typed enter but before it is executed? More like. is there a way the terminal can understand I typed a bad command and then give suggestions for changing it.

GNU Emacs has a module called eshell-smart that borrows from Plan 9's 9term.

When you run a command it moves the cursor (point in Emacs) to the beginning of the line and shows output below it. If you start typing it jumps to a new prompt allowing you to enter a separate command. If instead you move right from the beginning of the line it sees you are correcting/tweaking the command and doesn't jump to a new line when you type something. If you press space it acts like a pager.

It's pretty neat because it allows you to review the output without getting in the way.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#125
post #108

Earlier quoted context omitted.

aliased as 'duck' to be work-friendly

Where do you work that anyone would care you use a command called « fuck »?

I afraid that I may say it out loud if I type `fuck` too many times.. ;0

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#126
post #108

Earlier quoted context omitted.

Where do you work that anyone would care you use a command called « fuck »?

Damn, imagine working at a place where at the end of each day, the management goes through your shell history and includes it in a "performance review".

Or you're giving a live demo in a terminal to the bosses and you mistype a command, then your fingers slip by habit...

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#128

I just make bash functions in my dotfiles for use cases like these, particularly good CLI arg combinations from Stack Overflow answers, etc. Example: # 2022-02-07 # because `poetry show --outdated` includes *all* packages (!), not just top-level dependencies function poetry-show-outdated { poetry show --outdated | grep --file= Or: function disk-usage-summary () { # output high-level disk usage stats set -x du --human…

That actually runs the commands right? How do you deal with commands that perform some action that maybe couldn't be reverted easily?

Correct.

If I don't necessarily want to run all of the commands, I make a "do-nothing script" [1][2] that just echoes them out instead.

I don't have a generalized example of undo / redo in bash commands, since I don't believe it's possible, but for example, if I'm running a destructive command, I prefer to run the dry run version first, then have a confirmation prompt [3] before running the destructive action.

[1]: https://news.ycombinator.com/item?id=20495739

[2]: https://news.ycombinator.com/item?id=29083367

[3]: https://stackoverflow.com/q/1885525/149428

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#129

Earlier quoted context omitted.

This is great. Is there an easy "open source terminal emulator" where I can run this after I typed enter but before it is executed? More like. is there a way the terminal can understand I typed a bad command and then give suggestions for changing it.

I would guess the shell is a more accessible place to accomplish something like this. For example: https://superuser.com/questions/175799/does-bash-have-a-hook...

Interesting. Thanks very much. I will try it out.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#130

Earlier quoted context omitted.

also info nobody knows enough from reading manuals for UN*X because it is too hard. everyone I talk to who says they have done it are still missing fundamental info, like for instance any one i talk to will probably not undersand that sudo is insecure for 99% of use cases and start crying when i explain to them that you can just use ptrace to capture the password or replace some bash envars to hijack the command. nob…

"you're not wrong, Walter..." but this isn't your blog I would agree that both C and Unix are highly disorganized/decentralized. There is no standard pattern to arguments passed to commands, for example; if this was standardized as much as possible, Unix would become much easier for noobs. And C? 40+ years later and we are still dealing with bad design decisions in it. But yeah, this isn't your blog. and also, how in…

UN*X is a shithole and just talking about one of the problems with it causes one to pull in the other problems that are inextricably intertwined with each other.
Post reply on HN