night-config
night-config copied to clipboard
Support top-level comment
I am trying to write a header comment that appears before any of my config options. When I try to use a empty path in setComment
, it doesn't add the comment at all. It appears that currently I have to prepend the comment to the first entry.
Current use:
config.setComment("version", " Test Configuration\n To reset any value to it's default, remove the value from this file"
+ " The version of the test bench");
Proposed use:
// No path means this is the file's header comment
config.setComment(" Test Configuration\n To reset any value to it's default, remove the value from this file");
// Alternate proposal: use an empty path ""
config.setComment("", " Test Configuration\n To reset any value to it's default, remove the value from this file");
// Normal comment
config.setComment("version", " The version of the test bench");
example.toml
# Test Configuration
# To reset any value to it's default, remove the value from this file
# The version of the test bench
version="1.0.6"
[Debug]
verbose=true
test="complete"