Skip to content

Automated shell completions generation#91

Open
WaywardWizard wants to merge 13 commits intoiffy:masterfrom
WaywardWizard:master
Open

Automated shell completions generation#91
WaywardWizard wants to merge 13 commits intoiffy:masterfrom
WaywardWizard:master

Conversation

@WaywardWizard
Copy link
Copy Markdown

@WaywardWizard WaywardWizard commented Jan 26, 2026

This PR introduces automated shell completions for the fish shell (its the only shell that has a declarative completion specification format)

It includes scaffolding/framework for including other shells

Ben Tomlin added 13 commits January 9, 2026 09:49
Move CLI types to src/argparse/types.nim and add:
- shellcompletion framework in src/argparse/shellcompletion/*.nim
- fish implementation at src/argparse/shellcompletion/fish.nim
- extend option signature in src/argparse.nim to accept completion generators
- update backend to use the new types and hook completion short-circuit
  behaviour
- add .gitignore entries for .zed and *.out and a test stub
Export types from several modules and add argparse/util.nim for shared helpers.
Rework shell completion generation: produce a single COMPLETION_DEFINITIONS
const from compile-time templates and provide a runtime lookup to replace
{prog}. Short-circuit behavior now parses the chosen shell string and writes
completions. Remove ShortCircuit.handler field. Fix fish completion long-flag
slicing and minor formatting/cleanup changes.
Correct the countdown call in hideCompletions to iterate components from last to
first. Make fish completion generation include argument components by removing
the kind filter. Add tests for hiding completions and for completion generators,
and tidy up test output checks.
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