fabro/lib/crates/fabro-cli/tests/it/cmd/top_level.rs
Bryan Helmkamp a4159f7bb6
feat(cli): show curated landing output for bare fabro
Running `fabro` with no subcommand now prints a short, colorized guide
highlighting the most important commands (install, doctor, repo init,
validate, preflight, run, logs, server start, secret set/list, sandbox
ssh/preview/cp) instead of clap's full --help dump.

`fabro --help` and `fabro help` still render clap's comprehensive
reference unchanged. The CLI makes the root subcommand optional and
intercepts the None case in main_inner before telemetry or logging
init; the empty command name also suppresses the "CLI Executed"
tracking event for this pseudo-command.

Includes an inline-snapshot IT test covering the full landing body and
updates four pre-existing usage-line snapshots (<COMMAND> → [COMMAND])
that reflect the now-optional subcommand.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 08:59:03 -04:00

33 lines
751 B
Rust

use fabro_test::{fabro_snapshot, test_context};
#[test]
fn version() {
let context = test_context!();
let mut cmd = context.command();
cmd.arg("--version");
fabro_snapshot!(context.filters(), cmd, @"
success: true
exit_code: 0
----- stdout -----
fabro [VERSION] ([BUILD])
----- stderr -----
");
}
#[test]
fn no_dotenv_flag() {
let context = test_context!();
let mut cmd = context.command();
cmd.args(["--no-dotenv", "doctor"]);
fabro_snapshot!(context.filters(), cmd, @"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: unexpected argument '--no-dotenv' found
Usage: fabro [OPTIONS] [COMMAND]
For more information, try '--help'.
");
}