Add clear command
This commit is contained in:
@@ -12,6 +12,7 @@ const commands = std.StaticStringMap(CommandFn).initComptime(.{
|
|||||||
.{ "command", @import("cmds/command.zig").execute },
|
.{ "command", @import("cmds/command.zig").execute },
|
||||||
.{ "run", @import("cmds/run.zig").execute },
|
.{ "run", @import("cmds/run.zig").execute },
|
||||||
.{ "echo", @import("cmds/echo.zig").execute },
|
.{ "echo", @import("cmds/echo.zig").execute },
|
||||||
|
.{ "clear", @import("cmds/clear.zig").execute },
|
||||||
.{ "exit", @import("cmds/exit.zig").execute },
|
.{ "exit", @import("cmds/exit.zig").execute },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
const types = @import("../types.zig");
|
||||||
|
|
||||||
|
pub fn execute(ctx: types.CommandContext) !void {
|
||||||
|
try ctx.stdout.writeStreamingAll(
|
||||||
|
ctx.io,
|
||||||
|
"\x1b[2J\x1b[H",
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user