summaryrefslogtreecommitdiffstats
path: root/src/poem/elements/rune.rs
diff options
context:
space:
mode:
authorRory Dudley2024-09-28 14:57:03 -0600
committerRory Dudley2024-09-28 19:54:50 -0600
commit243a8c53ae03713b3d6b4f5bf82859f9c93be6ed (patch)
tree2bca8a92ec89707eebb00fd8b46f32e3a82466bb /src/poem/elements/rune.rs
parent97ca3fa5197599ec28b19d5b2048f7c24e4c8bbc (diff)
downloaddwarvish-243a8c53ae03713b3d6b4f5bf82859f9c93be6ed.tar.gz
Add support for inline environment variables
This patch adds the 'Notes' rune (`=`), which allows for passing environment variables, inline, to a binary, like so: EDITOR=vim sudo visudo Signed-off-by: Rory Dudley <rory@netc.lu>
Diffstat (limited to 'src/poem/elements/rune.rs')
-rw-r--r--src/poem/elements/rune.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/poem/elements/rune.rs b/src/poem/elements/rune.rs
index 79d53d0..8573583 100644
--- a/src/poem/elements/rune.rs
+++ b/src/poem/elements/rune.rs
@@ -35,6 +35,10 @@ pub enum Rune {
/// A subcommand to run first (`\``)
Poem,
+ /// Denotes an environment variable (`=`),
+ /// only if the verse is empty so far
+ Notes,
+
/// Read files into STDIN (`<`)
Read,
@@ -89,6 +93,7 @@ impl fmt::Display for Rune {
Rune::Remark => "#",
Rune::String => "\"",
Rune::Poem => "`",
+ Rune::Notes => "=",
Rune::Read => "<",
Rune::Write => ">",
Rune::Write2 => "2>",