pub mod action;
pub mod browse;
pub mod help;
pub mod input;
pub mod parameters;
pub mod treatment;
use self::action::EnkryptitTuiAction;
use self::input::TuiInput;
use crate::VERSION;
use colored::*;
#[allow(unused)] macro_rules! show_params {
($kt:expr, $c:expr) => {
println!("\n{}", "Current Parameters".cyan().bold());
println!(" Key Type: {}", format!("{:?}", $kt).yellow());
println!(" Compression: {}", format!("{:?}", $c).yellow());
};
}
pub fn launch_ui(input: &impl TuiInput) {
println!("\n{}", "Enkryptit".cyan().bold());
println!(" Fast & Simple File Encryption Manager v0.0.{}", VERSION);
loop {
let choices = vec!["Browse", "Parameters", "Help", "Exit"];
match input.select("What do you want to do?", &choices) {
Ok(choice) if choice == "Exit" => {
println!("\n{}", "Goodbye!".green());
break;
}
Ok(value) => {
if let Some(action) = EnkryptitTuiAction::from_string(&value)
&& let Err(e) = action.execute(input)
{
e.into_output().display();
}
}
Err(_) => {
tracing::info!("Selection cancelled");
}
}
}
}