Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clap_generate PowerShell script does not complete case sensitive options like -S. Only completes -s #2145

Closed
2 tasks done
jfishe opened this issue Sep 27, 2020 · 0 comments · Fixed by #4992
Closed
2 tasks done
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-medium Call for participation: Experience needed to fix: Medium / intermediate 💸 $5

Comments

@jfishe
Copy link

jfishe commented Sep 27, 2020

Make sure you completed the following tasks

Code

https://github.com/clap-rs/clap/blob/3e9ee86713b5c407b50ba76f30cffaed25952063/clap_generate/src/generators/shells/powershell.rs

Steps to reproduce the issue

N/A

Version

name = "clap"
version = "2.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
dependencies = [
"bitflags",
"strsim",
"textwrap",
"unicode-width",
]

Actual Behavior Summary

https://github.com/BurntSushi/ripgrep generated _rg.ps1 does not complete -S correctly. It only completes -s.

Expected Behavior Summary

See BurntSushi/ripgrep#1690 for details.

. _rg.ps1

rg -s<Ctrl-Space> completes rg -s. It should produce:

rg -s
s   S

Search case sensitively (default).

A simple fix would be to change ListItemText for 'S' to 'S '. The space makes ListItemText unique, which is all that's needed.

Additional context

A simple fix may be to test for upper case and append a space. I don't know rust, so a PR is beyond me.

and
"'-{}', '{}', {}, '{}')",

For example, change the second '{}' to '{} ' in the format! below after adding a check for upper case. Sorry I can't be more helpful.

if let Some(short_aliases) = option.get_visible_short_aliases() {
                for data in short_aliases {
                    completions.push_str(&preamble);
                    completions.push_str(
                        format!(
                            "'-{}', '{} ', {}, '{}')",
                            data, data, "[CompletionResultType]::ParameterName", tooltip
                        )
                        .as_str(),
                    );
                }
            }
        }

Debug output

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-medium Call for participation: Experience needed to fix: Medium / intermediate 💸 $5
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants