1pub mod cli;
2
3mod file;
4mod enc;
5mod dec;
6
7const BAR_STYLE: &str = "[{elapsed_precise}] {binary_bytes_per_sec} {bar} {binary_bytes}/{binary_total_bytes} ({eta})";
8
9#[inline]
10fn handle_err(result: Result<(), ()>) -> std::process::ExitCode {
11 match result {
12 Ok(()) => std::process::ExitCode::SUCCESS,
13 Err(()) => std::process::ExitCode::FAILURE
14 }
15}
16
17pub async fn run(cli: cli::Cli) -> std::process::ExitCode {
18 match cli.command {
19 cli::Command::Enc(args) => handle_err(enc::enc(args).await),
20 cli::Command::Dec(args) => handle_err(dec::dec_file(args).await),
21 cli::Command::Fetch(args) => handle_err(dec::dec_fetch(args).await)
22 }
23}