Skip to content

Intentionally control when a space is appended for native completions #5587

@epage

Description

@epage

A trailing space signifies that there is nothing else to complete for this argument and the next argument should be started.

Cases where a space is appropriate

  • long flags
  • values

Cases where a space is not appropriate

  • options that allow =
  • short flags
  • delimiter-separated values

Open questions

  • When there is only one option left for a completion and there is "something more", like --opt completing for --option=value, instead of completing to --option should we offer every --option=value possible?
  • Can we do that for --option value as well?
  • Should we prefer --option=value or --option value? (requires_equals and num_args being more than 1 are times when there isn't a choice)
  • When the "something more" is optional (using num_args), should we offer with space and without?

Note: we might be able to defer some of these open questions as "parity with stable, static clap_complete" is the minimum bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionArea: completion generatorC-bugCategory: bugS-waiting-on-designStatus: Waiting on user-facing design to be resolved before implementing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions