Building a CLI
Vow CLIs are ordinary native binaries. Grant only the env keys (or paths) the tool should see.
Example: length of $HOME
Section titled “Example: length of $HOME”From tests/lang/cli_util.vow:
fn main(caps: Caps) -> int { return match caps.env { Some(cap) => match env_get(cap, "HOME") { Ok(s) => len(s), Err(_) => 0 - 1 }, None => 0 - 1 };}vow build tests/lang/cli_util.vow -o cli_util./cli_util --grant env:HOMEecho $? # length of HOME, or an error code pathWithout --grant env:HOME, caps.env is None and the program cannot call env_get.
- Exit codes are how many examples communicate results — keep them intentional.
- Prefer
vow check/vow check --jsonin CI beforevow build. printis fine for developer output; it does not require a grant (ambient by design).- Scaffold with
vpm initwhen you wantproject.toml+ deps.
- Standard library —
env_getand friends - Capabilities