use std::sync::Arc; use std::path::PathBuf; use std::fs::canonicalize; use clap::{arg, command, value_parser}; use vestal::Module; /// Define command line arguments. fn cli () -> clap::Command { command!() .arg(arg!([path] "Path to VST DLL").value_parser(value_parser!(PathBuf))) //.arg(arg!(-s --stub "Provide a stub import").required(false)) .arg(arg!(-i --inspect "Show info, don't run").required(false)) .arg(arg!(-v --verbose "Show a lot of info").required(false)) } fn main () -> Result<(), Box> { // Parse command line arguments. let args = cli().get_matches(); if let Some(path) = args.get_one::("path") { Module::from_path(path, *(args.get_one::("verbose").unwrap_or(&false))) .map(Arc::new) .unwrap_or_else(|e|panic!("failed to open: {e:?}")) .search(std::env::current_dir()?) .search(canonicalize(path.clone().parent().expect("invalid parent path"))?) .search("/home/user/Lab/Cosmo/wineprefix/drive_c/windows/system32") .load(true).unwrap_or_else(|e|panic!("failed to load: {e:?}")) .resolve(true).unwrap_or_else(|e|panic!("failed to resolve: {e:?}")) .relink().unwrap_or_else(|e|panic!("failed to relink: {e:?}")); } else { println!("Pass a path to a VST DLL"); } Ok(()) }