Skip to content

Commit dbd6498

Browse files
committed
Add env and activate CLI commands
Signed-off-by: Nick Sweeting <git@sweeting.me>
1 parent 2fc99b2 commit dbd6498

3 files changed

Lines changed: 674 additions & 103 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ abxpkg install yt-dlp
109109
abxpkg update yt-dlp
110110
abxpkg uninstall yt-dlp
111111
abxpkg load yt-dlp
112+
abxpkg env yt-dlp
113+
abxpkg activate yt-dlp
112114
```
113115

114116
`abxpkg --version` and `abxpkg version` stream the package version first, then a host/env summary line, then one section per selected provider showing its current resolved runtime state (`INSTALLER_BINARY`, `PATH`, `ENV`, `install_root`, `bin_dir`, and any active cached dependency / installed binaries).
@@ -131,9 +133,17 @@ abxpkg --binproviders=pip,brew run pip show black # restrict provider resolution
131133
abxpkg --binproviders=pip --install run yt-dlp # load first, then install via selected providers if needed
132134
abxpkg --binproviders=pip --update run yt-dlp # ensure the binary is available, then update before exec
133135
abxpkg --binproviders=pip --no-cache --install run yt-dlp # bypass cached/current-state checks during resolution + install
136+
137+
abxpkg env yt-dlp # print dotenv-style KEY=value lines for yt-dlp's runtime env
138+
abxpkg --binproviders=pip env --install black # install if needed, then print the runtime env in .env format
139+
eval "$(abxpkg --binproviders=pip activate black)" # emit bash export lines and apply them to the current shell
140+
abxpkg activate --fish black | source # emit fish set -x lines and source them into fish
141+
eval "$(abxpkg --binproviders=pip activate --zsh black)" # emit zsh export lines
134142
```
135143

136-
abxpkg options (e.g. `--binproviders`, `--lib`, `--install`, `--update`, `--no-cache`) must appear before the `run` subcommand; every argument after the binary name is forwarded verbatim to the underlying binary. `run` exits with the child's exit code, passes its `stdout`/`stderr` through unbuffered, and routes any abxpkg install/load logs to `stderr` only — no headers, no footers, no parsing.
144+
`abxpkg env` resolves binaries the same way as `run`, then prints the runtime env as dotenv-style `KEY=value` lines. `abxpkg activate` emits a short usage comment plus shell-specific activation commands: bash by default, `--zsh` for zsh `export KEY=value`, and `--fish` for fish `set -x KEY VALUE`.
145+
146+
abxpkg options (e.g. `--binproviders`, `--lib`, `--install`, `--update`, `--no-cache`) must appear before the `run` subcommand; every argument after the binary name is forwarded verbatim to the underlying binary. The same install/update flags also apply to `env` / `activate`. `run` exits with the child's exit code, passes its `stdout`/`stderr` through unbuffered, and routes any abxpkg install/load logs to `stderr` only — no headers, no footers, no parsing.
137147

138148
#### `abx`: auto-install-and-run shortcut
139149

@@ -280,6 +290,8 @@ curl = Binary(
280290

281291
Pass `no_cache=True` to `load()` / `install()` / `update()` / `uninstall()` when you want to bypass cached/current-state checks. For `install()`, `no_cache=True` skips the initial `load()` check and forces a fresh install path. The equivalent CLI and env controls are `--no-cache` and `ABXPKG_NO_CACHE=1`.
282292

293+
Provider installer binaries also resolve lazily through the active provider chain. If a provider needs `pip`, `npm`, `cargo`, or another installer tool and it is missing, abxpkg will auto-install that dependency using the currently selected providers and the same `ABXPKG_LIB_DIR` / `--lib` / `--global` settings.
294+
283295
#### Advanced Usage
284296

285297
<details>

0 commit comments

Comments
 (0)