[augeas-devel] [Augeas] #237: We need a way to comment-out paths

Augeas trac at fedorahosted.org
Mon Nov 21 15:14:26 UTC 2011


#237: We need a way to comment-out paths
--------------------------+-------------------------------------------------
  Reporter:  ptaff        |       Owner:  lutter
      Type:  enhancement  |      Status:  new   
  Priority:  major        |   Milestone:  next  
 Component:  Augeas       |     Version:  0.8.0 
Resolution:               |    Keywords:        
--------------------------+-------------------------------------------------
Comment (by raphink):

 Here is an example showing the current limits of Augeas:

 {{{
 module Comment_Test =

 let eol = Util.eol

 let entry = Build.key_value_line "foo" Sep.equal (store Rx.word)

 let comment = [ label "#comment" . del /#[ \t]*/ "# "
               . store (/([^ \t\n].*[^ \t\n]|[^ \t\n])/ - /foo=.*/)
               . eol ]

 let commented = [ del /#[ \t]*/ "# " . Build.xchgs "foo" ".foo"
                       . Sep.equal . store Rx.word . eol ]

 let lns = (entry|comment|commented)*

 let conf = "foo=bar
 #foo=baz
 "

 test lns get conf =
   { "foo" = "bar" }
   { ".foo" = "baz" }

 test lns put conf after
   rm "/foo";
   set "/.foo" "booz" = "#foo=booz\n"
 }}}


 It does what we expect, but there's two issues here:
 * The `commented` definition has to contain hardcoded "foo" and ".foo"
 strings, since there is no way currently build a node label dynamically by
 concatenation;
 * The `comment` node has to exclude `/foo=.*` patterns manually in order
 to prevent parsing ambiguities since there is no non-disjoint union
 operator today.

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/237#comment:3>
Augeas <http://augeas.net/>
a configuration API




More information about the augeas-devel mailing list