Add author builtin

This commit is contained in:
2025-03-31 00:27:38 -04:00
parent 9a1d2ef586
commit b415be3ddc

View File

@@ -211,11 +211,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 { fn execCommand(command: [][]const u8, shell_state: *ShellState, allocator: Allocator) !u8 {
const builtins = comptime .{ const builtins = comptime .{
.{ "exit", exitFn }, .{ "exit", exitFn },
.{ "nomorenumbers", nomorenumbersFn }, .{ "nomorenumbers", nomorenumbersFn },
.{ "cd", cdFn }, .{ "cd", cdFn },
.{ "author", authorFn },
}; };
const builtinMap = StaticStringMap(BuiltinFunc).initComptime(builtins); const builtinMap = StaticStringMap(BuiltinFunc).initComptime(builtins);