mm(1): imports full enum
This commit is contained in:
parent
64f3f73d96
commit
48dbea0228
10
src/mm.rs
10
src/mm.rs
@ -33,6 +33,8 @@ use getopt::GetOpt;
|
|||||||
use strerror::StrError;
|
use strerror::StrError;
|
||||||
use sysexits::{ EX_IOERR, EX_USAGE };
|
use sysexits::{ EX_IOERR, EX_USAGE };
|
||||||
|
|
||||||
|
use ArgMode::*;
|
||||||
|
|
||||||
enum ArgMode { In, Out }
|
enum ArgMode { In, Out }
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
@ -57,12 +59,12 @@ fn main() -> ExitCode {
|
|||||||
Ok("i") => { /* add inputs */
|
Ok("i") => { /* add inputs */
|
||||||
let input = opt.arg().unwrap();
|
let input = opt.arg().unwrap();
|
||||||
ins.push(input);
|
ins.push(input);
|
||||||
mode = Some(ArgMode::In);
|
mode = Some(In);
|
||||||
},
|
},
|
||||||
Ok("o") => { /* add output */
|
Ok("o") => { /* add output */
|
||||||
let output = opt.arg().unwrap();
|
let output = opt.arg().unwrap();
|
||||||
outs.push(output);
|
outs.push(output);
|
||||||
mode = Some(ArgMode::Out);
|
mode = Some(Out);
|
||||||
},
|
},
|
||||||
Err(_) | Ok(_) => {
|
Err(_) | Ok(_) => {
|
||||||
eprintln!("{}", usage);
|
eprintln!("{}", usage);
|
||||||
@ -77,8 +79,8 @@ fn main() -> ExitCode {
|
|||||||
if let Some(m) = mode {
|
if let Some(m) = mode {
|
||||||
for arg in remaining {
|
for arg in remaining {
|
||||||
match m {
|
match m {
|
||||||
ArgMode::In => ins.push(arg.to_string()),
|
In => ins.push(arg.to_string()),
|
||||||
ArgMode::Out => outs.push(arg.to_string()),
|
Out => outs.push(arg.to_string()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user