remux/src/error.rs

38 lines
821 B
Rust
Raw Normal View History

2023-04-14 16:38:34 -04:00
use std::process::exit;
/// no subcommand that matches user input; code 1
2023-04-14 16:38:34 -04:00
pub fn no_subcommand(subcommand: String) {
println!("remux: no command match for \"{subcommand}\"");
exit(1);
}
/// target session not found; code 2
2023-04-14 16:38:34 -04:00
pub fn no_target(target: String) {
println!("remux: no session \"{target}\" exists");
exit(2);
}
/// no sessions exist; code 2
2023-04-14 16:38:34 -04:00
pub fn no_sessions() {
println!("remux: no sessions running");
println!("use 'remux n <title>' to create a new session");
exit(2);
}
/// help topic doesn't exist; code 3
2023-04-14 16:38:34 -04:00
pub fn no_help(topic: String) {
println!("remux: no help for \"{topic}\"");
exit(3);
}
/// user provided no target; code 4
pub fn missing_target() {
println!("remux: no target provided");
exit(4);
}
2023-08-15 21:30:10 -04:00
pub fn not_terminal() {
println!("remux: not running from a terminal");
exit(5);
}