implemented the 'builtin' and 'command' builtins
This commit is contained in:
@@ -25,6 +25,16 @@ pub fn alias(node: Node, io_stack: &mut IoStack, job: &mut JobBldr) -> ShResult<
|
||||
write(stdout, alias_output.as_bytes())?; // Write it
|
||||
} else {
|
||||
for (arg,span) in argv {
|
||||
if arg == "command" || arg == "builtin" {
|
||||
return Err(
|
||||
ShErr::full(
|
||||
ShErrKind::ExecFail,
|
||||
format!("alias: Cannot assign alias to reserved name '{arg}'"),
|
||||
span
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
let Some((name,body)) = arg.split_once('=') else {
|
||||
return Err(
|
||||
ShErr::full(
|
||||
|
||||
@@ -14,7 +14,7 @@ pub mod flowctl;
|
||||
pub mod zoltraak;
|
||||
pub mod shopt;
|
||||
|
||||
pub const BUILTINS: [&str;17] = [
|
||||
pub const BUILTINS: [&str;19] = [
|
||||
"echo",
|
||||
"cd",
|
||||
"export",
|
||||
@@ -31,7 +31,9 @@ pub const BUILTINS: [&str;17] = [
|
||||
"continue",
|
||||
"exit",
|
||||
"zoltraak",
|
||||
"shopt"
|
||||
"shopt",
|
||||
"builtin",
|
||||
"command"
|
||||
];
|
||||
|
||||
/// Sets up a builtin command
|
||||
|
||||
Reference in New Issue
Block a user