Print out better information when an invalid number is given
This commit is contained in:
parent
dddb8648f4
commit
e15a63ddb0
@ -43,7 +43,8 @@ export fn main() void = {
|
|||||||
case let num: int =>
|
case let num: int =>
|
||||||
number = num;
|
number = num;
|
||||||
case =>
|
case =>
|
||||||
getopt::printhelp(os::stdout, name, cmd.help)!;
|
fmt::errorf("{}: option -{} requires a number\n", name, opt.0)!;
|
||||||
|
getopt::printusage(os::stdout, name, cmd.help)!;
|
||||||
os::exit(os::status::FAILURE);
|
os::exit(os::status::FAILURE);
|
||||||
};
|
};
|
||||||
case 'p' =>
|
case 'p' =>
|
||||||
@ -58,7 +59,7 @@ export fn main() void = {
|
|||||||
// list boards and exit
|
// list boards and exit
|
||||||
match (bulb::list(os::stdout)) {
|
match (bulb::list(os::stdout)) {
|
||||||
case let err: bulb::error =>
|
case let err: bulb::error =>
|
||||||
fmt::errorf("{}: Could not list boards: {}\n", name, bulb::strerror(err))!;
|
fmt::errorf("{}: could not list boards: {}\n", name, bulb::strerror(err))!;
|
||||||
os::exit(os::status::FAILURE);
|
os::exit(os::status::FAILURE);
|
||||||
case void =>
|
case void =>
|
||||||
os::exit(os::status::SUCCESS);
|
os::exit(os::status::SUCCESS);
|
||||||
@ -70,7 +71,7 @@ export fn main() void = {
|
|||||||
let user_name = if (anonymous) void else get_user_name();
|
let user_name = if (anonymous) void else get_user_name();
|
||||||
match (bulb::post(os::stdin, board, user_name)) {
|
match (bulb::post(os::stdin, board, user_name)) {
|
||||||
case let err: bulb::error =>
|
case let err: bulb::error =>
|
||||||
fmt::errorf("{}: Could not post to {}: {}\n", name, board, bulb::strerror(err))!;
|
fmt::errorf("{}: could not post to {}: {}\n", name, board, bulb::strerror(err))!;
|
||||||
case void => void;
|
case void => void;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -78,7 +79,7 @@ export fn main() void = {
|
|||||||
// read latest posts on the board
|
// read latest posts on the board
|
||||||
match (bulb::read(os::stdout, board, number)) {
|
match (bulb::read(os::stdout, board, number)) {
|
||||||
case let err: bulb::error =>
|
case let err: bulb::error =>
|
||||||
fmt::errorf("{}: Could not read {}: {}\n", name, board, bulb::strerror(err))!;
|
fmt::errorf("{}: could not read {}: {}\n", name, board, bulb::strerror(err))!;
|
||||||
case void => void;
|
case void => void;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user