Files
agent-sandbox/src/main.rs
T

29 lines
637 B
Rust

use std::process;
use clap::Parser;
use agent_sandbox::cli::Args;
use agent_sandbox::config::{self, FileConfig};
fn main() {
let args = Args::parse();
let file_config = if args.no_config {
None
} else {
config::find_config_path(args.config_path.as_deref())
.map(|p| FileConfig::load(&p).unwrap_or_else(|e| exit_err(&e)))
};
let config = config::build(args, file_config).unwrap_or_else(|e| exit_err(&e));
if let Err(e) = agent_sandbox::run(config) {
exit_err(&e);
}
}
fn exit_err(e: &dyn std::fmt::Display) -> ! {
eprintln!("error: {e}");
process::exit(1);
}