epam / epam/hubctl

Define base variables before running a extension

Open
#37 0 comments 0 reactions 1 assignee Claimed by @TheRealSpaceShip View on GitHub
enhancement
Dominant language
Go
Stars
11
Forks
3
Avg merge
7d 47m
Merged PRs (30d)
1

Description

Almost each hubctl extensions define the same base environment variables.

```bash
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.