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

const types = @import("./types.zig");
const CommandStatus = types.CommandStatus;
const OutputCapture = types.OutputCapture;
const InputSource = types.InputSource;

pub const Cls = struct {
    pub fn eval(cls: Cls, allocator: Allocator, output_capture: ?*OutputCapture, input_source: ?*InputSource) !CommandStatus {
        _ = cls;
        _ = allocator;
        _ = input_source;

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