Added rustfmt.toml, formatted codebase

This commit is contained in:
2025-08-12 13:58:25 -04:00
parent 23fb67aba8
commit 8ad53f09b3
52 changed files with 15188 additions and 14451 deletions

View File

@@ -1,37 +1,43 @@
use crate::{jobs::JobBldr, libsh::error::{ShErr, ShErrKind, ShResult}, parse::{NdRule, Node}, prelude::*, state::{self, source_file}};
use crate::{
jobs::JobBldr,
libsh::error::{ShErr, ShErrKind, ShResult},
parse::{NdRule, Node},
prelude::*,
state::{self, source_file},
};
use super::setup_builtin;
pub fn source(node: Node, job: &mut JobBldr) -> ShResult<()> {
let NdRule::Command { assignments: _, argv } = node.class else {
unreachable!()
};
let NdRule::Command {
assignments: _,
argv,
} = node.class
else {
unreachable!()
};
let (argv,_) = setup_builtin(argv, job, None)?;
let (argv, _) = setup_builtin(argv, job, None)?;
for (arg,span) in argv {
let path = PathBuf::from(arg);
if !path.exists() {
return Err(
ShErr::full(
ShErrKind::ExecFail,
format!("source: File '{}' not found",path.display()),
span
)
);
}
if !path.is_file() {
return Err(
ShErr::full(
ShErrKind::ExecFail,
format!("source: Given path '{}' is not a file",path.display()),
span
)
);
}
source_file(path)?;
}
for (arg, span) in argv {
let path = PathBuf::from(arg);
if !path.exists() {
return Err(ShErr::full(
ShErrKind::ExecFail,
format!("source: File '{}' not found", path.display()),
span,
));
}
if !path.is_file() {
return Err(ShErr::full(
ShErrKind::ExecFail,
format!("source: Given path '{}' is not a file", path.display()),
span,
));
}
source_file(path)?;
}
state::set_status(0);
Ok(())
state::set_status(0);
Ok(())
}