use std::process::ExitCode;

fn usage(cmd: &str) {
    eprintln!("Usage: {cmd} PATH PROGRAM [ARGS...]");
}

fn main() -> ExitCode {
    let mut args = std::env::args();
    let cmd = args.next().unwrap();
    let Some(path) = args.next() else {
        usage(&cmd);
        return ExitCode::FAILURE;
    };
    let Some(program) = args.next() else {
        usage(&cmd);
        return ExitCode::FAILURE;
    };
    let cmd_args = args.collect::<Vec<_>>();

    println!("Run {program:?} at {path:?} with args {cmd_args:?}");

    ExitCode::SUCCESS
}
