I'm .ok you're .ok: introducing folder profiles for bash and powershell
.ok file holds a bunch of handy one-liners, specific to the folder it is in. It can be viewed or executed with a simple command. It makes you smarter and more efficient.
I work on lots of little projects and each one has its own nuances and tricks. Context switching from one project to the next is hard on the brain. Some projects are brand new, some are ten years old. Some are in Windows, some are in Linux.
Every time I go to resume work on a project there is that moment of confusion as the brain tries to reload a dusty tape of facts from cold storage.
To make it easier to recall all pertinent facts, I've started putting a little file called ".ok" in each project. This file holds any relevant shell commands I use with that project. (I have a powershell version and a bash version)
For example here's the
.ok file from my "Today I Learned" project:
.\quick.ps1; .\deploy.ps1; # quick-build, prepare to deploy .\build.ps1 # complete build, after which you can see preview _book\index.html # see preview .\wordcount.ps1 # custom word count script
If I type the command "
ok" then I will see a listing of this file with a number against each line:
> ok 1. .\quick.ps1; .\deploy.ps1; # quick-build, prepare to deploy 2. .\build.ps1 # complete build, after which you can see preview 3. _book\index.html # see preview 4. .\wordcount.ps1 # custom word count script
And if I type "
ok 3" then it will run line number
3, like this:
> ok 3 > _book\index.html # view preview
(And in this case I'll see a HTML preview of the current state of the book)
To make "
ok" extra useful, I've setup my system so that every time I navigate into any folder (via
cd), the command "
ok" is run immediately. So if there is a "
.ok" file I'll immediately see the available commands. (I did this by removing the "
cd" alias, and making a custom "
cd" function that does a
set-location followed by a call to "
Source code is here:
Sometimes I write a thing and slowly stop using it. Other times I use it more and more, day after day, year after year, as happened with NimbleText. So far, "ok" seems to be one of those "use it more and more" solutions. So I think you would do well to give it a try.
Any issues, lemme know.Next → ← Previous
I'm currently writing a book about how to build your first product. If you want to build your first product, please sign up to be notified when the book is available.