Almost each hubctl extensions define the same base environment variables.
HUB_HOME="${HUB_HOME:-$(dirname "$0")}"
HUB_WORKDIR="${HUB_WORKDIR:-$(pwd)}"
HUB_EXTENSION="$(basename "$0" | sed 's/-/ /g')"
Where:
HUB_HOME is a path to the root directory of hubctl extensions
HUB_WORKDIR is a path where hubctl is running
HUB_EXTENSION is the user-friendly name of the hubctl extension
And adds them to PATH: PATH="$HUB_HOME:$HUB_HOME/bin:$HUB_WORKDIR:$HUB_WORKDIR/bin:$PATH"
Such an approach leads to inconsistency in the development of new extensions where the exact definition is added by copy/paste or even skipped.
We could improve this situation by adding these variables before running the extension.
Almost each hubctl extensions define the same base environment variables.
Where:
HUB_HOMEis a path to the root directory of hubctl extensionsHUB_WORKDIRis a path where hubctl is runningHUB_EXTENSIONis the user-friendly name of the hubctl extensionAnd adds them to
PATH:PATH="$HUB_HOME:$HUB_HOME/bin:$HUB_WORKDIR:$HUB_WORKDIR/bin:$PATH"Such an approach leads to inconsistency in the development of new extensions where the exact definition is added by copy/paste or even skipped.
We could improve this situation by adding these variables before running the extension.