CLI reference¶
This reference covers every helm-env command implemented by the project.
Version arguments
Every <version> argument accepts exact versions, partials, aliases, tildes, carets, and comparator ranges — see Version strings for the full table.
Conventions:
- Commands return exit code
0on success. - On errors, commands typically print an error message to stderr and exit with code
1. - Every command accepts
-h/--help: it prints that command's help and exits0without doing anything else (for example,helm-env upgrade --helpnever upgrades). helm-env execexits with the exit code of the helm process it runs.
Global usage¶
Top-level help is available via helm-env help, helm-env --help, or helm-env -h. Per-command help is available via helm-env <command> --help.
Environment variables¶
HELMENV_ROOT¶
Required. Path where helm-env stores installed versions and shims.
Used by most commands and required for initialization.
HELMENV_VERSION¶
Optional. When set, it forces a particular helm version to be used (highest priority).
Typically set via helm-env shell after enabling shell integration with eval "$(helm-env init)".
HELMENV_AUTO_INSTALL¶
Optional. When set to a truthy value (1, true, yes, on, case-insensitive), helm-env will automatically install a missing helm version whenever the resolver (shim, exec, which, etc.) encounters a version/constraint that is not yet present under $HELMENV_ROOT/versions/.
The installation is silent (equivalent to helm-env install --silent <version>).
To override at the command line, see the --auto and --no-auto flags on helm-env exec, and --install on helm-env resolve.
HELMENV_CACHE_TTL¶
Optional. How long the cached release list ($HELMENV_ROOT/cache/releases.json) is considered fresh, as a Go duration (30m, 24h). 0s disables the cache. Default: 1h. See caching strategy.
SHELL¶
Optional. Read by helm-env completion to choose a shell when none is given.
Version strings¶
Every command that accepts a <version> argument (and every version slot
read by helm-env: HELMENV_VERSION, .helm-version, and
$HELMENV_ROOT/version) accepts the following forms:
| Form | Example | Meaning |
|---|---|---|
| Exact | 3.14.0 |
A specific release. |
| Partial | 3.14 |
Highest 3.14.x release (prereleases skipped). |
| Partial | 3 |
Highest 3.x.y release (prereleases skipped). |
| Alias | latest, latest-stable, stable |
Highest stable release in the candidate set. |
| Alias | latest-installed |
Highest installed version (prereleases allowed). |
| Tilde | ~3.14.0 |
>=3.14.0, <3.15.0. |
| Tilde | ~3.14 |
>=3.14.0, <3.15.0. |
| Caret | ^3.14.0 |
>=3.14.0, <4.0.0. |
| Range | >=3.12.0,<4.0.0 |
AND-combined comparators. |
| Comparator | >3.14.0, >=3.14.0, <4.0.0, <=3.14.0, =3.14.0 |
Single comparator. |
The candidate pool depends on the command:
installand thelatest*aliases resolve against the remote release list (cached in$HELMENV_ROOT/cache).uninstall,shell,local,global,exec,which, and the shim resolve against installed versions on disk.
Commands¶
help¶
Purpose: Print usage and the list of available commands.
Syntax:
Options/flags: none.
Environment variables: none.
Exit codes:
0always.
Example:
version¶
Purpose: Print the helm-env version.
Syntax:
Options/flags: none.
Environment variables: none.
Exit codes:
0on success.
Example:
init¶
Purpose:
- Create required directories under
HELMENV_ROOT. - Generate the
helmshim under$HELMENV_ROOT/shims/helm. - Print shell initialization code to stdout (intended to be evaluated by your shell).
Syntax:
Options/flags: none.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1ifHELMENV_ROOTis not set or filesystem operations fail.
Example:
list¶
Purpose: List installed helm versions (newest to oldest).
Syntax:
Options/flags: none.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1ifhelm-envis not initialized.
Example:
list-remote¶
Purpose: List all available helm versions from GitHub releases (newest to oldest).
This command does not require HELMENV_ROOT or initialization. If HELMENV_ROOT is set, results are persistently cached on disk (see caching strategy).
Syntax:
Options/flags:
--prerelease: include pre-release versions (alpha, beta, rc)-h,--help: show command help and exit
Environment variables: none.
Exit codes:
0on success, or when printing--help.1on GitHub/network errors (including rate limiting).
Example:
latest¶
Purpose: Print the latest available helm version from GitHub releases.
This command does not require HELMENV_ROOT or initialization. If HELMENV_ROOT is set, results are persistently cached on disk (see caching strategy).
Syntax:
Options/flags:
--prerelease: include pre-release versions when selecting the latest-h,--help: show command help and exit
Environment variables: none.
Exit codes:
0on success, or when printing--help.1if no versions are found, or on GitHub/network errors.
Example:
install¶
Purpose: Download and install an helm version into $HELMENV_ROOT/versions/<version>/helm.
If <version> is omitted, helm-env installs the latest stable version.
The command displays a progress bar during the download and automatically verifies the integrity of the downloaded file using SHA256 checksums published alongside the release.
Syntax:
Options/flags:
-s,--silent: do not display the progress bar or checksum verification information-h,--help: show command help and exit
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1if not initialized, platform detection fails, download fails, checksum mismatch, or filesystem writes fail.
Example:
uninstall¶
Purpose: Remove an installed helm version directory.
Syntax:
Options/flags:
-h,--help: show command help and exit.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1if<version>is missing, not initialized, the version is not installed, or filesystem removal fails.
Example:
shell¶
Purpose: Set or show the shell-level helm version.
Important: To set the version for your current shell session, you must have shell integration enabled via eval "$(helm-env init)". Otherwise, you will only see the printed export ... line but your current shell will not be updated.
Syntax:
Options/flags:
-h,--help: show command help and exit.
Environment variables:
HELMENV_ROOT(required)HELMENV_VERSION(read on show; written when you eval shell integration)
Exit codes:
0on success.1if not initialized, no shell version is configured (show), or the requested version is not installed (set).
Example:
local¶
Purpose: Set or show the local (directory-level) helm version.
Setting writes a .helm-version file into the current directory.
Syntax:
Options/flags:
-h,--help: show command help and exit.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1if not initialized, no local version is configured for this directory (show), the requested version is not installed (set), or writing.helm-versionfails.
Example:
global¶
Purpose: Set or show the global default helm version.
Setting writes $HELMENV_ROOT/version.
Syntax:
Options/flags:
-h,--help: show command help and exit.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success.1if not initialized, no global version is configured (show), the requested version is not installed (set), or writing fails.
Example:
which¶
Purpose: Print the full path to the active helm binary that would be used based on version resolution.
Syntax:
Options/flags:
--explain: additionally print a trace of the resolution process to stderr (which source — shell / local / global — won, which parent directories were searched for.helm-version, and the final concrete version + binary path).-h,--help: show command help and exit.
Environment variables:
HELMENV_ROOT(required)HELMENV_VERSION(optional; highest priority if set)
Exit codes:
0on success.1if not initialized or no version is configured.
Example:
resolve¶
Purpose: Resolve a version spec to a concrete helm version and print only that version on stdout.
Syntax:
- With no
<spec>, the active spec is used (shell > local > global). <spec>accepts every version string form: exact, partial, alias or range.- Installed versions are matched first. When nothing installed matches and
--install(orHELMENV_AUTO_INSTALL) is set, the best remote match is installed and printed. Progress notices go to stderr, so stdout is always just the version.
Options/flags:
--install: install the best remote match when nothing installed matches.-s,--silent: suppress auto-install notices on stderr.-h,--help: show command help and exit.--concrete: legacy no-op, still accepted because shims generated by older releases pass it. Output is always concrete.
Environment variables:
HELMENV_ROOT(required)HELMENV_VERSION(optional; used when no<spec>is given)HELMENV_AUTO_INSTALL(optional; same as--install)
Exit codes:
0when the spec resolves (or is installed with--install).1otherwise (not initialized, no version configured, nothing matches, or the install fails).
Example:
# .helm-version contains "~3.14"; the installed versions include 3.14.0 and 3.14.5
$ helm-env resolve
3.14.5
# explicit spec, ignoring the configured version
$ helm-env resolve 3.14.0
3.14.0
# install the newest 3.15.x if nothing installed matches
$ helm-env resolve --install --silent ~3.15
3.15.4
The shim calls helm-env resolve --concrete when the configured value is a constraint rather than an installed exact version.
upgrade¶
Purpose: Upgrade helm-env itself. It fetches the latest release of mmpyro/helm-env from the GitHub API, downloads the binary for the current OS/architecture, and replaces the running binary in-place.
Syntax:
Options/flags:
-h,--help: show command help and exit. This never triggers an upgrade.
Any other argument is rejected with exit code 1.
Environment variables: none. upgrade does not need HELMENV_ROOT and does not read any HELMENV_* variable. The binary path is auto-detected via os.Executable() (symlinks are followed).
Exit codes:
0on success, or when already up to date.1on network/download errors, permission issues, or filesystem errors.
Notes:
- The command detects the current OS and CPU architecture automatically.
- The new binary is written atomically (temp file + rename) to avoid corruption.
- If the current version is a development build (
dev), the upgrade always proceeds.
Example:
exec¶
Purpose: Run a specific version of helm for a single command without changing the active version (shell, local, or global).
Syntax:
<helm-args...> are passed to the resolved helm binary. One leading -- after <spec> is stripped, so helm-env exec 3.14 -- version runs helm version. Flags after <spec> belong to helm.
Options/flags:
--auto: enable auto-install for this invocation (installs the resolved version if it is not yet present on disk). OverridesHELMENV_AUTO_INSTALL.--no-auto: disable auto-install for this invocation even ifHELMENV_AUTO_INSTALLis set.-h,--help(before<spec>): show command help and exit.
Version resolution follows the general version strings rules: an exact installed version is used verbatim, otherwise the value is matched against the installed candidates (or, when auto-install is enabled, against the remote release list before installation).
Environment variables:
HELMENV_ROOT(required)HELMENV_VERSION(set for the subprocess to match the resolved version)HELMENV_AUTO_INSTALL(optional)
Exit codes:
- The exit code of
helm, passed through unchanged (for example,3if helm exits3). No extraexit status Nmessage is printed. 1if the version is not installed (and auto-install is disabled), no command is given, or initialization fails.
Example:
helm-env exec 3.14.0 version
helm-env exec ~3.14 -- version --short
HELMENV_AUTO_INSTALL=1 helm-env exec 3.14.0 version
helm-env exec --auto latest version
status¶
Purpose: Display a comprehensive overview of the current helm-env environment.
Output includes:
- HELMENV_ROOT path.
- Currently active version and the source it was resolved from.
- Full path to the active helm binary.
- List of all installed versions (active one marked with *).
Syntax:
Options/flags: none.
Environment variables:
HELMENV_ROOT(required)HELMENV_VERSION(read if set)
Exit codes:
0on success.1on error.
Example:
prune¶
Purpose: Remove installed helm versions that are no longer needed.
Syntax:
prune is a dry run by default. It prints what it would remove and deletes nothing until you pass --yes.
Options/flags:
--keep-last N: keep the N newest installed versions.--keep N: deprecated alias for--keep-last.--older-than DUR: remove installed versions whose helm binary mtime is older thanDUR. Accepts Go duration strings (e.g.30m,24h) plus a<N>dsuffix for whole days.--dry-run: print what would be removed without touching the disk (the default). Wins over--yesif both are given.--yes: actually remove the selected versions.-h,--help: show command help and exit.
At least one of --keep-last or --older-than is required. If both are supplied, a version must satisfy BOTH rules to be kept. The currently-resolved version (shell > local > global, so including a .helm-version in the current directory) is always protected: a warning is printed and the removal is skipped.
Unlike istioctl-env and vc-env, helm-env prune selects versions by count and age only; it does not scan the disk for version files.
Environment variables:
HELMENV_ROOT(required)
Exit codes:
0on success (including dry-run and no-op).1on bad flags or whenhelm-envis not initialized.
Example:
helm-env prune --keep-last 3 # preview
helm-env prune --keep-last 3 --yes # remove
helm-env prune --older-than 30d --yes
helm-env prune --keep-last 2 --older-than 90d
doctor¶
Purpose: Run a set of diagnostic checks against the current helm-env installation. Each check prints one line prefixed with [OK], [WARN], or [FAIL].
Syntax:
Options/flags:
--fix: before checking, create$HELMENV_ROOT/versionsif missing, regenerate the shim, and make installedhelmbinaries executable. Each repair prints a[FIX]line. It never editsPATHor shell rc files.-h,--help: show command help and exit.
helm-env doctor has no --deep flag (unlike istioctl-env): installed binaries are verified against SHA256 checksums at install time only.
Checks:
HELMENV_ROOTis set.$HELMENV_ROOTexists and is writable.$HELMENV_ROOT/versionsexists.$HELMENV_ROOT/shims/helmexists, is executable and matches what thishelm-envwould generate ([FAIL]on drift; fix with--fix).$HELMENV_ROOT/shimsis on$PATHand appears before any otherhelmbinary.- The cache file (if present) is parseable JSON.
- Reachability of
https://github.comandhttps://get.helm.sh(WARN on failure; never fatal). - At least one
helmversion is installed (WARN if none). - A resolvable active version exists (WARN if not).
Exit codes:
0when no check reports[FAIL].1when any check reports[FAIL].
Example:
completion¶
Purpose: Generate a shell completion script for helm-env.
Supported shells: bash, zsh, fish, powershell (pwsh is accepted as an alias).
The script completes subcommands and suggests installed versions for commands
that take a version (uninstall, shell, local, global, exec,
resolve), plus each command's flags. After completion it suggests the shell
names and --shell.
Syntax:
When SHELL is omitted, helm-env detects your current shell from the
$SHELL environment variable (falling back to bash). A short notice is
written to stderr so you still see which script was generated when the output
is piped to source. PowerShell is never auto-detected and must be requested
explicitly.
Options/flags:
- --shell SHELL: same as the positional SHELL
- -h, --help: show command help and exit
Environment variables:
- $SHELL (optional; read for shell auto-detection when no shell is given)
Exit codes:
- 0 on success.
- 1 if an unsupported shell is requested.
Deprecated alias: helm-env autocompletion still works with the same
arguments, but prints helm-env: 'autocompletion' is deprecated; use 'helm-env completion'
to stderr. It is hidden from help and completion lists and will be removed in a
future release.
Examples:
# bash — current session
source <(helm-env completion bash)
# bash — persistent
echo 'source <(helm-env completion bash)' >> ~/.bashrc
# zsh — current session (simplest)
eval "$(helm-env completion zsh)"
# zsh — persistent via fpath + compinit
mkdir -p ~/.zsh/completions
helm-env completion zsh > ~/.zsh/completions/_helm-env
# Then add to ~/.zshrc (before any `compinit` call):
# fpath=(~/.zsh/completions $fpath)
# autoload -Uz compinit && compinit