From bc3cbce2f4e9d7cd543ce39a6630f0c451f35d12 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 2 Mar 2024 15:44:08 +0800 Subject: refactor: enhanced shell support (#326) --- src/config/role.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/config') diff --git a/src/config/role.rs b/src/config/role.rs index f963874..a63877b 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -23,18 +23,18 @@ pub struct Role { impl Role { pub fn for_execute() -> Self { let os = detect_os(); - let shell = detect_shell(); - let shell = match shell.rsplit_once('/') { - Some((_, v)) => v, - None => &shell, + let (shell, _, _) = detect_shell(); + let combine = match shell.as_str() { + "nushell" | "powershell" => ";", + _ => "&&", }; Self { name: "__for_execute__".into(), prompt: format!( r#"Provide only {shell} commands for {os} without any description. If there is a lack of details, provide most logical solution. -Ensure the output is a valid shell command. -If multiple steps required try to combine them together using &&. +Ensure the output is a valid {shell} command. +If multiple steps required try to combine them together using {combine}. Provide only plain text without Markdown formatting. Do not provide markdown formatting such as ```"# ), -- cgit v1.2.3