mm(1): imports full enum

This commit is contained in:
Emma Tebibyte 2024-07-14 18:41:18 -06:00
parent 64f3f73d96
commit 48dbea0228
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270

View File

@ -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()),
}; };
} }
} }