use crate::shell::types::EnvChange;
use crate::shell::types::ExecuteResult;
use super::ShellCommand;
use super::ShellCommandContext;
pub struct ExportCommand;
#[async_trait::async_trait]
impl ShellCommand for ExportCommand {
async fn execute(&self, context: ShellCommandContext) -> ExecuteResult {
let mut changes = Vec::new();
for arg in context.args {
if let Some(arg) = arg.to_str() {
if let Some(equals_index) = arg.find('=') {
let arg_name = &arg[..equals_index];
let arg_value = &arg[equals_index + 1..];
changes.push(EnvChange::SetEnvVar(arg_name.into(), arg_value.into()));
}
}
}
ExecuteResult::Continue(0, changes, Vec::new())
}
}