cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
954 stars 105 forks source link

Multiple config files aren't correctly merged #205

Closed JohelEGP closed 4 years ago

JohelEGP commented 4 years ago

As discussed at https://github.com/cheshirekow/cmake_format/pull/123#issuecomment-629718471.

cheshirekow commented 4 years ago

Seems to be working fine:

testconf-01.py:

with section("parse"):
  additional_commands = {
    "foo": {
      "pargs": 1,
      "kwargs" : {
        "BAR": 1,
        "BAZ": "*"
      }
    }
  }

testconf-02.py:

with section("parse"):
  additional_commands = {
    "bar": {
      "pargs": 1,
      "kwargs" : {
        "FOO": 1,
        "FUZ": "*"
      }
    }
  }

cmake-format --dump-config --config /tmp/testconf-01.py /tmp/testconf-02.py --no-help --no-default

with section("parse"):
  additional_commands = { 'bar': {'kwargs': {'FOO': 1, 'FUZ': '*'}, 'pargs': 1},
    'foo': {'kwargs': {'BAR': 1, 'BAZ': '*'}, 'pargs': 1}}

Can you provide a failing case.

JohelEGP commented 4 years ago

cmake-format --dump-config --config /tmp/testconf-01.py --config /tmp/testconf-02.py --no-help --no-default See the --config before the second file. I redundantly added them before each config file because I couldn't handle my ;-separated CMake lists correctly, but now I can remove the redundancy and have it work correctly. I can't call this a bug.

cheshirekow commented 4 years ago

Oh I see. To be honest I kind of regret allowing --config to take multiple arguments and I would prefer that it join together multiple instances the way you seem to have thought it would. Let's call this a feature request then:

Multiple --config instances on the command line are merged rather than overridden.