summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/export.rs
diff options
context:
space:
mode:
authorRory Dudley2024-03-30 20:22:47 -0600
committerRory Dudley2024-03-30 20:22:47 -0600
commitb02576d3a00f182394be4bc41a26de50e4b64078 (patch)
tree2aca2f0729e9ecafd4857d1cf203f0a8857e3237 /src/poem/anthology/export.rs
parent2439f63a1c0859fd454d4a67dc36b61ad6ab5eb8 (diff)
downloaddwarvish-b02576d3a00f182394be4bc41a26de50e4b64078.tar.gz
Add the 'unset' built-in command
Add the 'unset' command to remove global environment variable definitions from the shell.
Diffstat (limited to 'src/poem/anthology/export.rs')
-rw-r--r--src/poem/anthology/export.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/poem/anthology/export.rs b/src/poem/anthology/export.rs
index 76dfd99..a61935c 100644
--- a/src/poem/anthology/export.rs
+++ b/src/poem/anthology/export.rs
@@ -21,3 +21,18 @@ pub fn incant(verse: &Verse) -> i32 {
0
}
+
+pub fn unincant(verse: &Verse) -> i32 {
+ match verse.clause() {
+ Some(clause) => {
+ for stanza in clause {
+ env::remove_var(stanza);
+ }
+ }
+ None => {
+ eprintln!("unset: not enough arguments");
+ return 1;
+ }
+ }
+ 0
+}