Hyphens missing from listItemText in generated PowerShell autocomplete scripts #5606
Closed
2 tasks done
Labels
A-completion
Area: completion generator
C-bug
Category: Updating dependencies
E-easy
Call for participation: Experience needed to fix: Easy / not much
Please complete the following tasks
Rust Version
rustc 1.80.0 (051478957 2024-07-21)
Clap Version
4.5.11
Minimal reproducible code
Steps to reproduce the bug with the above code
or to source the script:
Actual Behaviour
The generated completion script is missing hyphens in the
CompletionResult::new
listItemText
parameter for all options. This is at best confusing, leading to options being listed without their hyphens when attempting to complete them, and at worst causes collisions making it impossible to complete a subcommand with the same name as an option without first typing a character. Completion scripts for other shells seem to include hyphens correctly.A snippet of the completion script generated by the reproduction code:
In the snippet above the missing hyphens cause option
--foo
and subcommandfoo
to collide. The option--foo
is displayed as "foo" when completing with no input other than the command, with the subcommandfoo
being uncompletable.foo
is correctly completed only when at least the first letter has been typed.Expected Behaviour
The generated completion script should have hyphens in both the
completionText
andlistItemText
parameters in theCompletionResult
constructor call:Additional Context
Lines 134 and 145 in
clap_complete/src/shells/powershell.rs
seem to be causing this.Debug Output
No response
The text was updated successfully, but these errors were encountered: