aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0018-Shellvars-allow-command-specific-environment-variabl.patch
blob: d4bb1cc64663b6a010744c3d7a22942f1b78bf13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 8ef26da233c2d6db1455f74b572de77944efefe0 Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Fri, 26 Dec 2014 13:27:13 +0200
Subject: [PATCH 18/19] Shellvars: allow command-specific environment variables

---
 lenses/shellvars.aug            | 4 +++-
 lenses/tests/test_shellvars.aug | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index f7f4c47..3d05da5 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -157,7 +157,9 @@ module Shellvars =
     in let pipe = action_pipe (entry_eol_item command | entry_item command)
     in let and = action_and entry
     in let or = action_or entry
-    in Util.indent . label "@command" . store (word - reserved_key)
+    in Util.indent . label "@command"
+     . [ key key_re . eq . store anyquot . Sep.space . del /(\\\\\n[ \t]*)?/ "" ]*
+     . store (word - reserved_key)
      . [ Sep.space . label "@arg" . sto_to_semicol]?
      . ( pipe | and | or )?
 
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index 07c392e..29f9e75 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -672,6 +672,13 @@ test Shellvars.lns get "cat /etc/issue | grep -q \"Debian\" && echo moo || echo
               { "@command" = "echo"
                 { "@arg" = "baa" } } } } } } } }
 
+(* Command-specific environment variables *)
+test Shellvars.lns get "abc=def \\\n  ghi=\"jkl mno\" command arg1 arg2\n" =
+  { "@command" = "command"
+    { "abc" = "def" }
+    { "ghi" = "\"jkl mno\"" }
+    { "@arg" = "arg1 arg2" }
+  }
 
 (* Local Variables: *)
 (* mode: caml       *)
-- 
2.5.0