summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRory Dudley2024-02-19 17:45:14 -0700
committerRory Dudley2024-02-19 17:45:14 -0700
commitde2fe9dd7f2836f89490b822ae4464dab3bc769c (patch)
treecf5a2585652a92de8605afc6da367c26e5a56726 /src
parent52422d40316f4d836a96a15709c2f4fad7c96d3b (diff)
downloaddwarvish-de2fe9dd7f2836f89490b822ae4464dab3bc769c.tar.gz
Only print command name in error messages
Only print out the command name in error messages, rather than printing out the full path to the command.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 1dc0217..014b882 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -161,14 +161,20 @@ fn repl(paths: &Vec<&Path>, prompt: &str) {
match err.kind() {
// Occurs when the user doesn't have read access, or if the +x bit is not set
std::io::ErrorKind::PermissionDenied => {
- println!("dwvsh: permission denied: trying to fork to {}", &cmd)
+ println!(
+ "dwvsh: permission denied: trying to fork to {}",
+ cmd.split("/").last().unwrap()
+ )
}
// Occurs if a command was removed from the path
// If this is the case, refresh the path
std::io::ErrorKind::NotFound => {
bins = prefresh(&paths);
- println!("dwvsh: {}: command not found", cmd);
+ println!(
+ "dwvsh: {}: command not found",
+ cmd.split("/").last().unwrap()
+ );
}
// Otherwise print the OS error