aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
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))
}