Markdown Editor

CLI Reference Template (Man Page Sections)

Command-line reference in man-page order: synopsis, POSIX option syntax, commands, shell completion, environment, files, exit status, JSON output, deprecations

Documentation & SupportStandardLinux man-pages(7) 6.19 section names; POSIX.1-2024 (IEEE Std 1003.1-2024) utility conventions; SemVer 2.0.0; Diátaxis referenceclireference

How to use: Use for any command-line tool. Generate the option tables, completion scripts and JSON output schema from the argument parser, then write exit codes, deprecations and examples. The main pitfall is drifting from the tool's --help output or changing exit codes and flags without a deprecation.

Preview

tool-name: Command Reference

Reference page for a command-line tool, organised in the classic manual page sections: NAME, SYNOPSIS, DESCRIPTION, OPTIONS, COMMANDS, ENVIRONMENT, FILES, EXIT STATUS, OUTPUT, EXAMPLES, DIAGNOSTICS, DEPRECATIONS, NOTES and SEE ALSO. Section names, and NAME, SYNOPSIS, DESCRIPTION first and SEE ALSO last, follow the Linux man-pages(7) conventions (man-pages 6.19, February 2026); COMMANDS, OUTPUT, DIAGNOSTICS and DEPRECATIONS are additions common in modern CLI tools, and the middle sections are grouped for CLI readers rather than in the exact man-pages(7) order (which puts EXIT STATUS before ENVIRONMENT and EXAMPLES after NOTES); argument syntax follows the Utility Conventions of POSIX.1-2024 (IEEE Std 1003.1-2024, The Open Group Base Specifications Issue 8, chapter 12); the page is a reference in the sense of the Diátaxis framework. Worked examples use skyrsync, a fictional file synchronisation tool by the fictional Larkfield Data. Replace every [bracketed] value and every row marked Example.

Document control

FieldValue
Document ID[DOC-CLI-001]
Tool[tool-name] (Example: skyrsync)
Version documented[2.3.0]
Manual section1 (user commands)
Status[Draft / In review / Published / Superseded]
Owner[@cli-maintainer]
Approvers / reviewers[@tech-writer], [@product-owner]
Last updatedYYYY-MM-DD
Classification[Public]
Generated from[Example: argument parser definitions in cmd/, via skyrsync docs --format md]
RelatedConfiguration Reference (docs/configuration-reference), Migration Guide (docs/migration-guide), Deprecation Notice (docs/deprecation-notice), Changelog (dev/changelog)

Approvals

RoleNameDecisionDate
CLI maintainer[@name][Approved / Changes requested]YYYY-MM-DD
Technical writer[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft
1.0YYYY-MM-DD[@name]Example: Published for skyrsync 2.3.0; option tables generated from the parser
1.1YYYY-MM-DD[@name]Example: Added --format ndjson and the deprecation of --del

NAME

[tool-name] - [synchronise local folders with a remote object store]

Example: skyrsync - synchronise local folders with a remote object store

SYNOPSIS

tool-name [global-options] <command> [command-options] [--] [operand...]
tool-name --version
tool-name --help [command]
tool-name completion bash|zsh|fish|powershell

Notation: [ ] optional, < > a value you supply, ... may repeat, | choose one. This follows the Utility Argument Syntax of POSIX.1-2024 (section 12.1); angle brackets for placeholders are a common convention on top of it.

DESCRIPTION

[tool-name] compares a local directory with a remote bucket and transfers the files that differ. Comparison uses file size and SHA-256 checksum; modification times are ignored unless --use-mtime is given. Transfers run in parallel and are resumable: an interrupted run continues from the last completed file when started again.

The tool never deletes remote files unless --delete is given. All network traffic uses HTTPS. Results are written to standard output; progress, warnings and errors are written to standard error, so piping the output never mixes in diagnostics. Output is human-readable by default and machine-readable with --output json (see OUTPUT).

OPTIONS

ShortLongArgumentDefaultEnvironmentDescription
-c--config<path>$XDG_CONFIG_HOME/tool-name/config.tomlTOOLNAME_CONFIGRead settings from this file
--dry-runnoneoffnoneShow what would change without changing anything
-h--help[command]nonenonePrint help for the tool or a command and exit with status 0
-j--jobs<n>number of CPUs, maximum 16TOOLNAME_JOBSNumber of parallel transfers (1 to 64)
--no-colornonecolour when stdout is a terminalNO_COLORDisable coloured output
--no-inputnoneoffTOOLNAME_NO_INPUTNever prompt; fail with status 2 if input would be needed (use in CI)
-o--outputtext, json or ndjsontextnoneOutput format (see OUTPUT)
-p--profile<name>defaultTOOLNAME_PROFILEUse the named credentials profile
-q--quietnoneoffnonePrint errors only
-v--verbosenoneoffnonePrint each file decision; repeat (-vv) for HTTP details
-V--versionnonenonenonePrint version and exit with status 0

Parsing rules, following the POSIX.1-2024 Utility Syntax Guidelines (section 12.2):

  • Short options without arguments may be grouped: -qv equals -q -v (Guideline 5).
  • An option and its argument are separate words (-j 8); the joined form -j8 and the GNU-style --jobs=8 are also accepted (Guideline 6 and its permitted forms).
  • -- ends option parsing; every later argument is an operand even if it starts with - (Guideline 10). Use it for paths such as -- -draft.txt.
  • A lone - as a source or destination means standard input or standard output (Guideline 13).
  • Options may appear before or after the command. Long options (--name) are a GNU convention, not part of the POSIX guidelines; list both forms so readers on either tradition find them.

COMMANDS

CommandSummarySince
syncMake the destination match the source1.0
lsList remote objects1.0
diffShow differences without transferring1.2
loginStore credentials for a profile1.0
configRead or write configuration values2.0
completionPrint a shell completion script2.1

sync

tool-name sync [options] [--] <source> <destination>

Copies new and changed files from source to destination. Either side may be a local path, - for a tar stream on standard input or output, or a remote URL of the form remote://bucket/prefix.

ShortLongArgumentDefaultDescription
--deletenoneoffDelete destination files that do not exist in the source
-x--exclude<glob>noneSkip matching paths; may repeat; later patterns win
--max-bandwidth<rate>unlimitedLimit throughput, for example 20MB/s
--use-mtimenoneoffTreat a newer modification time as a change
--delnoneoffDeprecated alias of --delete (see DEPRECATIONS)

ls

tool-name ls [--recursive] [--long] <remote-url>

Lists objects under a prefix. --long adds size, checksum and last-modified time.

diff

tool-name diff <source> <destination>

Prints one line per difference: + only in source, - only in destination, ~ content differs. Exit status is 0 when there are no differences and 4 when differences exist, so scripts can test the result without parsing output.

login

tool-name login [--profile <name>] [--device-code]

Opens a browser for single sign-on and stores a refresh token in the operating system keychain. --device-code prints a code to enter on another device, for machines without a browser.

config

tool-name config get <key>
tool-name config set <key> <value>
tool-name config list [--origin]

Reads or writes a value in the configuration file. --origin shows where each effective value came from. Every key is documented in the Configuration Reference (docs/configuration-reference).

completion

tool-name completion bash|zsh|fish|powershell

Prints a completion script for the named shell to standard output. The script completes commands, options, profile names and remote prefixes. Install it once:

ShellInstall command
bashtool-name completion bash > ~/.local/share/bash-completion/completions/tool-name
zshtool-name completion zsh > "${fpath[1]}/_tool-name"
fishtool-name completion fish > ~/.config/fish/completions/tool-name.fish
PowerShelltool-name completion powershell | Out-String | Invoke-Expression (add to your profile)

Completion scripts are generated from the same parser as this page, so they change when options change. Regenerate them after each upgrade.

ENVIRONMENT

VariableEquivalent optionDescription
TOOLNAME_CONFIG--configPath to the configuration file
TOOLNAME_JOBS--jobsDefault parallelism
TOOLNAME_NO_INPUT--no-inputAny non-empty value disables prompts
TOOLNAME_PROFILE--profileDefault credentials profile
TOOLNAME_TOKENnoneAccess token; overrides stored credentials (use in CI; never logged)
NO_COLOR--no-colorWhen present and not empty, disables colour (no-color.org convention)
XDG_CONFIG_HOME, XDG_CACHE_HOMEnoneBase directories for FILES on Linux and BSD (XDG Base Directory Specification 0.8)
HTTPS_PROXYnoneProxy for all network traffic

Precedence, highest first: command-line option, environment variable, configuration file, built-in default.

FILES

PathPurpose
$XDG_CONFIG_HOME/tool-name/config.toml (default ~/.config/...)User configuration. macOS: ~/Library/Application Support/tool-name/config.toml; Windows: %APPDATA%\tool-name\config.toml
/etc/xdg/tool-name/config.tomlSystem-wide defaults, read before the user file
$XDG_CACHE_HOME/tool-name/state.db (default ~/.cache/...)Resume state for interrupted transfers; safe to delete
.toolnameignorePer-directory exclude patterns, one glob per line

EXIT STATUS

CodeMeaning
0Success; destination matches source
1General error
2Invalid usage: unknown option, missing argument, or input needed with --no-input
3Authentication failed or credentials expired
4Partial result: some files failed to transfer, or diff found differences
5Network unreachable after retries
130Interrupted by the user (Ctrl+C); set by the shell convention 128 + signal number (SIGINT is 2)

Codes 126 (found but not executable) and 127 (not found) come from the shell, not from the tool, per POSIX.1-2024 XCU section 2.8.2. A status above 128 means the process ended on a signal; the exact value is shell-dependent.

OUTPUT

--output json prints one JSON document when the command finishes; --output ndjson prints one JSON object per line as events happen. Both are stable: fields are only added in minor releases, never renamed or removed outside a major release. The JSON Schema (draft 2020-12) is published at [https://example.com/skyrsync/schema/sync-result.json].

{
  "schema": "skyrsync.sync-result/1",
  "command": "sync",
  "source": "./site",
  "destination": "remote://www-assets/site",
  "summary": {"uploaded": 12, "deleted": 0, "skipped": 344, "failed": 1, "bytes": 1048576},
  "failures": [{"path": "img/hero.png", "code": "permission_denied"}],
  "exit_status": 4
}

EXAMPLES

Upload a folder and show what changed:

tool-name sync -v ./site remote://www-assets/site

Preview a mirror that deletes stale remote files, without changing anything:

tool-name sync --delete --dry-run ./site remote://www-assets/site

Download only images, limited to 20 MB/s:

tool-name sync -x '*' -x '!*.png' -x '!*.jpg' --max-bandwidth 20MB/s remote://media/2026 ./media

Use in CI with a token and JSON output, then count failures with jq:

TOOLNAME_TOKEN="$DEPLOY_TOKEN" tool-name sync --no-input -o json ./dist remote://prod-web/ > sync-report.json
jq '.summary.failed' sync-report.json

Sync a file whose name starts with a dash:

tool-name sync -- -draft.txt remote://notes/

DIAGNOSTICS

MessageCauseRemedy
error: credentials expired for profile 'default'Refresh token older than 30 daysRun tool-name login; exit status is 3
warning: 3 files skipped (permission denied)Local files not readableCheck file permissions; exit status is 4
error: unknown option '--dle'Typo in an option nameUse the full option name; exit status is 2
warning: --del is deprecated, use --deleteDeprecated alias usedReplace the option before 3.0

DEPRECATIONS

IDItemReplacementDeprecated inRemoval plannedBehaviour now
CLI-DEP-001 (Example)--del option--delete2.23.0Works, prints a warning on stderr
CLI-DEP-002 (Example)TOOLNAME_THREADS variableTOOLNAME_JOBS2.03.0Read if TOOLNAME_JOBS is unset, with a warning
[CLI-DEP-nnn][item][replacement][x.y][x.0][behaviour]

Deprecation warnings go to standard error only, never into JSON output, and are silenced by --quiet. The Migration Guide (docs/migration-guide) lists the steps for each removal.

NOTES

  • Credentials are stored in the operating system keychain, never in the configuration file. TOOLNAME_TOKEN is not written to disk and is masked in -vv output.
  • Paths are compared case-sensitively, including on macOS and Windows; two local files that differ only in case cause exit status 4.
  • Symbolic links are followed for files and skipped for directories.
  • Report bugs at [https://example.com/skyrsync/issues] with the output of tool-name --version and the failing command run with -vv.

SEE ALSO

rsync(1), [tool-name]-config(5), Configuration Reference (docs/configuration-reference), [Getting started tutorial] (docs/quickstart), [How to deploy a static site with tool-name] (docs/how-to), Changelog (dev/changelog), Versioning and Release Policy (dev/versioning-release-policy).

References

SourceVersion checkedUsed for
POSIX.1-2024, IEEE Std 1003.1-2024 (The Open Group Base Specifications Issue 8), XBD chapter 12 Utility Conventions and XCU section 2.8.2 Exit Status for Commands, https://pubs.opengroup.org/onlinepubs/9799919799/Checked 2026-10-29Synopsis notation, syntax guidelines, shell exit statuses
Linux man-pages, man-pages(7), https://man7.org/linux/man-pages/man7/man-pages.7.htmlRelease 6.19 (2026-02-08), checked 2026-10-29Section names and core order
Semantic Versioning 2.0.0, https://semver.org/2.0.0, checked 2026-10-29Deprecation and breaking change rules
XDG Base Directory Specification, https://specifications.freedesktop.org/basedir/latest/0.8 (2021-05-08), checked 2026-10-29File locations
NO_COLOR, https://no-color.org/Checked 2026-10-29Colour opt-out variable
JSON Schema, https://json-schema.org/specification2020-12, checked 2026-10-29Output schema
Diátaxis, Daniele Procida, https://diataxis.fr/reference/Checked 2026-10-29Reference form

Standard and licence note

Based on the conventional section layout of Unix manual pages as described in Linux man-pages(7), the Utility Conventions of POSIX.1-2024 (IEEE Std 1003.1-2024; Copyright The IEEE and The Open Group, freely readable online at pubs.opengroup.org; only section numbers are cited and the guidelines are paraphrased), Semantic Versioning 2.0.0, the XDG Base Directory Specification and the NO_COLOR convention. The reference form follows the Diátaxis framework by Daniele Procida (CC BY-SA 4.0); only its concepts are used and no Diátaxis text is adapted. The text of this template is original. Check the current official versions before relying on this page. Template licence: MIT.

Related templates