mirror of
https://github.com/mikedilger/chorus.git
synced 2026-08-01 07:21:39 +00:00
34 lines
769 B
Rust
34 lines
769 B
Rust
|
|
pub mod config;
|
|
pub mod error;
|
|
|
|
use crate::config::Config;
|
|
use crate::error::Error;
|
|
use std::env;
|
|
use std::fs::OpenOptions;
|
|
use std::io::Read;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Error> {
|
|
env_logger::init();
|
|
|
|
// Get args (config path)
|
|
let mut args = env::args();
|
|
if args.len() <= 1 {
|
|
panic!("USAGE: chorus <config_path>");
|
|
}
|
|
let _ = args.next(); // ignore program name
|
|
let config_path = args.next().unwrap();
|
|
|
|
// Read config file
|
|
let mut file = OpenOptions::new().read(true).open(config_path)?;
|
|
let mut contents = String::new();
|
|
file.read_to_string(&mut contents)?;
|
|
let config: Config = ron::from_str(&contents)?;
|
|
log::debug!("Loaded config file.");
|
|
|
|
log::error!("No main yet.");
|
|
|
|
Ok(())
|
|
}
|