Add author builtin
This commit is contained in:
15
src/main.zig
15
src/main.zig
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user