Earlier in the evening, I was working on updating my dotfiles
. It's nothing fancy; just adding a quick alias for some housekeeping on my Brewfile
.
I had an eureka moment out of nowhere. At that moment, I realized this:
Tools should augment your creativity, not scream at your mistakes.
~ © 2020 Mrugesh Mohapatra.
Sounds ridiculous? Bear with me.
Have you ever been half asleep and still go about doing routine chores in your dev or regular life? I tend to do that all the time, so much so it is almost subconscious to me.
Here is the story.
I have aliased several common typos when I type in the command git
in my terminal. Here is a snippet of all the synonyms of git
in my lazy world:
# I can accidentally type 't' before 'i'
alias gti="git"
# I can accidentally type 'u' or 'o' which are neighbors to 'i'
alias got="git"
alias gut="git"
Of course, I am not the first person to do this. I am sure many of you use something similar, too. Right? Anyway, continuing with the story, I was half asleep (on a Wednesday night. Again!) and needed to update a file, so I did this:
dotfiles on ⎇ master [!]
❯ vi ~/.alias
I added some changes, managed to save and exit out of vi
. And continued in my exhausted life with:
dotfiles on ⎇ master [!] took 2s
❯ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: home/.alias
no changes added to commit (use "git add" and/or "git commit -a")
So far, so good. And all systems were normal, so my brain decided to get sleepier. I dozed off for a couple of seconds, and I typed this:
dotfiles on ⎇ master [!]
❯ got doff
WARNING: You called a Git command named 'doff', which does not exist.
Continuing in 0.1 seconds, assuming that you meant 'diff'.
──────────────────────────────────────────────
modified: home/.alias
──────────────────────────────────────────────
@ home/.alias:100 @ if $(type bat > /dev/null 2>&1) && $(type fd > /dev/null 2>&1) && $(type fzf > /
alias v='vi $(pbv)'
fi
#-----------------------------
# update brew packages
#-----------------------------
alias letupdatebrew="brew update ; brew upgrade ; brew cask upgrade ; brew cleanup ; brew doctor ; brew file push"
It's very subtle, but it glares at your face when you look at it again. Yeah, I typed got doff
instead of git diff
!!! It had worked regardless.
Two things had happened here:
My "genius" insight had worked. The alias had replaced the command I intended to run, i.e., 'git' and not 'got'.
Git, which is way more intelligent than you think, had guessed the correct task I intended to run, i.e., is 'diff' and not 'doff'.
**Isn't that cool? **
I did not realize my mistake because it freaking did what I wanted. It has shown me a diff. I couldn't care more, and I continued to drift into my subconscious. And here is what I typed:
dotfiles on ⎇ master [!]
❯ gti add .
Yes - I had managed to mistype a command in a new way. And the best part is, it worked without any fuss! And continued to drive under the influence, oblivious to what was happening with this next one:
dotfiles on ⎇ master [+]
❯ gut commit -m "feat(homebrew): alias to update and upgrade all"
[master 0507c0d] feat(homebrew): alias to update and upgrade all
1 file changed, 6 insertions(+)
dotfiles on ⎇ master [⇡]
❯
Can you believe that? I had used all of my typo aliases in a streak.
But then, of course, I woke up. I looked at the terminal. I was shocked and laughed out loud (quite literally).
As I was contemplating my life decisions, it dawned on me this is good. I know it sounds silly and normal, but the bigger picture is the tools that I had chosen to use had helped my ass and saved me some frustration when I was the most vulnerable—exhausted and weary—trying to save some work and be done for the day.
The lesson I learned was:
Tools should always augment you & your creativity. They should "ideally" not scream at you. A nudge about a mistake is acceptable. IMHO, any hack that you can do to make your life easy is great. It does not make you lazy, and it makes you smarter. It helps you avoid pitfalls and frustration.
I hope you liked this story. Until the next one (Hopefully on a sleepy Wednesday!).
Stay safe and stay home. We got this.