New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Allow inline comments #390
Comments
Thanks for the proposal. I have not checked whether we would be able to implement this while preserving sufficient compatibility with existing configuration files. Just let me highlight that logrotate is not the only program that does not support inline comments. See for example the syntax of Apache's configuration files: https://httpd.apache.org/docs/2.4/configuring.html#syntax |
A starting point would be diff --git a/config.c b/config.c
index 65b9262..1e9f3e7 100644
--- a/config.c
+++ b/config.c
@@ -161,7 +161,7 @@ static char *isolateLine(char **strt, char **buf, size_t length) {
start = *strt;
endtag = start;
- while (endtag < max && *endtag != '\n') {
+ while (endtag < max && *endtag != '\n' && *endtag != '#') {
endtag++;}
if (max < endtag)
return NULL; One would need to take special attention about configuration directives possible taking
and also within script definitions. |
@kdudka I'm not complaining, I think logrotate is great!!! Yeah programs like apache don't do inline comments (though nginx does 😉 😉 😉). Keep in mind that inline commenting is common because it's easier to read and neater, and I find it keeps git diffs cleaner. |
This is allowed:
This is not allowed:
The second form is just as common when documenting config files, and much neater to read and maintain.
Please consider supporting inline comments?
And... Thanks for this really great tool!
The text was updated successfully, but these errors were encountered: