blob: 995d5d434cf64269d6822cd2d76a5f7204346503 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use fmt;
use strings;
use todo;
use fs;
def TODO_FILE = "todo.txt";
export fn main() void = {
const todos = match(todo::open(TODO_FILE)) {
case let todos: []str => yield todos;
case let err: fs::error => fmt::fatalf("Error opening {}: {}", TODO_FILE, fs::strerror(err));
};
defer strings::freeall(todos);
fmt::println("To-dos:")!;
for (let item .. todos) {
if (item != "") todo::print(item);
};
};
|