4 ms·
So, I love that the README is nearly as long as the code itself. Shorthand: PATH=$HOME/.bans:$PATH # (prefix path with "banned" cmd-dir) printf "echo
by ramses0 1y ago
So, I love that the README is nearly as long as the code itself.
Shorthand:
PATH=$HOME/.bans:$PATH # (prefix path with "banned" cmd-dir)
printf "echo 'bad!'" > "$HOME/bans/some-cmd" # (make `some-cmd` run `echo 'bad!'`)
...and then some goodies around tracking, reasons, etc... some niftiness around "auto-expiring" the banned command (self-deletes the "bad" shell script that's shadowing the actual command usage).
As to the sibling "why?" ... it's trivial to circumvent: `ban ls "I run it too much..."`, `/bin/ls` is still unaffected, `rm ~/.bans/ls`, etc... but I _do_ like the pause to allow a return to rationality, eg: "Hey, maybe I do run `ls` too much..." and then deciding how to proceed.
It'd probably be nicer if it did something like `(Bad) Chrome.app/*` on OSX, but as an exercise in shell gymnastics, I'm kindof all here for it! :-)
- samrus 1y ago> "Hey, maybe I do run `ls` too much..." This cant be a though someone has ever had. Your telling me people are getting addicted to the ls command?
- lupusreal 1y agoI'm addicted to sl. I love those trains.
- z_open 1y agoI am. Every time I cd I ls even though I know what's in there.
- deleted 1y ago[deleted]
- zamadatix 1y agoI think it's more an example of a "why did I just cd ls cd ls cd ls that directory tree instead of leveraging tab completion" type thing than "man, I gotta get over my ls addiction or I won't be able to provide for my family". I've found myself doing similar hints to nudge more efficient-but-less-exercised things into my day to day usage. E.g. making /etc/crontab a comment to get more used to creating systemd timers instead. Otherwise I'd just do it without thinking.
- zahlman 1y ago> why did I just cd ls cd ls cd ls that directory tree instead of leveraging tab completion Sometimes I find myself repeatedly ls'ing even though I'm making good use of tab completion. There's something about seeing the names that helps with remembering what I was going to do.
- hombre_fatal 1y agoThis is why I like GUIs. Seeing the files that are modified in my git gui reminds me of what Im doing instead of running git status. And seeing all the available things I could do is more stimulating than having to keep coming up with the text commands to type.
- johnisgood 1y agoFor that I use Git Cola[1], it is quite nice. [1] https://git-cola.github.io/ https://git-cola.github.io/
- zahlman 1y agoCome to think of it, I would probably benefit from rate-limiting myself on `git status`.
- zamadatix 1y agocd /etc/c<tab><tab>... can list the names similar to cd /etc/<enter>ls c*<enter>cd c... but there will always end up being times an actual ls is the right call, just not necessarily as ones default method.
- max-privatevoid 1y agoBad habits do happen. I forced myself out of `sudo su` and into `sudo -i` by configuring my sudo rule to allow any command except `su`.
- ofalkaed 1y agoThis popped up on HN last week: https://github.com/mieubrisse/cmdk https://github.com/mieubrisse/cmdk I don't really get it but apparently some people really have issues with ls and cd and feel they use them too much.