You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
731 B
37 lines
731 B
use super::*;
|
|
|
|
impl ProcessArgs
|
|
{
|
|
pub fn parse<T, U>(string: &mut T, not_last: &mut bool) -> Result<Self, &'static str>
|
|
where T: Iterator<Item=U>,
|
|
U: AsRef<str>
|
|
{
|
|
let name = string.next().ok_or("No process name")?.as_ref().to_owned();
|
|
let mut args = Vec::new();
|
|
*not_last = false;
|
|
while let Some(arg) = string.next() {
|
|
let arg = arg.as_ref();
|
|
let mut chars = arg.chars();
|
|
if let Some(BROKEN_PIPE) = chars.next() {
|
|
*not_last = true;
|
|
break;
|
|
} else {
|
|
args.push(arg.to_owned());
|
|
}
|
|
}
|
|
|
|
Ok(Self{
|
|
name,
|
|
args,
|
|
})
|
|
}
|
|
|
|
pub fn verify(&self) -> Result<(), &'static str>
|
|
{
|
|
//TODO: Check file path of executable
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
//TODO: impl fmt::Display for ProcessArgs
|