= zsh-autoenv
/via: [[https://github.com/Tarrasch/zsh-autoenv]]
== configuration
* AUTOENV_FILE_ENTER: Name of the file to look for when entering directories. Default: .autoenv.zsh
* AUTOENV_FILE_LEAVE: Name of the file to look for when leaving directories. Requires AUTOENV_HANDLE_LEAVE=1.Default: .autoenv_leave.zsh
* AUTOENV_LOOK_UPWARDS: Look for zsh-autoenv "enter" files in parent dirs?. Default: 1
* AUTOENV_HANDLE_LEAVE: Handle leave events when changing away from a subtree, where an "enter" event was handled? Default: 1
* AUTOENV_DISABLED: (Temporarily) disable zsh-autoenv. This gets looked at in the chpwd handler. Default: 0
* AUTOENV_DEBUG: Set debug level. If enabled (> 0) it will print information to stderr.
* 0: no debug messages
* 1: generic debug logging
* 2: more verbose messages messages about adding/removing files on the internal stack
* 3: everything
sets xtrace option (set -x) while sourcing env files. Default: 0
== usage
* ''autoenv-edit''
* $AUTOENV_EDITOR, $EDITOR, or vim for editing
== help
* **autostash**:
* sobreescribe una variable de entorno y la vuelve a dejar como estaba al salir
* **autoenv_source_parent**
* ejecuta los ficheros **.autoenv.zsh** de los directorios superiores
* opcionalmente podemos pasarle un parámetro ''../..'' para que solo ejecute ciertos niveles atrás ¿?
* **autoenv_append_path**: Appends path(s) to $path ($PATH), if they are not in there already.
* **autoenv_prepend_path**: Prepends path(s) to $path ($PATH), if they are not in there already.
* **autoenv_remove_path**: Removes path(s) from $path ($PATH).Returns 0 in case $path has changed, 1 otherwise.
== azure example
autostash ARM_ACCESS_KEY=
echo "auto environment enabled (infraestructure)"
autoenv_source_parent ../..
az account set --subscription "XXX -PRO - Subscription"
echo "auto environment enabled (pro)"
autoenv_source_parent ../..
autostash ENV_SUBS="XXX - AKS - Subscription"
autostash ENV_RG="XXX-RG-AKS"
autostash ENV_AKS="XXX"
az account set --subscription "$ENV_SUBS"
az aks get-credentials --resource-group ${ENV_RG} --name ${ENV_AKS} --admin
echo "auto environment enabled ($ENV_SUBS)"
echo "aks credentials (${ENV_RG} - ${ENV_AKS})"