mirror of
https://codeberg.org/unspeaker/vestal.git
synced 2025-12-07 01:56:48 +01:00
This commit is contained in:
parent
6bc456c814
commit
07f6f82268
22 changed files with 298 additions and 108 deletions
36
cli/src/main.rs
Normal file
36
cli/src/main.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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 <VALUE> "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<dyn std::error::Error>> {
|
||||
// Parse command line arguments.
|
||||
let args = cli().get_matches();
|
||||
if let Some(path) = args.get_one::<PathBuf>("path") {
|
||||
Module::from_path(path, *(args.get_one::<bool>("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(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue