Zealot/src/main.rs
Gregory Ballantine 75d71e9695
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
Added some fixes for the Linux installer/service - now shipping a log4rs config; creates /var/log for log files; fixed name of service file
2022-10-26 09:58:46 -04:00

53 lines
1.3 KiB
Rust

use clap::{Parser, Subcommand};
use log4rs;
use config::Config;
use transcoder::repository::Repository;
use transcoder::transcoder::Transcoder;
mod cmd;
mod settings;
mod transcoder;
mod util;
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
struct Cli {
/// Number of times to greet
#[clap(short = 'l', long, default_value_t = String::from("./log4rs.yaml"))]
log_config: String,
#[clap(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
enum Commands {
/// displays version info about this program
Setup {},
}
fn main() {
// initialize the clap CLI
let cli = Cli::parse();
// grab the log4rs config file path, then initialize log4rs
let log4rs_config: String = cli.log_config;
log4rs::init_file(&log4rs_config, Default::default()).unwrap();
match &cli.command {
// sub-commands will be handled here
Some(Commands::Setup {}) => cmd::core::setup_command(),
// run the main program without any commands
None => {
// create and initialize our config and repository objects
let c: Config = settings::load_config();
let r: Repository = Repository::new(&shellexpand::tilde(&c.get_string("transcoder.repository").unwrap()));
// create and start the video transcoder object
let t: Transcoder = Transcoder::new(c, r);
t.start();
},
}
}