experiment wmexec
This commit is contained in:
parent
298345a75a
commit
20ca6a58f6
@ -5,6 +5,10 @@ edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[[bin]]
|
||||
name = "wmexec"
|
||||
path = "src/bin/util/exec.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "wmtest-helper-dummy"
|
||||
path = "src/bin/test-helper/dummy.rs"
|
||||
|
||||
40
src/bin/util/exec.rs
Normal file
40
src/bin/util/exec.rs
Normal file
@ -0,0 +1,40 @@
|
||||
use std::env;
|
||||
use std::path;
|
||||
|
||||
struct wmexec {
|
||||
log: Option<Box<dyn AsRef<path::Path>>>,
|
||||
}
|
||||
|
||||
impl wmexec {
|
||||
fn new() -> wmexec {
|
||||
wmexec {
|
||||
log: None
|
||||
}
|
||||
}
|
||||
|
||||
fn log<P: AsRef<path::Path> + 'static>(&mut self, path: P) {
|
||||
self.log = Some(Box::new(path));
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let mut start: usize = 0;
|
||||
let mut skip_next = true;
|
||||
|
||||
'args: for i in 0..args.len() {
|
||||
if skip_next {
|
||||
skip_next = false;
|
||||
continue 'args;
|
||||
}
|
||||
|
||||
match args[i].as_str() {
|
||||
"--" => {
|
||||
start = i + 1;
|
||||
break 'args;
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user