From 09cdb8dae4d2232d083bc66be71eaf199ddc7950 Mon Sep 17 00:00:00 2001 From: dennis-wey Date: Fri, 17 Jan 2025 13:27:31 +0100 Subject: [PATCH] feat: add nushell autocpmpletion for pixi r --- src/cli/completion.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/completion.rs b/src/cli/completion.rs index 11ce75668..a3aa4a6ce 100644 --- a/src/cli/completion.rs +++ b/src/cli/completion.rs @@ -155,7 +155,7 @@ fn replace_nushell_completion(script: &str) -> Cow { // 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#" @@ -167,7 +167,9 @@ fn replace_nushell_completion(script: &str) -> Cow { ^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))