dnscontrol icon indicating copy to clipboard operation
dnscontrol copied to clipboard

DOCS: Trailing commas

Open cafferata opened this issue 1 year ago • 3 comments

Another trick is to close your D() with END):

D("foo.com", ...
    A(...),
    A(...),
    A(...),
END)

END is just an alias for {}, which is ignored by DNSControl. However it makes a comma on the previous line required, like all other lines.

Cool! I didn't know this and it was always a small frustration. Maybe something to document as tips and tricks?

Originally posted by @cafferata in https://github.com/StackExchange/dnscontrol/issues/2848#issuecomment-1962488254

cafferata avatar Feb 24 '24 18:02 cafferata

Additional question, when do we choose to provide the code examples with END and when not? Currently both are used.

  • Code example with the END constant. https://docs.dnscontrol.org/language-reference/domain-modifiers/ignore#typical-usage
  • Code example without the END constant. https://docs.dnscontrol.org/language-reference/domain-modifiers/a

cafferata avatar Feb 24 '24 19:02 cafferata

Excellent points!

I think it would serve the community best if we made END) the default. It isn't required, of course, but it just makes everything so much easier.

Here are the cleanups needed:

  • Change any code examples to use END
  • Change get-zones to output END statements (working on this in https://github.com/StackExchange/dnscontrol/pull/2849)
  • And, of course, somewhere we should explain END) vs ) and its benefits (and let people know that it is optional. I could imagine people seeing plain ) and be confused. (As you pointed out in your comment)

I'm working on get-zone. Would you be interested in the others?

tlimoncelli avatar Feb 26 '24 17:02 tlimoncelli

Would you be interested in the others?

Yes, certainly! This documentation advocate will work on it 🤓

cafferata avatar Feb 26 '24 19:02 cafferata