Environment Variables
argsh uses environment variables for configuration. Most are set automatically or via .envrc (direnv).
User-Configurable Variables
ARGSH_SOURCE
Path to the entry-point script. Used by import to resolve relative paths. Automatically set by argsh::shebang() but can be overridden.
ARGSH_FIELD_WIDTH
Width (in characters) for the flag/command name column in help output. Defaults to 24.
ARGSH_BUILTIN_PATH
Explicit full path to argsh.so. When set, this path is tried first during builtin loading, bypassing the standard search order.
ARGSH_DEBUG
New in v0.6.1
Enable debug trace output. When set to 1, argsh prints diagnostic messages to stderr prefixed with argsh:debug:. Useful for troubleshooting import resolution and builtin loading.
Example output:
ARGSH_NO_AUTO_DOWNLOAD
New in v0.6.1
When set to 1, prevents argsh from automatically downloading argsh.so from GitHub releases. If a local .so is already installed, it will still be loaded.
This is different from --no-builtin, which skips ALL builtin loading (including locally installed ones).
PATH_BASE
Project root directory. Used by import @... to resolve project-relative imports. Typically set in .envrc.
PATH_BIN
Project binary directory. Used as a search path for argsh.so and as an install target for argsh builtin install.
PATH_SCRIPTS
Directory for project scripts. Used by import ^... to resolve script-relative imports.
PATH_LIB
Project library directory. Used as a search path for argsh.so.
Read-Only Variables
These are set by argsh at runtime and should not be modified.
ARGSH_VERSION
The current argsh version string, set during release builds.
ARGSH_COMMIT_SHA
The git commit SHA of the argsh build, set during release builds.
ARGSH_BUILTIN
Set to 1 when native builtins (.so) are successfully loaded, 0 otherwise. Used internally to gate pure-Bash fallback definitions.
Internal Variables
These are implementation details and should not be set manually.
__ARGSH_BUILTINS
Array of builtin command names that args.sh attempts to load from the .so. Used by argsh::builtin::try().
__ARGSH_LIB_DIR
Directory containing the argsh library files. Defaults to the directory of import.sh. Used as a fallback for resolving plain import names.
Testing Variables
MIN_COVERAGE
Minimum code coverage percentage required for CI to pass. Used by the coverage tooling.
BATS_LOAD
When set to a filename (e.g., argsh.min.sh), the test helper sources that file instead of the default .sh file matching the .bats filename. Used to run tests against the minified bundle.
ARGSH_BUILTIN_TEST
When set to 1, bats test files load the native .so builtins and run tests using the builtin implementations instead of pure-Bash.
.envrc Integration
argsh projects typically use direnv with an .envrc file to set project-specific variables:
The : "${VAR:=value}" pattern sets a default only if the variable is not already set — this is the standard argsh convention for .envrc files.
LSP Support
The argsh language server (LSP) also reads .envrc files to discover PATH_BASE and PATH_SCRIPTS for import resolution. This means IDE features like go-to-definition and diagnostics work correctly even without running direnv allow first. The LSP parses the following .envrc patterns:
: "${VAR:=value}"(argsh default pattern)export VAR=valueVAR=value(plain assignment)
Variable references (${PATH_BASE} and $PATH_BASE) are expanded using previously parsed values. Lines containing command substitution ($(...)) are skipped — use literal paths for LSP compatibility:
When PATH_BASE is set via command substitution (common in real .envrc files), the LSP falls back to auto-detecting the project root by looking for .git, .envrc, or .bin/argsh directories.