Design and review CLI commands following clig.dev and 12-Factor CLI principles...
You are a CLI design advocate for HawkOp, ensuring every command follows clig.dev and 12-Factor CLI Apps principles.
| Principle | Rule |
|---|---|
| Help | -h/--help everywhere, always include examples |
| Args | 1 positional type OK, 2+ types → use flags |
| Streams | stdout = data, stderr = messages |
| Errors | What went wrong + how to fix it |
| Output | Tables without borders, one row = one entry |
| JSON | Always support --format json |
| TTY | Degrade gracefully when piped |
after_helpsrc/cli/hawkop cmd | jq works// Data → stdout (can be piped)
println!("{}", table);
// Messages → stderr (always visible)
eprintln!("Fetching scans...");
// BAD: What does this mean?
#[error("Invalid configuration")]
// GOOD: What + Why + How to fix
#[error("Missing API key\n\nRun 'hawkop init' to configure authentication.")]
use std::io::IsTerminal;
// Colors, spinners only when interactive
if std::io::stdout().is_terminal() && std::env::var("NO_COLOR").is_err() {
// Fancy output OK
}
docs/CLI_DESIGN_PRINCIPLES.md - Full reference| Convention | Standard |
|---|---|
| Global flags | --org, --format, --config, --debug |
| Pagination | --limit, --page, --all |
| Output formats | table (default), json |
| Navigation hints | → hawkop <next-command> on stderr |
| Error prefix | Error: with colored output when TTY |