Skip to content

Add --completions flag to generate shell completion scripts - #1074

Open
jtrv wants to merge 1 commit into
Wilfred:masterfrom
jtrv:shell-completions
Open

jtrv wants to merge 1 commit into
Wilfred:masterfrom
jtrv:shell-completions

Conversation

@jtrv

@jtrv jtrv commented Oct 7, 2026

Copy link
Copy Markdown

This adds difft --completions <SHELL>, which prints a completion script for bash, elvish, fish, powershell or zsh to stdout using clap_complete:

difft --completions fish > ~/.config/fish/completions/difft.fish

It's implemented the same way as --list-languages: a new Mode variant returned early from parse_args and handled before any diffing. I went with a flag rather than a subcommand since difft takes positional paths and has no subcommands.

The main motivation is packaging: with a generator in the binary, distros and nixpkgs can ship completions at build time.

I didn't add a CHANGELOG entry since AGENTS.md says not to unless asked; happy to add one.

The code was drafted with Claude Code (Opus 5.5) and Codex (GPT 6 Astra), and I've reviewed it myself.

@jtrv
jtrv force-pushed the shell-completions branch from bd34b48 to 26fe22a Compare October 15, 2026 23:50
Drafted with Claude Code (Claude Sonnet) and Codex (GPT-6 Astra).
@jtrv
jtrv force-pushed the shell-completions branch from 26fe22a to 71ae4e2 Compare October 16, 2026 04:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant