What would it look like if your command line updated itself and was context aware?
Thinking this through, we have a couple requirements
When moving into a directory or its children, you should be in the context of that directory.
When leaving a directory, the command line shouldn’t leak directory specific behavior.
Given the mischief we are up to, we’ll call this Loki.
To pull this off, we are going to do a couple of things. First, we need to proxy Set-Location.
With this we can replace what happens every time we change directories, but we are going to keep is simple and just add a little hook. The code is abbreviated from Set-Location.Proxy.ps1:
Now in our profile, we need to add the Register-LokiFile functionality. A .loki* file will be the naming convention for custom code to load.
Now, as we move around in the command line, we can have custom functionality weave in and out with us.