Skip to content

Commit

Permalink
Fix handling of --dump-config when there is no existing config file a…
Browse files Browse the repository at this point in the history
…nd when the existing config file is empty
  • Loading branch information
mtkennerly committed Jun 29, 2019
1 parent 548b488 commit 7894a3e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake_format/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ def dump_config(args, config_dict, outfile):

outfmt = args.dump_config

if config_dict is None:
config_dict = {}

for key, value in vars(args).items():
if (key in configuration.Configuration.get_field_names()
and value is not None):
Expand Down Expand Up @@ -422,6 +425,8 @@ def main():
and value is not None):
config_dict[key] = value

if config_dict is None:
config_dict = {}
cfg = configuration.Configuration(**config_dict)
if args.in_place:
ofd, tempfile_path = tempfile.mkstemp(suffix='.txt', prefix='CMakeLists-')
Expand Down

0 comments on commit 7894a3e

Please sign in to comment.