diff --git a/cmd/bulb/main.ha b/cmd/bulb/main.ha index 34f66c2..a4ba064 100644 --- a/cmd/bulb/main.ha +++ b/cmd/bulb/main.ha @@ -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,