Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/src/reference/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ Complete reference for the Firm command-line interface.

## Global options

These options apply to all commands:
These options apply to all commands.

Each global option can be set via a command-line flag, an environment variable, or left to its default. They are evaluated in the following order (highest priority first):

1. **Command-line flag** — always takes precedence
2. **Environment variable** — used when no flag is provided
3. **Default value** — used when neither flag nor environment variable is set

### --workspace (-w)

Expand All @@ -17,6 +23,8 @@ firm -w /absolute/path/to/workspace get person john_doe

Default: Current working directory

Environment variable: `FIRM_WORKSPACE`

### --cached (-c)

Use the cached entity graph instead of rebuilding:
Expand All @@ -28,6 +36,8 @@ firm -c query 'from task | where is_completed == false'

Default: false (graph is rebuilt before each command)

Environment variable: `FIRM_CACHED`

### --verbose (-v)

Enable verbose logging output:
Expand All @@ -37,6 +47,8 @@ firm --verbose build
firm -v list task
```

Environment variable: `FIRM_VERBOSE`

### --format (-f)

Specify output format:
Expand All @@ -50,6 +62,8 @@ Options:
- `pretty` (default) - Human-readable formatted output
- `json` - JSON output for programmatic use

Environment variable: `FIRM_FORMAT`

## Commands

### init
Expand Down
2 changes: 1 addition & 1 deletion firm_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ firm_mcp = { path = "../firm_mcp" }

tokio = { version = "1", features = ["rt-multi-thread"] }

clap = { version = "4.5.42", features = ["derive"] }
clap = { version = "4.5.42", features = ["derive", "env"] }
console = "0.16.0"
indicatif = "0.18.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions firm_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ use super::ui::OutputFormat;
#[command(version, about = "Firm CLI: Work management in the terminal.")]
pub struct FirmCli {
/// Path to firm workspace directory.
#[arg(short, long, global = true)]
#[arg(short, long, global = true, env = "FIRM_WORKSPACE")]
pub workspace: Option<PathBuf>,

/// Use cached firm graph?
#[arg(short, long, global = true)]
#[arg(short, long, global = true, env = "FIRM_CACHED")]
pub cached: bool,

/// Enable verbose output?
#[arg(short, long, global = true)]
#[arg(short, long, global = true, env = "FIRM_VERBOSE")]
pub verbose: bool,

/// Output format
#[arg(short, long, global = true, default_value_t = OutputFormat::default())]
#[arg(short, long, global = true, default_value_t = OutputFormat::default(), env = "FIRM_FORMAT")]
pub format: OutputFormat,

#[command(subcommand)]
Expand Down