fixes
This commit is contained in:
parent
11bb024ed9
commit
12ce9744d1
@ -7,9 +7,9 @@ const InteractionError = error{
|
||||
|
||||
pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]const u8)) !void {
|
||||
var failure: usize = 0;
|
||||
try clearTerminal();
|
||||
|
||||
while (failure < 3) {
|
||||
try clearTerminal();
|
||||
printItems(tasks) catch |err| {
|
||||
std.debug.print("Failed to print the items:\n{}\n", .{err});
|
||||
failure += 1;
|
||||
@ -21,9 +21,10 @@ pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]con
|
||||
continue;
|
||||
};
|
||||
defer allocator.free(input);
|
||||
// todo add option to manipulate tasks via numbers (and add numbers to tasks)
|
||||
|
||||
const Case = enum { add, edit, remove, quit };
|
||||
const case = std.meta.stringToEnum(Case, input) orelse return;
|
||||
const case = std.meta.stringToEnum(Case, input) orelse continue;
|
||||
|
||||
var task_name: []const u8 = undefined;
|
||||
|
||||
@ -71,7 +72,6 @@ pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]con
|
||||
},
|
||||
.quit => break,
|
||||
}
|
||||
try clearTerminal();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user