Skip to content
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

Add support for line continuations (a.k.a. newline escapes) to config file parser #18

Open
mbuesch opened this issue Jan 5, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@mbuesch
Copy link
Owner

mbuesch commented Jan 5, 2025

Status Quo

Currently a key=value pair in the configuration files letmein.conf and letmeind.conf cannot span multiple lines.

Suggested enhancement

Allow line continuation by backslash-escaping of newlines.
Example:

[FOO]
bar=baz\
  biz

shall be equal to

[FOO]
bar=baz  biz

Care must be taken to not interpret continuation lines starting with # as comments.

[FOO]
bar=baz\
#  biz

shall be equal to

[FOO]
bar=baz#  biz

Pros

Long lines can be broken down and be made more readable. This could be especially useful for the [RESOURCES] section.

Cons

It is not fully compatible with existing configurations.
An existing configuration might use a literal backslash at the end of the line:

[NFTABLES]
exe = /foo/bar\

This would currently mean exe is equal to the string /foo/bar\.

However, this probably is only a theoretical problem.

Open questions

  • Should we support backslash-escaping at the end to support literal backslashes: bar=biz\\ would yield the value biz\
@mbuesch mbuesch added the enhancement New feature or request label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant