1
0
Fork 0

Generate true/false for _DEFAULT_ON options (#22829)

This commit is contained in:
Joel Challis 2024-01-06 13:16:23 +00:00 committed by GitHub
parent ee3540e8df
commit 71257e21e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 48 deletions

View file

@ -108,6 +108,8 @@ def generate_config_items(kb_info_json, config_h_lines):
elif key_type.startswith('array'):
config_h_lines.append(generate_define(config_key, f'{{ {", ".join(map(str, config_value))} }}'))
elif key_type == 'bool':
config_h_lines.append(generate_define(config_key, 'true' if config_value else 'false'))
elif key_type == 'flag':
if config_value:
config_h_lines.append(generate_define(config_key))
elif key_type == 'mapping':

View file

@ -513,7 +513,7 @@ def _config_to_json(key_type, config_value):
else:
return list(map(str.strip, config_value.split(',')))
elif key_type == 'bool':
elif key_type in ['bool', 'flag']:
if isinstance(config_value, bool):
return config_value
return config_value in true_values