diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-02-23 20:37:39 +0000 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-02-23 20:37:39 +0000 |
| commit | d620665f6b2e1ae5db4c98a09e35bd63133ae87f (patch) | |
| tree | 964bf044d3e1ae880c65d252e7c702f81874f2bc /src/main.rs | |
| parent | 72c91149425d45b0517bda929d459fc02f5603cc (diff) | |
Add logic skeleton for rust version
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..cb258c2 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,27 @@ +// mod argument_parser; +mod configuration; +mod command; + +use std::env::args; +use std::io::Result; +use configuration::Configuration; +use command::{available_commands, Command, help::Help}; + +fn main() -> Result<()> { + let configuration = Configuration::new(); + let commands = available_commands(); + + println!("CONFIGURATION DIRECTORY: {}", configuration.config_directory.display()); + println!("DATA DIRECTORY: {}", configuration.data_directory.display()); + println!("OUTPUT DIRECTORY: {}", configuration.output_directory.display()); + + let arguments: Vec<String> = args().collect(); + + if let Some(command_name) = arguments.get(1) { + if let Some(command) = commands.iter().find(|&c| c.command() == command_name) { + return command.execute(arguments.get(2)); + } + } + + Help::new().execute(None) +} |