Composable Workflows
Brev CLI commands are designed to compose together using standard Unix pipes. Commands read instance names from stdin and output instance names to stdout.
Pipe Architecture
Sources produce instance names (one per line). Actions read names from stdin, perform operations, and output names to stdout for further chaining.
Output Modes
Commands automatically detect whether their output is going to a terminal or a pipe:
Piping from brev ls
Use awk and grep to extract instance names from brev ls output:
Filtering with grep
Create-to-Access Chains
Chain brev search, brev create, and access commands into single pipelines:
Batch Operations
Several commands accept multiple instance names as arguments:
The --all Flag
brev stop supports --all to stop every running instance:
Exit Codes for Batch Operations
When operating on multiple instances, commands return exit code 2 if some (but not all) operations fail. This lets you distinguish between full success, partial failure, and total failure in scripts.
Safety: Preview Before Destructive Operations
Always preview what a pipeline will affect before running destructive operations:
Pipe the output without the final destructive command first to verify the instance list. Then add | brev stop or | brev delete when you’re satisfied.
JSON Processing with jq
Use --json output with jq for advanced filtering and data extraction: