Skip to content

Define base variables before running a extension #37

@TheRealSpaceShip

Description

@TheRealSpaceShip

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.

  • Add base variables before running the extension
  • Review and cleanup variables in existing extensions
  • Document these variables

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions