use playwright_rs::{install_browsers, install_browsers_with_deps};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = std::env::args().skip(1).collect();
let with_deps = args.iter().any(|arg| arg == "--with-deps");
let browsers: Vec<&str> = args
.iter()
.filter(|arg| *arg != "--with-deps")
.map(String::as_str)
.collect();
let selection = (!browsers.is_empty()).then_some(browsers.as_slice());
if with_deps {
install_browsers_with_deps(selection).await?;
} else {
install_browsers(selection).await?;
}
Ok(())
}