feat: add shell completion generation for bash, zsh, and fish#32
Merged
feat: add shell completion generation for bash, zsh, and fish#32
Conversation
Implement dynamic shell completion via two internal flags: - --completion-script <shell>: outputs a completion script to source - --get-bargs-completions <shell> <words...>: returns candidates Enable with `completion: true` in bargs config. Supports: - Command and subcommand completion (including nested commands) - Option completion with aliases and --no-<name> for booleans - Enum value completion for options and positionals - Global options accumulated across nested command levels Closes #22
Calculate max flag width across all options before formatting, ensuring descriptions start at the same column regardless of individual flag lengths.
30d4e8c to
0b17487
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
examples/completion.ts:1
- Corrected formatting of bash installation instructions. The command should be on a single line with proper shell syntax.
#!/usr/bin/env npx tsx
examples/completion.ts:1
- Corrected formatting of zsh installation instructions. The command should be on a single line with proper shell syntax.
#!/usr/bin/env npx tsx
examples/completion.ts:1
- Corrected formatting and capitalization of fish installation instructions. Command should be on a single line and 'npx' should be lowercase.
#!/usr/bin/env npx tsx
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement dynamic shell completion via two internal flags:
Enable with
completion: truein bargs config. Supports:Closes #22