//! `memoryd serve --config `. use std::ffi::OsString; use std::path::PathBuf; use std::process::ExitCode; const USAGE: &str = "usage: memoryd serve --config "; fn main() -> ExitCode { let args: Vec = std::env::args_os().skip(1).collect(); let Some(config) = parse(&args) else { eprintln!("{USAGE}"); return ExitCode::from(2); }; match memoryd::config::Config::load(&config) { Ok(_) => { eprintln!("memoryd: not implemented"); ExitCode::from(2) } Err(e) => { eprintln!("memoryd: {e}\nsee docs/runbook.md#memoryd-start-failed"); ExitCode::from(1) } } } /// The config path of `serve --config `, or `None` for any other list. fn parse(args: &[OsString]) -> Option { match args { [serve, flag, path] if serve == "serve" && flag == "--config" => Some(PathBuf::from(path)), _ => None, } }