memoryd: the crate, memoryd.toml, and listening on a socket

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-25 16:41:44 -07:00
committed by kyle
parent 964bd99b12
commit b84b9af540
14 changed files with 657 additions and 2 deletions
+33
View File
@@ -0,0 +1,33 @@
//! `memoryd serve --config <path>`.
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::ExitCode;
const USAGE: &str = "usage: memoryd serve --config <path>";
fn main() -> ExitCode {
let args: Vec<OsString> = 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 <path>`, or `None` for any other list.
fn parse(args: &[OsString]) -> Option<PathBuf> {
match args {
[serve, flag, path] if serve == "serve" && flag == "--config" => Some(PathBuf::from(path)),
_ => None,
}
}