Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define base variables before running a extension #37

Open
3 tasks
TheRealSpaceShip opened this issue Mar 22, 2023 · 0 comments
Open
3 tasks

Define base variables before running a extension #37

TheRealSpaceShip opened this issue Mar 22, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@TheRealSpaceShip
Copy link
Contributor

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
@TheRealSpaceShip TheRealSpaceShip added the enhancement New feature or request label Mar 22, 2023
@TheRealSpaceShip TheRealSpaceShip changed the title Define base variables before running the extension Define base variables before running a extension Mar 22, 2023
@TheRealSpaceShip TheRealSpaceShip self-assigned this Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant