use std::thread;
use clap::Parser;
use ssw::websrv::{
    run_server,
    WebsrvConfig,
};


#[derive(Parser, Debug)]
//#[command(author, version, about, long_about = None)]
#[command(name = "ssw")]
#[command(author = None)]
#[command(about = "A simple web server. Pass a configuration file with -c.")]
#[command(long_about = "A simple web server. Conf file must be  toml or ini. Example: \n
        threads = 10
        bind_addr = \"0.0.0.0:7878\"
        root_folder = \"/my/web/site\"")]
pub struct Args {
    #[arg(short)]
    conf_file: String,
}

fn main() {
    let args = Args::parse();
    println!("Hello {}!", args.conf_file);

    let config = WebsrvConfig::from_file(&args.conf_file);

    thread::spawn(move || {
        run_server(config);
    });
    loop {
        continue
    };
    
}


