Early implementation of scripting elements

This commit is contained in:
2025-03-05 01:36:58 -05:00
parent cd216ef1cc
commit 83c9c08106
28 changed files with 1384 additions and 371 deletions

View File

@@ -1,9 +1,10 @@
pub mod expand_vars;
pub mod vars;
pub mod tilde;
pub mod alias;
pub mod cmdsub;
use alias::expand_aliases;
use expand_vars::{expand_dquote, expand_var};
use vars::{expand_dquote, expand_var};
use tilde::expand_tilde;
use crate::prelude::*;
@@ -11,7 +12,7 @@ use crate::prelude::*;
pub fn expand_argv(argv: Vec<Token>, shenv: &mut ShEnv) -> Vec<Token> {
let mut processed = vec![];
for arg in argv {
log!(DEBUG, arg);
log!(DEBUG, "{}",arg.as_raw(shenv));
log!(DEBUG, processed);
match arg.rule() {
TkRule::DQuote => {
@@ -23,7 +24,7 @@ pub fn expand_argv(argv: Vec<Token>, shenv: &mut ShEnv) -> Vec<Token> {
processed.append(&mut varsub_exp);
}
TkRule::TildeSub => {
let tilde_exp = expand_tilde(arg.clone());
let tilde_exp = expand_tilde(arg.clone(), shenv);
processed.push(tilde_exp);
}
_ => {