From 8ef26da233c2d6db1455f74b572de77944efefe0 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen 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