Check CLI --help Before Reading Source Code

lesson tools active tools/check-cli---help-before-readin.md View on GitHub

Check CLI --help Before Reading Source Code

Rule

Before examining source code or making assumptions about a CLI tool's capabilities, run the command with --help to discover available options, subcommands, and flags that can simplify your approach.

Context

When encountering a new command-line tool or unfamiliar command, developers often jump directly to reading source code or making assumptions about functionality. This premature deep-dive wastes time and may miss built-in features that solve the problem more elegantly.

Detection

Pattern

  1. Run <command> --help first to see top-level options and subcommands
  2. For subcommands, run <command> <subcommand> --help to discover specific flags
  3. Look specifically for utility flags like --dry-run, --status, --format, --verbose
  4. Only dive into source code after understanding the documented interface

Example: Running uv run gptodo --help and uv run gptodo edit --help reveals subcommands and flags (--set, --add, --state) that obviate building a wrapper or sed-editing YAML frontmatter directly.

Outcome

Related

Match Keywords

doesn't have a flag for wrap the command to add before patching the wrapper