Restore Windows PowerShell parser API

This commit is contained in:
Charlie Marsh
2026-06-04 12:40:02 -04:00
parent c0fc3617c7
commit 908de632b3
2 changed files with 13 additions and 0 deletions
@@ -1,6 +1,9 @@
#[cfg(windows)]
mod powershell_parser;
#[cfg(windows)]
pub(crate) use powershell_parser::try_parse_powershell_ast_commands;
pub mod is_dangerous_command;
pub mod is_safe_command;
#[cfg(windows)]
+10
View File
@@ -2,6 +2,8 @@ use std::path::PathBuf;
use codex_utils_absolute_path::AbsolutePathBuf;
#[cfg(windows)]
use crate::command_safety::try_parse_powershell_ast_commands;
use crate::shell_detect::ShellType;
use crate::shell_detect::detect_shell_type;
@@ -69,6 +71,14 @@ pub fn extract_powershell_command(command: &[String]) -> Option<(&str, &str)> {
None
}
#[cfg(windows)]
pub fn parse_powershell_command_into_plain_commands(
command: &[String],
) -> Option<Vec<Vec<String>>> {
let (executable, script) = extract_powershell_command(command)?;
try_parse_powershell_ast_commands(executable, script)
}
/// This function attempts to find a powershell.exe executable on the system.
pub fn try_find_powershell_executable_blocking() -> Option<AbsolutePathBuf> {
try_find_powershellish_executable_in_path(&["powershell.exe"])