Skip to content

Improve completions generator#711

Merged
DannyBen merged 5 commits into
masterfrom
refactor/completions
Jul 1, 2026
Merged

Improve completions generator#711
DannyBen merged 5 commits into
masterfrom
refactor/completions

Conversation

@DannyBen

@DannyBen DannyBen commented Jul 1, 2026

Copy link
Copy Markdown
Member

This PR updates Bashly's completions generator to emit Completely's new pattern configuration format instead of the older flat completion map.

The lower-level pattern matching and mixed-source behavior is implemented in Completely. See:

Bashly Changes

  • Added Bashly::CompletionBuilder to build Completely pattern config from the Bashly command tree.
  • Kept the existing public completion APIs:
    • completion_data
    • completion_script
    • completion_function
  • Updated command completion data to use:
    • patterns
    • option groups
    • named token sources
  • Converted Bashly completion source syntax to Completely's explicit pattern source syntax:
    • <file> -> +file
    • <directory> -> +directory
    • <user> -> +user
    • static values stay static
    • static values beginning with + are escaped as ++value
  • Preserved command-level completions as the fallback source for positional args without their own allowed or completions.
  • Preserved allowed values as static token candidates.
  • Added support in the generated pattern config for:
    • command aliases
    • global flags cascading to descendants
    • repeatable flags
    • repeatable positional args
    • positional args with no completion source
    • deterministic token names when different sources share the same arg/flag name.

Tests

  • Updated completions approvals for the new pattern-config output.
  • Added direct fixture-driven coverage for Bashly::CompletionBuilder.
  • Kept the existing command-level completion specs as integration coverage for Command#completion_data, completion_script, and completion_function.
  • Added small missing coverage for Settings.argfile_var.

@DannyBen DannyBen merged commit dd0ba6a into master Jul 1, 2026
9 of 13 checks passed
@DannyBen DannyBen deleted the refactor/completions branch July 1, 2026 09:52
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