Skip to content

Conversation

@boneskull
Copy link
Owner

Implement dynamic shell completion via two internal flags:

  • --completion-script : outputs a completion script to source
  • --get-bargs-completions <words...>: returns candidates

Enable with completion: true in bargs config. Supports:

  • Command and subcommand completion (including nested commands)
  • Option completion with aliases and --no- for booleans
  • Enum value completion for options and positionals
  • Global options accumulated across nested command levels

Closes #22

Copilot AI review requested due to automatic review settings February 1, 2026 03:26
@boneskull boneskull added the enhancement New feature or request label Feb 1, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.
@boneskull boneskull force-pushed the shell-completion-22 branch from 30d4e8c to 0b17487 Compare February 2, 2026 21:53
@boneskull boneskull requested a review from Copilot February 2, 2026 21:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@boneskull boneskull merged commit d651732 into main Feb 3, 2026
10 of 18 checks passed
@boneskull boneskull deleted the shell-completion-22 branch February 3, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Shell completion generation

2 participants