Native Builtins
argsh ships with optional Bash loadable builtins compiled from Rust. When the shared library is available, the core parsing commands run as native code inside the Bash process — zero fork overhead, zero subshell cost.
Overview
Bash supports loadable builtins via enable -f <path.so> <name>. argsh compiles its core functions (:args, :usage, type converters, introspection helpers) into a single .so that can be loaded at runtime. This replaces the pure-Bash implementations with native code while maintaining identical behavior.
The key benefits are:
- Performance: No subshell forks for type checking, field parsing, or help generation
- Transparent fallback: If the
.sois not found, everything works as before with the pure-Bash implementation - Identical behavior: The builtin output is byte-for-byte identical to the Bash implementation (validated by the test suite)
Usage
Native builtins are loaded automatically when argsh starts. If the .so is not found locally, argsh downloads it from the latest GitHub release. No flags needed — just use:
Management
Opt-out
To skip builtin loading entirely (pure-Bash mode):
To skip only the auto-download (local .so still loads if present):
Or control the search path via environment variable:
Debugging
Set ARGSH_DEBUG=1 to see detailed trace output for builtin loading and import resolution:
See Environment Variables for the full reference.
CLI Flags
| Flag | Description |
|---|---|
--no-builtin | Skip builtin loading and auto-download. |
-i, --import <lib> | Import additional libraries (repeatable). |
--version | Print argsh version and exit. |
--help, -h | Show usage information. |
Shebang lines (#!/usr/bin/env argsh) cannot pass additional flags on most systems due to kernel limitations. Use environment variables or argsh builtin install instead.