aboutsummaryrefslogtreecommitdiff
path: root/main.ha
diff options
context:
space:
mode:
Diffstat (limited to 'main.ha')
-rw-r--r--main.ha20
1 files changed, 20 insertions, 0 deletions
diff --git a/main.ha b/main.ha
new file mode 100644
index 0000000..995d5d4
--- /dev/null
+++ b/main.ha
@@ -0,0 +1,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);
+ };
+};