use colored::*;
use crate::modules::commands::init::run_init;
use crate::modules::commands::migrate::run_migrate;
use crate::modules::commands::replicate::run_replicate;
use crate::modules::commands::tables::run_tables;
use crate::modules::services::utils::init_check;
use crate::modules::types::cli::Cli;
pub mod init;
pub mod migrate;
pub mod replicate;
pub mod tables;
pub fn init(args: Cli) -> () {
if args.overwrite {
run_init(args);
} else {
let init_state: bool = init_check(false);
if !init_state {
run_init(args);
} else {
println!("{}", "Replicator config already exists!".red());
}
}
}
pub fn replicate(args: Cli) -> () {
let init_state: bool = init_check(false);
if init_state {
run_replicate(args);
} else {
println!("{}", "Replicator config does not exist. Init first!".red());
}
}
pub fn migrate(args: Cli) -> () {
let init_state: bool = init_check(false);
if init_state {
run_migrate(args);
} else {
println!("{}", "Replicator config does not exist. Init first!".red());
}
}
pub fn tables(args: Cli) -> () {
let init_state: bool = init_check(false);
if init_state {
run_tables(args);
} else {
println!("{}", "Replicator config does not exist. Init first!".red());
}
}