Shell completion

gnaw uses dynamic completion: the binary itself produces candidates at request time, so there's no script file to install or keep in sync. See the how-to for setup; this page is the quick reference.

Install hooks

Add the matching line to your shell startup file, then start a new shell.

ShellStartup fileLine
fish~/.config/fish/config.fishCOMPLETE=fish gnaw | source
zsh~/.zshrcsource <(COMPLETE=zsh gnaw)
bash~/.bashrcsource <(COMPLETE=bash gnaw)

The hook re-invokes gnaw per completion request, so it always matches the installed binary. Requirements: gnaw must be on PATH, completion fires for the bare command name gnaw, and you should re-source after upgrading.

What completes

ArgumentCandidates
All flagsflag names
--secret-scanoff, warn, redact, block
--compresslight, moderate, full
--output-format, -Fmarkdown, json, xml
--encodingcl100k, p50k, p50k_edit, r50k, o200k
--token-formatraw, format
--sortname_asc, name_desc, date_asc, date_desc
--diff-modestaged, unstaged, all
--git-diff-shas-contentpatch, after-patch, full, full-patch
-t, --templatebuilt-in template names (with descriptions) + file paths
--compress-striptests, fn-bodies, doc-comments, private-bodies and no- forms
path arg, -Onative file/path completion

Troubleshooting

SymptomCause
Tab does nothingHook not sourced in this shell, or gnaw not on PATH
Files complete instead of valuesNo completer registered for gnaw โ€” re-source the hook
Worked before an upgrade, now brokenProtocol changed between releases โ€” re-source in a fresh shell

In fish, complete -c gnaw lists the registered completer; an empty result means the hook didn't load.