diff --git a/src/vars.rs b/src/vars.rs index f84056b..24fb12d 100644 --- a/src/vars.rs +++ b/src/vars.rs @@ -18,6 +18,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::collections::HashMap; +use std::env; use crate::segment::{Ctr, Ast}; use crate::eval::eval; use crate::func::{Function, Operation, Args, FTable}; @@ -38,7 +39,6 @@ pub fn define( } } -// TODO: Accept bool config value for env vars pub fn get_export(env_cfg: bool) -> Function { return Function{ name: String::from("export"), @@ -57,12 +57,21 @@ pub fn get_export(env_cfg: bool) -> Function { Ctr::Seg(val) => { let val_tmp = val.borrow().clone(); define(b, identifier.to_string(), Rc::new(val_tmp.car)); + if env_cfg { + // set var in env + // gotta distill value + // env::set_var(identifier, VALUE) + } }, _ => { eprintln!("impossible args to export"); } } + }, + + Ctr::None => { + // UNSET VAR LOGIC } }, @@ -73,7 +82,6 @@ pub fn get_export(env_cfg: bool) -> Function { return Ctr::None; }, _ => { - println!("{:#?}", a); eprintln!("first argument to export must be a symbol"); return Ctr::None; }