conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] Allow multiline blocks and inline comments in profiles

Open perseoGI opened this issue 1 year ago • 0 comments

What is your suggestion?

Background

While editing a profile, it may be convenient to have the possibility to add a comment on the same line and not above or below the current line.

Also as there configurations that can potentially be really long in terms of a line of code, it may also be interesting to allow a bash like multiline support, ending in \ character.

E.g.

include(otherprofile)

[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos           # this is a comment

[conf]
tools.cmake.cmaketoolchain:extra_variables={'STR': 'string # value', \   # Another comment
                                            'NUM': 1.3, \                                                        # More comments! 
                                            'CMAKE_GENERATOR_INSTANCE': '${ENV}/buildTools/', \
                                            'SOME_DICT': {'value': '42 sense', 'cache': 'true', 'type': 'BOOL', 'docstring': 'test cache var'} \
                                            }

Considerations and caveats

Same as in bash or any other shell like emulator, the # character should only be interpreted as a beginning of a commentary if it is not inside of a string, thus between any quotation mark (' and ")

Also, backslash character \ should only be taken into consideration if it does not belong to the end of a Windows path, e.g. C:\\users\file\

A basic solution to avoid any problem with existing profiles with this form could be to only accept \ characters for multiline purposes if they have at least one space between the end of the line and the backslash.

Have you read the CONTRIBUTING guide?

  • [X] I've read the CONTRIBUTING guide

perseoGI avatar May 23 '24 12:05 perseoGI