zellij/src/main.rs
Ken Matsui 510feb3040
fix(main): Refactor src/main.rs by splitting one massive main function into commands.rs (#829)
* fix(main): Remove unnecessary pub visibility from the main function in `src/main.rs`
* fix(main): Avoid unnecessary if-evaluations in the main function of `src/main.rs`
* fix(commands): Simplify kill_all_sessions
2021-11-05 22:59:45 +01:00

30 lines
799 B
Rust

mod commands;
mod install;
mod sessions;
#[cfg(test)]
mod tests;
use zellij_utils::{
cli::{CliArgs, Command, Sessions},
logging::*,
structopt::StructOpt,
};
fn main() {
configure_logger();
let opts = CliArgs::from_args();
if let Some(Command::Sessions(Sessions::ListSessions)) = opts.command {
commands::list_sessions();
} else if let Some(Command::Sessions(Sessions::KillAllSessions { yes })) = opts.command {
commands::kill_all_sessions(yes);
} else if let Some(Command::Sessions(Sessions::KillSession { ref target_session })) =
opts.command
{
commands::kill_session(target_session);
} else if let Some(path) = opts.server {
commands::start_server(path);
} else {
commands::start_client(opts);
}
}