remux/src/error.rs

39 lines
856 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);
}
/// 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);
}
2024-02-04 16:07:24 -05:00
/// non-terminal environment prevention; code 5
2023-08-15 21:30:10 -04:00
pub fn not_terminal() {
println!("remux: not running from a terminal");
exit(5);
}
2024-02-04 16:07:24 -05:00
/// tried to nest while not in a session; code 6
pub fn not_nesting() {
println!("remux: cannot use nesting flag outside a TMUX session");
exit(6);
}