mod common; mod config; use clap::Parser; use std::path::PathBuf; #[derive(Parser)] #[command(name = "refractor")] #[command(version = "0.1.0")] #[command(about = "An automated push/pull/clone utility for mirroring Git repositories")] #[command(long_about = None)] struct Args { #[arg(short, long, help = "Specify a config file", default_value = "/etc/refractr/config.toml")] config: Vec, #[arg(short, long, help = "Specify the level of verbosity", action = clap::ArgAction::Count)] verbose: u8, #[arg(short = 'e', long, help = "Output a full, commented config file and exit")] create: bool, } fn main() { let args = Args::parse(); if args.verbose >= 1 { common::verbose(args.verbose, 1, format!("Level {} verbosity enabled", args.verbose.to_string())); } common::verbose(args.verbose, 2, format!("Checking for create flag")); if args.create { common::verbose(args.verbose, 2, format!("Printing sample config")); let example = include_str!("example/config.toml"); println!("{}", example); } else { let cfg = config::read_config(args.config); } }