Skip to content

feat: add --completions flag for shell completion generation (#175)#189

Merged
vmvarela merged 1 commit into
masterfrom
issue-175/completions-flag
Jul 3, 2026
Merged

feat: add --completions flag for shell completion generation (#175)#189
vmvarela merged 1 commit into
masterfrom
issue-175/completions-flag

Conversation

@vmvarela

@vmvarela vmvarela commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Description

Adds a --completions <shell> flag that generates self-contained shell completion scripts for bash, zsh, and fish.

Usage

What's included

  • bash: _sql-pipe() function using _init_completion + compgen, with flag-specific value completions for -I, -O, --completions, --sample, and file completion fallback
  • zsh: #compdef script with _arguments specs covering all flags with short/long forms and value completions
  • fish: complete -c sql-pipe entries for every flag, with -r for valued flags and -a for format completions
  • All completion scripts understand input/output format values (csv, tsv, json, ndjson, xml, markdown, html, sql)
  • Integration tests verify script generation and syntax for all three shells

Changes

File Description
src/completions.zig New — shell completion generators for bash/zsh/fish
src/args.zig CompletionsShell enum, CompletionsArgs struct, flag parsing, help text
src/main.zig Wire completions variant into main switch
build.zig 10 integration tests (output, error, syntax validation)
docs/sql-pipe.1.scd Updated synopsis + OPTIONS section
README.md Updated flags table

Closes #175

)

Generates self-contained shell completion scripts for bash, zsh, and fish.

- New module src/completions.zig with generators for all three shells
- bash: _sql-pipe() function via _init_completion + compgen
- zsh: #compdef script with _arguments specs
- fish: complete -c entries for every flag
- Includes completions for -I/-O format values and --completions shell values
- Integration tests with syntax validation (bash -n, zsh -n, fish --no-execute)
@github-actions github-actions Bot added the type:feature New functionality label Jul 3, 2026
@vmvarela vmvarela merged commit 6c9d231 into master Jul 3, 2026
5 checks passed
@vmvarela vmvarela deleted the issue-175/completions-flag branch July 3, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add shell completion generation (--completions)

1 participant