diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-18 18:58:11 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-18 18:58:11 +0200 |
| commit | 323a4fa3c75794885199b580f266e436f6c646a2 (patch) | |
| tree | d4c2d16760e0a05ecd653f2bfa9348d436900e4f /src/main.rs | |
| parent | c10134b402544085aba900eaaa2aa485be2cd390 (diff) | |
Add integration tests
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 9245dcc..b84939c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ mod utils; use command::{Command, available_commands, help::Help}; use configuration::Configuration; use std::env::args; -use std::io::Result; +use std::io::{Error, Result}; use std::iter::once; fn main() -> Result<()> { @@ -35,6 +35,7 @@ fn run() -> Result<()> { let configuration = Configuration::new()?; let commands = available_commands(); let arguments: Vec<String> = args().collect(); + let message; if let Some(command_name) = arguments.get(1) { if let Some(main_command) = commands.into_iter().find(|c| c.command() == command_name) { @@ -53,7 +54,11 @@ fn run() -> Result<()> { return Ok(()); } + message = format!("Command {command_name} does not exist."); + } else { + message = "You must provide at least one command.".to_string(); } - Help::new().execute(None, &configuration, "help") + Help::new().execute(None, &configuration, "help")?; + Err(Error::other(message)) } |