aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0001-Shellvars-accept-and-builtins.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/augeas/0001-Shellvars-accept-and-builtins.patch')
-rw-r--r--main/augeas/0001-Shellvars-accept-and-builtins.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/main/augeas/0001-Shellvars-accept-and-builtins.patch b/main/augeas/0001-Shellvars-accept-and-builtins.patch
new file mode 100644
index 0000000000..53f5ddbd55
--- /dev/null
+++ b/main/augeas/0001-Shellvars-accept-and-builtins.patch
@@ -0,0 +1,64 @@
+From 37a817680eb162a21fa6e2eac8feda5973dfb465 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com>
+Date: Mon, 13 Jul 2015 10:03:21 +0200
+Subject: [PATCH 01/15] Shellvars: accept [] and [[]] builtins
+
+Fix GH #188
+---
+ lenses/shellvars.aug | 9 +++++++++
+ lenses/tests/test_shellvars.aug | 5 +++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
+index 25bb82b..b988972 100644
+--- a/lenses/shellvars.aug
++++ b/lenses/shellvars.aug
+@@ -105,6 +105,13 @@ module Shellvars =
+ . Util.del_str "return"
+ . ( Util.del_ws_spc . store Rx.integer )?
+
++ let condition =
++ let sto_cond = store /[^[#; \t\n][^#;\n]+[^]#; \t\n]|[^[]#; \t\n]+/
++ in let cond (start:string) (end:string) = [ label "type" . store start ]
++ . Util.del_ws_spc . sto_cond
++ . Util.del_ws_spc . Util.del_str end
++ in Util.indent . label "@condition" . (cond "[" "]" | cond "[[" "]]")
++
+
+ (************************************************************************
+ * Group: CONDITIONALS AND LOOPS
+@@ -169,6 +176,7 @@ module Shellvars =
+ | entry_eol_item bare_export
+ | entry_eol_item builtin
+ | entry_eol_item return
++ | entry_eol_item condition
+
+ let entry_noeol =
+ let entry_item (item:lens) = [ item ] in
+@@ -178,6 +186,7 @@ module Shellvars =
+ | entry_item bare_export
+ | entry_item builtin
+ | entry_item return
++ | entry_item condition
+
+ let rec rec_entry =
+ let entry = comment | entry_eol | rec_entry in
+diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
+index 7a89f11..778a8d2 100644
+--- a/lenses/tests/test_shellvars.aug
++++ b/lenses/tests/test_shellvars.aug
+@@ -536,6 +536,11 @@ fi\n" =
+ test lns get "var[alpha_beta,gamma]=something\n" =
+ { "var[alpha_beta,gamma]" = "something" }
+
++ (* GH #188: support more conditions *)
++ test Shellvars.lns get "[ -f $FILENAME ]\n" =
++ { "@condition" = "-f $FILENAME"
++ { "type" = "[" } }
++
+ (* Local Variables: *)
+ (* mode: caml *)
+ (* End: *)
+--
+2.1.0
+