THE GITHTML FIELD GUIDE
A CLI command reference template with arguments and exit outcomes
Document one CLI command as a contract: purpose, synopsis, arguments, options, input, output, side effects, and exit outcomes. Separate syntax notation from copyable examples. Verify the fields against the actual command version, especially defaults and failure behavior, so readers can use the reference without guessing which brackets or placeholder values they should type literally.
Define the command's boundary
Name the executable and subcommand, the supported version, and the working-directory assumptions. State whether the command reads files, writes output, contacts a service, or changes remote state. Keep a single command's reference separate from a tutorial that combines several commands into a workflow. Readers consulting a reference often already know their goal and need an exact answer about one flag. Include input from standard input or configuration files when relevant, because the visible argument list may not describe the whole contract. Do not imply that a harmless-looking name guarantees read-only behavior; verify the implementation or maintained help output.
Fill the reference using observed behavior
Use the scaffold below and replace unknowns only with verified information. For each option, record its type, allowed values, default, repetition behavior, and interactions with other options. Explain whether a positional argument is required and how multiple values are separated. Give one minimal successful example and one safe validation failure with the expected result. Keep command synopsis notation distinct from commands intended for copying; optional brackets and alternatives are descriptive syntax, not necessarily literal shell characters. State the shell when quoting or environment-variable syntax matters. Avoid examples containing real credentials, destructive targets, or unexplained production endpoints.
Command:
Purpose:
Version verified:
Synopsis:
Arguments:
Options and defaults:
Input sources:
Output and exit outcomes:
Side effects:
Minimal example:
Safe failure example:Validate exit and output promises
Run safe examples in a disposable test context and capture standard output, standard error, and exit status separately when the tool's contract distinguishes them. Do not assume every nonzero status means the same failure or that an empty output means success. Document machine-readable formats and stability promises only when the project actually supports them. Review the page whenever flags, defaults, or output schemas change. Link longer recipes rather than expanding the reference into an unstructured walkthrough. A useful command page lets a reader predict what will happen, recognize the result, and decide whether a failure requires different input or a different environment. If the command supports a dry-run mode, document what it actually suppresses and what it still does. Do not assume a flag named dry-run eliminates network access or every side effect.
- Record version, working directory, input sources, and side effects before listing flags.
- Verify defaults and option interactions rather than copying an old help transcript.
- Separate synopsis notation from complete copyable examples.
- Check output streams and exit outcomes with safe success and failure fixtures.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.