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: add nushell autocompletion for pixi r #2935

Merged
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions src/cli/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn replace_nushell_completion(script: &str) -> Cow<str> {
// NOTE THIS IS FORMATTED BY HAND
let bin_name = pixi_utils::executable_name();
let pattern = format!(
r#"(#.*\n export extern "{} run".*\n.*...task: string)([^\]]*--environment\(-e\): string)"#,
r#"(#.*\n export extern "{} run".*\n.*...task: string)([^\]]*--environment\(-e\): string)([^\]]*\n \])"#,
bin_name
);
let replacement = r#"
Expand All @@ -167,7 +167,9 @@ fn replace_nushell_completion(script: &str) -> Cow<str> {
^BIN_NAME info --json | from json | get environments_info | get name
}

${1}@"nu-complete BIN_NAME run"${2}@"nu-complete BIN_NAME run environment""#;
${1}@"nu-complete BIN_NAME run"${2}@"nu-complete BIN_NAME run environment"${3}

export alias "BIN_NAME r" = BIN_NAME run"#;

let re = Regex::new(pattern.as_str()).unwrap();
re.replace(script, replacement.replace("BIN_NAME", bin_name))
Expand Down
Loading