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

Fix handling of --dump-config when there is no existing config file and when the existing config file is empty #117

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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