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) = {
@ -86,7 +107,7 @@ fn subcmd_ls(cmd: *getopt::command) void = {
for (let directory .. path) {
match (list_boards_in(directory)) {
case let err: fs::error =>
fmt::errorf (
fmt::errorf(
"{}: Can't list boards in {}: {}\n",
name,
directory,