[augeas-devel] augeas: master - Grub: support color directive
David Lutterkort
lutter at fedoraproject.org
Thu Jan 29 18:00:00 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=6be54650416f6660541602bd8cd84be17bff1f55
Commit: 6be54650416f6660541602bd8cd84be17bff1f55
Parent: c2722165821889fbaac63243b5c33ed21c8504ad
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Thu Jan 29 09:58:43 2009 -0800
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Jan 29 09:58:43 2009 -0800
Grub: support color directive
---
lenses/grub.aug | 15 +++++++++++++++
lenses/tests/test_grub.aug | 18 ++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/lenses/grub.aug b/lenses/grub.aug
index 61a5e96..54e8858 100644
--- a/lenses/grub.aug
+++ b/lenses/grub.aug
@@ -8,6 +8,7 @@ module Grub =
let value_to_eol = store /[^= \t][^\n]*/
let eol = Util.del_str "\n"
let del_to_eol = del /[^\n]*/ ""
+ let opt_ws = Util.del_opt_ws ""
let value_sep (dflt:string) = del /[ \t]*[ \t=][ \t]*/ dflt
let kw_arg (kw:string) (indent:string) (dflt_sep:string) =
@@ -24,6 +25,19 @@ module Grub =
let kw_pres (kw:string) = [ key kw . del_to_eol . eol ]
+ let color =
+ (* Should we nail it down to exactly the color names that *)
+ (* grub supports ? *)
+ let color_name = store /[A-Za-z-]+/ in
+ let color_spec =
+ [ label "foreground" . color_name] .
+ Util.del_str "/" .
+ [ label "background" . color_name ] in
+ [ opt_ws . key "color" .
+ Util.del_ws_spc . [ label "normal" . color_spec ] .
+ (Util.del_ws_spc . [ label "highlight" . color_spec ])? .
+ eol ]
+
let menu_setting = kw_menu_arg "default"
| kw_menu_arg "fallback"
| kw_pres "hiddenmenu"
@@ -32,6 +46,7 @@ module Grub =
| kw_menu_arg "serial"
| kw_menu_arg "terminal"
| password_arg
+ | color
let title = del /title[ \t]+/ "title " . value_to_eol . eol
diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug
index f03e186..a38f000 100644
--- a/lenses/tests/test_grub.aug
+++ b/lenses/tests/test_grub.aug
@@ -65,6 +65,24 @@ title Fedora (2.6.24.3-34.fc8)
## default num\n" = {} {} {}
+ (* Color directive *)
+ test Grub.lns get "color cyan/blue white/blue\n" =
+ { "color"
+ { "normal" { "foreground" = "cyan" }
+ { "background" = "blue" } }
+ { "highlight" { "foreground" = "white" }
+ { "background" = "blue" } } }
+
+ test Grub.lns get "\tcolor cyan/light-blue\n" =
+ { "color"
+ { "normal" { "foreground" = "cyan" }
+ { "background" = "light-blue" } } }
+
+ test Grub.lns put "color cyan/light-blue\n" after
+ set "/color/highlight/foreground" "white";
+ set "/color/highlight/background" "black" =
+ "color cyan/light-blue white/black\n"
+
(* Local Variables: *)
(* mode: caml *)
(* End: *)
More information about the augeas-devel
mailing list