pub fn translate_compound_command(
input: &str,
from_os: Os,
to_os: Os,
) -> Result<TranslationResult, TranslationError>Expand description
Translate a compound command containing operators like &&, ||, ;, or |
This function splits the input by operators, translates each command individually, and then joins them back together.
§Arguments
input- The compound command string to translatefrom_os- The source operating systemto_os- The target operating system
§Returns
Ok(TranslationResult)- The translated compound commandErr(TranslationError)- Error if any command translation fails
§Example
use cmdx::{translate_compound_command, Os};
let result = translate_compound_command("dir && cls", Os::Windows, Os::Linux);
assert!(result.is_ok());
let result = result.unwrap();
assert!(result.command.contains("ls"));
assert!(result.command.contains("clear"));