From b02576d3a00f182394be4bc41a26de50e4b64078 Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Sat, 30 Mar 2024 20:22:47 -0600 Subject: Add the 'unset' built-in command Add the 'unset' command to remove global environment variable definitions from the shell. --- src/poem/anthology/export.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/poem/anthology/export.rs') 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 +} -- cgit v1.2.3