<div dir="ltr"><br><br><div class="gmail_quote">On Wed, Aug 13, 2008 at 3:04 AM, David Lutterkort <span dir="ltr"><<a href="mailto:dlutter@redhat.com">dlutter@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Tue, 2008-08-12 at 23:44 +0200, Raphaël Pinson wrote:<br>
<br>
<br>
> One question about this:<br>
><br>
> > +<br>
> (***********************************************************************************<br>
> > + * Parameter ::= Parameter '=' Value |<br>
> > + * Parameter '+=' Value |<br>
> > + * Parameter '-=' Value |<br>
> > + * '!'* Parameter<br>
> > +<br>
> ***********************************************************************************)<br>
> > + let parameter = [ label "parameter" .<br>
> sto_to_com ]<br>
><br>
><br>
> What do you think about splitting the values from the<br>
> parameter names in<br>
> the tree ?<br>
><br>
> I thought about that, too. I stayed with a very simple description of<br>
> it so far, because I'm not sure how to represent the different<br>
> attributions. Something like:<br>
><br>
> Defaults param1="value1", param2+="value2", param3-="value3", !param4<br>
><br>
> could become<br>
><br>
> { "Defaults"<br>
> { "parameter"<br>
> { "name" = "param1" }<br>
> { "type" = "=" }<br>
> { "value" = "value1" } }<br>
> { "parameter"<br>
> { "name" = "param2" }<br>
> { "type" = "+=" }<br>
> { "value" = "value2" } }<br>
> { "parameter"<br>
> { "name" = "param3" }<br>
> { "type" = "-=" }<br>
> { "value" = "value3" } }<br>
> { "parameter"<br>
> { "name" = "param4" }<br>
> { "negate" = "!" } } }<br>
<br>
</div></div>I would turn it into<br>
<br>
{ "Defaults"<br>
{ "parameter"<br>
{ "name" = "param1" }<br>
{ "value" = "value1" } }<br>
{ "parameter"<br>
{ "add" }<br>
{ "name" = "param2" }<br>
{ "value" = "value2" } }<br>
{ "parameter"<br>
{ "remove" }<br>
{ "name" = "param3" }<br>
{ "value" = "value3" } }<br>
{ "parameter"<br>
{ "negate" }<br>
<div class="Ih2E3d"> { "name" = "param4" }<br>
{ "negate" = "!" } } }<br>
</div></blockquote><div><br><br>Actually, I think it would be much easier to parse if this syntax could be turned into a <br><br>{ "parameter" <br> { "negate" = "false" }<br> { "action" = "remove" }<br>
{ "name" = "param3" }<br> { "value" = "value3" } }<br>{ "parameter"<br> { "negate" = "true" }<br> { "name" = "param4" } }<br>
<br><br>I've had this need before, and just worked around it. Basically, the need would be for a "value"keyword in the ML implementation, which would be to "store" what "label" is to "key", so we could write things like :<br>
<br><br>let action_gen (val:string) (kw:string)<br> = [ label "action" . del kw kw . value val ]<br><br>let action = action_gen "set" "="<br> | action_gen "add" "+="<br>
| action_gen "remove" "-="<br><br>let negate = [ label "negate" . ( del /(!{2})*/ "" . value "false" | del /!(!{2}*/ "!" . value "true" ) ]<br>
<br>let parameter = [ label "parameter" . negate<br> . [ label "name" . store /whatever/ ]<br> . ( action . [ label "value" . store /whatever/ ] )? ]<br>
<br><br><br>I guess the biggest issue with a "value" command is the reversibility of it. The lens checker would have to make sure that it can be reversed, and I have no idea how much work that means has to be done.<br>
<br>For now, I think sudoers users won't mind typing things like :<br><br>set /files/etc/sudoers/Defaults/parameter 'env_keep+="APT_CONFIG DEBIAN_FRONTEND SHELL"'<br><br>instead of <br><br>set /files/etc/sudoers/Defaults/parameter/negate "false"<br>
set /files/etc/sudoers/Defaults/parameter/name "env_keep"<br>set /files/etc/sudoers/Defaults/parameter/action "add"<br>set /files/etc/sudoers/Defaults/parameter/value '"APT_CONFIG DEBIAN_FRONTEND SHELL"'<br>
<br><br><br>Not to mention that "action" actually has to be set between "name" and "value" imo, otherwise it will be ignored by augeas for not being in the right position.<br><br>Raphaël<br></div>
</div></div>