summaryrefslogtreecommitdiff
path: root/src/cmd/cls.zig
blob: 4e7b8c650c0699038a77aa0ce62e68d6de23928e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;

const types = @import("./lib/types.zig");
const CommandStatus = types.CommandStatus;
const CommandContext = types.CommandContext;

pub const Cls = struct {
    pub fn eval(cls: Cls, ctx: CommandContext) !CommandStatus {
        _ = cls;

        if (ctx.output_capture == null) {
            // Clear screen - only works when not redirected
            print("\x1B[2J\x1B[H", .{});
        }
        return CommandStatus{ .Code = 0 };
    }
};