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

feat: implement multiline support #51

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aurelien-brabant
Copy link
Contributor

@aurelien-brabant aurelien-brabant commented Jul 6, 2024

Last one I swear, but I need this xD

This implements multi line support through two different delimiters, fixes #24

  • \ is used a posix shell-like multi line delimiter, it preserves leading spaces and trims trailing ones. Line breaks are ignored.
  • > ignores all leading and trailing space characters, allowing for arbitrary indentation that is not to be handled by the program. Line breaks are replaced by a single space.

See example config and test cases for actual examples :)


line = trim(line);
line = shouldPreverseLeadingWhitespace ? line.substr(0, line.find_last_not_of(MULTILINE_SPACE_CHARSET) + 1) : trim(line);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if line.find_last_not_of(MULTILINE_SPACE_CHARSET) returns std::string::npos

@@ -562,6 +568,35 @@ CParseResult CConfig::parseLine(std::string line, bool dynamic) {
if (ISVARIABLE)
return parseVariable(LHS, RHS, dynamic);

auto lastChar = RHS[RHS.size() - 1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.at

@alba4k
Copy link

alba4k commented Aug 18, 2024

is op still alive? @aurelien-brabant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for multi-line config values
3 participants