diff --git a/shell/src/ash.rs b/shell/src/ash.rs index d246d62..89f6010 100644 --- a/shell/src/ash.rs +++ b/shell/src/ash.rs @@ -3,7 +3,6 @@ use std::env; use std::process::Command as stdCommand; use std::io::{self, Write, ErrorKind}; use std::path::Path; -use std::fmt; pub struct Ash; diff --git a/src/boxcmd.rs b/src/boxcmd.rs index 1372760..c8e0f8d 100644 --- a/src/boxcmd.rs +++ b/src/boxcmd.rs @@ -13,6 +13,9 @@ impl Command for Boxcmd { registry.execute(cmd); return; } - println!("No command provided."); + println!( + "No command provided. Included commands:\n{}", + registry.list().join(", ") + ); } } diff --git a/utils/src/registry.rs b/utils/src/registry.rs index 9eff13c..4ee4e0d 100644 --- a/utils/src/registry.rs +++ b/utils/src/registry.rs @@ -16,6 +16,14 @@ impl CommandRegistry { self.commands.insert(name.to_string(), command); } + pub fn list(&self) -> Vec { + let mut bufvec = Vec::new(); + for (key, _value) in self.commands.iter() { + bufvec.push(String::from(key)) + } + bufvec + } + pub fn get(&self, name: &str) -> Option<&Box> { self.commands.get(name) }