fson ships tab-completion for fson-check for both Bash and Zsh.

File (in the source tree)Shell
tools/auto-complete/fson-check.bashBash
tools/auto-complete/_fson-checkZsh

It completes the option names (--json, --json5, --keep, --drop-disabled, --bare, -i, -o, -h) and falls back to filename completion for the input file and for -o's argument.

Installed

cmake --install (and every CPack archive, and the Conan package) puts them where the shells look by default:

  • Bash → <prefix>/share/bash-completion/completions/fson-check
  • Zsh → <prefix>/share/zsh/site-functions/_fson-check

On a standard install nothing more is needed — open a new shell.

From a checkout, without installing

# Bash — current shell
source tools/auto-complete/fson-check.bash
# Zsh — add the directory to fpath before compinit
fpath=("$PWD/tools/auto-complete" $fpath)
autoload -Uz compinit && compinit

Kept in sync with the tool

The completion scripts and fson-check's own USAGE string are kept in lockstep: whenever a flag is added, removed, or renamed in apps/fson-check/FsonCheck.cpp, both completion files are updated in the same change. If your completion offers a flag the binary rejects, your install is stale.