Shell Reference
This section documents how to use Claptrap in various shell environments. It provides examples and usage patterns for integrating Claptrap into your shell scripts.
Parse arguments from a specification file:
eval "$(claptrap --spec spec.toml -- "$@")"
Parse arguments from a specification provided inline:
eval "$(claptrap --spec - -- "$@" <<'SPEC' name = "spec" [args] arg = {}SPEC)"
Parse arguments from a specification file:
eval "$(claptrap --spec spec.toml -- "$@")"
Parse arguments from a specification provided inline:
eval "$(claptrap --spec - -- "$@" <<'SPEC' name = "spec" [args] arg = {}SPEC)"
Parse arguments from a specification file:
eval (claptrap --spec spec.toml --output-format fish -- $argv | string collect)
Parse arguments from a specification provided inline:
set -l spec ' name = "spec" [args] arg = {}'eval (printf "%s" "$spec" | claptrap --spec - --output-format fish -- $argv | string collect)
PowerShell
Section titled “PowerShell”Parse arguments from a specification file:
. ([scriptblock]::Create(( & claptrap --spec spec.toml --output-format powershell -- @args ) -join "`n"))
Parse arguments from a specification provided inline:
$spec = @' name = "spec" [args] arg = {}'@. ([scriptblock]::Create(( $spec | & $env:CLAPTRAP_BIN --spec - --output-format powershell -- @args ) -join "`n"))