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

feat(clap_complete): Add powershell support for native completion #5564

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions clap_complete/tests/testsuite/powershell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,31 @@ fn subcommand_last() {
name,
);
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

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

If the tests can't be added in a prior commit, then they should be added in the commit with the feature.

#[cfg(unix)]
fn register_completion() {
Copy link
Member

Choose a reason for hiding this comment

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

Note that I said working tests is not a blocker for this.

common::register_example::<completest_pty::PowershellRuntimeBuilder>("static", "exhaustive");
}

#[test]
#[cfg(unix)]
fn complete() {
if !common::has_command("pwsh") {
return;
}

let term = completest::Term::new();
let mut runtime =
common::load_runtime::<completest_pty::PowershellRuntimeBuilder>("static", "exhaustive");

let input = "exhaustive \t";
let expected = snapbox::str![
r#"% exhaustive
action complete global help last quote value
alias generate h hint pacman V version "#
];
let actual = runtime.complete(input, &term).unwrap();
println!("shanmu actual: {:?}", actual);
snapbox::assert_eq(expected, actual);
}