aboutsummaryrefslogtreecommitdiff
path: root/main.ha
blob: 8f74c7b509dab0b201452bb9bacf7b92cc375f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use fmt;
use fs;
use lib;
use strings;
use todo;

export fn main() void = {

	// load config
	const config = match (lib::config_read()) {
		case let config: *lib::config => yield config;
		case let err: fs::error => fmt::fatalf("Error opening config: {}", fs::strerror(err));
	};
	defer lib::config_free(config);

	const todo_files = config.files;

	// load todos
	let todos = todo::loadall(todo_files)!;
	defer strings::freeall(todos);

	// print todos
	fmt::println("To-dos:")!;

	for (let item .. todos) {
		if (item != "") todo::print(item);
	};
};