summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology.rs
diff options
context:
space:
mode:
authorRory Dudley2024-05-20 23:54:01 -0600
committerRory Dudley2024-05-20 23:54:01 -0600
commitdedadcfd30516c40692fe495a6ad10aea7c050de (patch)
treece0f8dcb6546bbd9e0f61a35c88c32c9c6c608ab /src/poem/anthology.rs
parent85a3bd273e927b8dc31aadf263b93ef8fd3b7a39 (diff)
downloaddwarvish-dedadcfd30516c40692fe495a6ad10aea7c050de.tar.gz
Added the 'which' built-in command
Added a built-in which command (for MacOS and BSD), which can check aliases, and other shell built-in commands, in addition to bins on the $PATH.
Diffstat (limited to 'src/poem/anthology.rs')
-rw-r--r--src/poem/anthology.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/poem/anthology.rs b/src/poem/anthology.rs
index 7766f62..8ff70f9 100644
--- a/src/poem/anthology.rs
+++ b/src/poem/anthology.rs
@@ -3,12 +3,13 @@ mod cd;
mod exit;
mod export;
mod source;
+mod which;
use crate::compose::Environment;
use crate::poem::Verse;
/// A static list of all the built-in commands
-static INDEX: [&str; 7] = [
- "alias", "cd", "exit", "export", "source", "unalias", "unset",
+static INDEX: [&str; 8] = [
+ "alias", "cd", "exit", "export", "source", "unalias", "unset", "which",
];
/// Lookup the index of a built-in command
@@ -53,6 +54,7 @@ pub fn incant(verse: &Verse, out: &mut Vec<u8>, index: usize, env: &mut Environm
"source" => source::incant(verse, out, env),
"unalias" => alias::unincant(verse, &mut env.aliases),
"unset" => export::unincant(verse),
+ "which" => which::incant(verse, out, env),
_ => unreachable!(),
}
}