This commit is contained in:
Sasha Koshka 2024-10-08 15:52:21 -04:00
parent 22c5179503
commit 157890be44

View File

@ -60,7 +60,28 @@ fn subcmd_post(cmd: *getopt::command) void = {
}; };
}; };
// TODO let location = match(look_up_board(board)) {
case let location: str =>
yield location;
case void =>
fmt::errorf("{}: The board {} does not exist", name, board)!;
return;
};
let file = match(os::open(location, fs::flag::APPEND)) {
case let file: io::file =>
defer io::close(file);
yield file;
case let err: fs::error =>
fmt::errorf(
"{}: Can't make post: {}",
name, fs::strerror(err));
return;
};
let user =
fmt::fprintf(file, "{}: {}", user, message)!;
}; };
fn subcmd_read(cmd: *getopt::command) (void | errors::invalid) = { fn subcmd_read(cmd: *getopt::command) (void | errors::invalid) = {