diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/builtins.zig | 4 | ||||
| -rw-r--r-- | src/executor.zig | 2 | ||||
| -rw-r--r-- | src/shell.zig | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 3608b81..bb84a45 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1,7 +1,7 @@ const std = @import("std"); const path = @import("path.zig"); -const BUILTINS = [_][]const u8{ "exit", "echo", "type", "pwd", "cd", "history" }; +const BUILTINS = [_][]const u8{ "exit", "echo", "type", "pwd", "cd", "history", "jobs" }; pub const CommandResult = enum { continue_loop, exit_shell }; @@ -12,6 +12,8 @@ pub inline fn isBuiltin(cmd_name: []const u8) bool { return false; } +pub inline fn executeJobs() void {} + pub inline fn executeExit() CommandResult { return .exit_shell; } diff --git a/src/executor.zig b/src/executor.zig index f776e74..073c962 100644 --- a/src/executor.zig +++ b/src/executor.zig @@ -128,6 +128,8 @@ fn runBuiltinInChild( builtins.executePwd(allocator, w) catch {}; } else if (std.mem.eql(u8, cmd_name, "cd")) { builtins.executeCd(allocator, w, args) catch {}; + } else if (std.mem.eql(u8, cmd_name, "jobs")) { + builtins.executeJobs(); } else if (std.mem.eql(u8, cmd_name, "exit")) { // exit inside pipeline child just exits child } diff --git a/src/shell.zig b/src/shell.zig index d3f75ec..142ea47 100644 --- a/src/shell.zig +++ b/src/shell.zig @@ -149,6 +149,11 @@ pub fn executeCommand( return .continue_loop; } + if (std.mem.eql(u8, cmd_name, "jobs")) { + builtins.executeJobs(); + return .continue_loop; + } + if (std.mem.eql(u8, cmd_name, "type")) { try builtins.executeType(allocator, stdout, args); return .continue_loop; |