diff options
-rw-r--r-- | src/animalia.rs | 9 | ||||
-rw-r--r-- | src/definitions.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/animalia.rs b/src/animalia.rs new file mode 100644 index 0000000..f3b3261 --- /dev/null +++ b/src/animalia.rs @@ -0,0 +1,9 @@ +use std::error::Error; + +pub fn main(args: Vec<String>) -> Result<(), Box<dyn Error>> { + if !args.is_empty() { + Err("No arguments expected to 'animalia' command")?; + } + + Ok(()) +} diff --git a/src/definitions.rs b/src/definitions.rs index d3d0192..b28c52e 100644 --- a/src/definitions.rs +++ b/src/definitions.rs @@ -364,7 +364,7 @@ fn parse_xml( Ok(()) } -pub fn definitions(args: Vec<String>) -> Result<(), Box<dyn Error>> { +pub fn main(args: Vec<String>) -> Result<(), Box<dyn Error>> { let mut files: Vec<String> = vec![]; for arg in args { if arg == "-h" || arg == "--help" { diff --git a/src/main.rs b/src/main.rs index f484ade..0fcc3d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ use std::io::BufWriter; use std::process::ExitCode; mod definitions; +mod animalia; fn do_write<W, E: Error>(path: &str, write_func: W) -> Result<(), Box<dyn Error>> where @@ -43,7 +44,8 @@ fn try_main() -> Result<(), Box<dyn Error>> { command_args.push(arg.to_owned()); } match &command.to_string_lossy()[..] { - "definitions" => definitions::definitions(command_args), + "definitions" => definitions::main(command_args), + "animalia" => animalia::main(command_args), x => Err(format!("Unrecognized command: {x}").into()), } } |