From 243a8c53ae03713b3d6b4f5bf82859f9c93be6ed Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Sat, 28 Sep 2024 14:57:03 -0600 Subject: 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 --- src/poem/elements/rune.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/poem/elements/rune.rs') 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>", -- cgit v1.2.3