Generate true/false for _DEFAULT_ON options (#22829)
This commit is contained in:
parent
ee3540e8df
commit
71257e21e6
3 changed files with 50 additions and 48 deletions
|
@ -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':
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue