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