Add author builtin

This commit is contained in:
2025-03-31 00:27:38 -04:00
parent 8b459cb7cb
commit a458e4f55c

View File

@@ -213,11 +213,26 @@ fn cdFn(shell_state: *ShellState, command: [][]const u8, allocator: Allocator) !
}
}
fn authorFn(shell_state: *ShellState, command: [][]const u8, allocator: Allocator) !void {
_ = shell_state;
_ = command;
_ = allocator;
print(
\\Author: Robby
\\Description: A shell to promote math!
\\Ask for the source code!
\\
\\Derived from an earlier version written in C by Spencer.
\\
, .{});
}
fn execCommand(command: [][]const u8, shell_state: *ShellState, allocator: Allocator) !u8 {
const builtins = comptime .{
.{ "exit", exitFn },
.{ "nomorenumbers", nomorenumbersFn },
.{ "cd", cdFn },
.{ "author", authorFn },
};
const builtinMap = StaticStringMap(BuiltinFunc).initComptime(builtins);