feat(host): expose memcard controls and qualify process persistence
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
This commit is contained in:
@@ -2,6 +2,28 @@
|
||||
use clap::Args;
|
||||
use prometeu_host_headless::automation::Limits;
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct DesktopMediaArgs {
|
||||
/// Explicit memory-card image used by the desktop host.
|
||||
#[arg(long, value_name = "PATH")]
|
||||
pub memcard: Option<String>,
|
||||
/// Create a new image; never replace an existing destination.
|
||||
#[arg(long, requires = "memcard")]
|
||||
pub create_memcard: bool,
|
||||
}
|
||||
impl DesktopMediaArgs {
|
||||
pub fn forwarded_args(&self) -> Vec<String> {
|
||||
let mut args = Vec::new();
|
||||
if let Some(path) = &self.memcard {
|
||||
args.extend(["--memcard".into(), path.clone()]);
|
||||
}
|
||||
if self.create_memcard {
|
||||
args.push("--create-memcard".into());
|
||||
}
|
||||
args
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct HeadlessArgs {
|
||||
/// Use the versioned JSONL stdin/stdout protocol (required).
|
||||
|
||||
@@ -25,6 +25,8 @@ enum Commands {
|
||||
Run {
|
||||
/// Path to the cartridge (directory or .pmc file).
|
||||
cart: String,
|
||||
#[command(flatten)]
|
||||
media: prometeu_cli::DesktopMediaArgs,
|
||||
},
|
||||
/// Executes a cartridge in Assisted Mode (Debug).
|
||||
/// The runtime will wait for a DevTools connection before starting.
|
||||
@@ -34,6 +36,8 @@ enum Commands {
|
||||
/// TCP port for the DevTools server (default: 7777).
|
||||
#[arg(long, default_value_t = 7777)]
|
||||
port: u16,
|
||||
#[command(flatten)]
|
||||
media: prometeu_cli::DesktopMediaArgs,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -72,15 +76,17 @@ fn main() {
|
||||
let borrowed: Vec<&str> = args.iter().map(String::as_str).collect();
|
||||
dispatch(&exe_dir, "prometeu-headless", &borrowed);
|
||||
}
|
||||
Some(Commands::Run { cart }) => {
|
||||
dispatch(&exe_dir, "prometeu-runtime", &["--run", &cart]);
|
||||
Some(Commands::Run { cart, media }) => {
|
||||
let mut args = vec!["--run".into(), cart];
|
||||
args.extend(media.forwarded_args());
|
||||
let borrowed: Vec<&str> = args.iter().map(String::as_str).collect();
|
||||
dispatch(&exe_dir, "prometeu-runtime", &borrowed);
|
||||
}
|
||||
Some(Commands::Debug { cart, port }) => {
|
||||
dispatch(
|
||||
&exe_dir,
|
||||
"prometeu-runtime",
|
||||
&["--debug", &cart, "--port", &port.to_string()],
|
||||
);
|
||||
Some(Commands::Debug { cart, port, media }) => {
|
||||
let mut args = vec!["--debug".into(), cart, "--port".into(), port.to_string()];
|
||||
args.extend(media.forwarded_args());
|
||||
let borrowed: Vec<&str> = args.iter().map(String::as_str).collect();
|
||||
dispatch(&exe_dir, "prometeu-runtime", &borrowed);
|
||||
}
|
||||
None => {
|
||||
use clap::CommandFactory;
|
||||
|
||||
Reference in New Issue
Block a user