diff options
| author | Lucas Faria Mendes <lucas.oliveira1676@etec.sp.gov.br> | 2025-12-05 08:18:27 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.oliveira1676@etec.sp.gov.br> | 2025-12-05 08:18:27 +0000 |
| commit | f58e4507f913bf3a6f5afee14650f058ecf6be84 (patch) | |
| tree | decdb24e4d91132640ab8bc7e94c164ee043fcdc /src/shell.zig | |
| parent | 1fe2527050761776206110c4da83b57a33b1e18a (diff) | |
| download | shell-zig-f58e4507f913bf3a6f5afee14650f058ecf6be84.tar.gz shell-zig-f58e4507f913bf3a6f5afee14650f058ecf6be84.zip | |
codecrafters submit [skip ci]
Diffstat (limited to 'src/shell.zig')
| -rw-r--r-- | src/shell.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shell.zig b/src/shell.zig index 271e3ea..6f8bfef 100644 --- a/src/shell.zig +++ b/src/shell.zig @@ -19,9 +19,15 @@ pub fn executeCommand( error_redirect: ?[]const u8, append_output: ?[]const u8, append_error: ?[]const u8, + history_list: []const []const u8, ) !builtins.CommandResult { if (std.mem.eql(u8, cmd_name, "exit")) return builtins.executeExit(); + if (std.mem.eql(u8, cmd_name, "history")) { + try builtins.executeHistory(stdout, history_list); + return .continue_loop; + } + if (std.mem.eql(u8, cmd_name, "echo")) { if (error_redirect) |file| { const fd = try std.fs.cwd().createFile(file, .{}); |