I tried that back in 2016 and scripts in a directory didn’t apply properly, or were lost, if I navigated to a sub directory of the project … if I recall correctly, it’s been 3 years … :D
I created https://github.com/jpoehls/pwdtasks which does something quite similar - every time you cd it looks for a .powershell/tasks.psm1 module in the current directory and loads it if found. My use case was project specific helper functions. Similar to a .env file.
It is PowerShell specific though and this .ok has some really cool aspects that I like. Particularly the menu of options.
I did a similar technique back in 2016. But I wanted my “folder profile” (I called it project.sh) to be able to have some comments for the functions listed so I used GREP and SED to tear out a comment line next to my bash function names when listing out project related functions. Want a “hidden” function in your project, just omit a comment for the function.
I have since moved on over the years … and this years flavor is LANDO and using Containers. the .lando file supports additional scripts/functions that can be added to a container … so all in all its a more unified solution to spinning up project infrastructure and custom tooling than a basic bash approach https://github.com/lando/lando
Why not direnv and add your scripts to the
PATH
or any similar solution?Interesting. I did not know that.
What I like about ok is that the .ok file is useful even without the tool.
I tried that back in 2016 and scripts in a directory didn’t apply properly, or were lost, if I navigated to a sub directory of the project … if I recall correctly, it’s been 3 years … :D
I’m using make for this, but this might actually be a simpler solution.
Author here, I choose this over make because:
I resolved 1 with a shell alias and 3 was not an issue for me because I already know Make good enough.
Point 2 is one of the reasons why I consider to write my own make-clone from time to time. :)
Same.
make
is preinstalled anywhere that matters. Just pop a Makefile somewhere, and Bob’s your uncle.I created https://github.com/jpoehls/pwdtasks which does something quite similar - every time you
cd
it looks for a.powershell/tasks.psm1
module in the current directory and loads it if found. My use case was project specific helper functions. Similar to a.env
file.It is PowerShell specific though and this .ok has some really cool aspects that I like. Particularly the menu of options.
I did a similar technique back in 2016. But I wanted my “folder profile” (I called it project.sh) to be able to have some comments for the functions listed so I used GREP and SED to tear out a comment line next to my bash function names when listing out project related functions. Want a “hidden” function in your project, just omit a comment for the function.
I also include a function to source relative files as I include other functions for the project lifecycle. An example top-level project.sh file is linked here https://gist.github.com/tenken/b1dcf1da05e8ed3a6a20f22e9ce35cc4
I have since moved on over the years … and this years flavor is LANDO and using Containers. the .lando file supports additional scripts/functions that can be added to a container … so all in all its a more unified solution to spinning up project infrastructure and custom tooling than a basic bash approach https://github.com/lando/lando