@@ -105,14 +105,14 @@ def validate_and_normalize_option(option):
105105 if 'command-line-only' not in option :
106106 option ['command-line-only' ] = False
107107 if 'brief' not in option :
108- raise ValueError (f'Option { option ["name" ]} must have a "brief" description' )
108+ raise ValueError (f'Option " { option ["name" ]} " must have a "brief" description' )
109109 if 'details' not in option :
110110 option ['details' ] = ''
111111 if 'type' not in option :
112112 option ['type' ] = 'string'
113113 if not is_valid_option_type (option ['type' ]):
114114 raise ValueError (
115- f'Option { option ["name" ]} has an invalid type { option ["type" ]} : It should be one of { get_valid_option_values ()} ' )
115+ f'Option " { option ["name" ]} " has an invalid type { option ["type" ]} : It should be one of { get_valid_option_values ()} ' )
116116 if option ['type' ] == 'enum' :
117117 if 'values' not in option :
118118 raise ValueError (f'Option "{ option ["name" ]} " is of type enum and must have "values"' )
@@ -541,7 +541,7 @@ def option_validation_snippet(option):
541541 validation_contents += f'// s.{ camel_name } is required and has no default value\n '
542542 validation_contents += f'if (s.{ camel_name } .empty())\n '
543543 validation_contents += f'{{\n '
544- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option is required"));'
544+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option is required"));'
545545 validation_contents += f'}}\n '
546546 validation_contents += f'else\n '
547547 validation_contents += f'{{\n '
@@ -592,30 +592,30 @@ def option_validation_snippet(option):
592592 if option ['must-exist' ]:
593593 validation_contents += f'if (!s.{ camel_name } .empty() && !files::exists(s.{ camel_name } ))\n '
594594 validation_contents += f'{{\n '
595- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path does not exist: {{}}", s.{ camel_name } ));\n '
595+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path does not exist: {{}}", s.{ camel_name } ));\n '
596596 validation_contents += f'}}\n '
597597 if option ['type' ] == 'file-path' :
598598 validation_contents += f'if (files::isDirectory(s.{ camel_name } ))\n '
599599 validation_contents += f'{{\n '
600- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path should be a regular file: {{}}", s.{ camel_name } ));\n '
600+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path should be a regular file: {{}}", s.{ camel_name } ));\n '
601601 validation_contents += f'}}\n '
602602 if option ['type' ] == 'dir-path' :
603603 validation_contents += f'if (!files::isDirectory(s.{ camel_name } ))\n '
604604 validation_contents += f'{{\n '
605- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path should be a directory: {{}}", s.{ camel_name } ));\n '
605+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path should be a directory: {{}}", s.{ camel_name } ));\n '
606606 validation_contents += f'}}\n '
607607 elif option ['type' ] in ['file-path' , 'dir-path' ]:
608608 validation_contents += f'if (files::exists(s.{ camel_name } ))\n '
609609 validation_contents += f'{{\n '
610610 if option ['type' ] == 'file-path' :
611611 validation_contents += f'if (files::isDirectory(s.{ camel_name } ))\n '
612612 validation_contents += f'{{\n '
613- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path should be a regular file: {{}}", s.{ camel_name } ));\n '
613+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path should be a regular file: {{}}", s.{ camel_name } ));\n '
614614 validation_contents += f'}}\n '
615615 if option ['type' ] == 'dir-path' :
616616 validation_contents += f'if (!files::isDirectory(s.{ camel_name } ))\n '
617617 validation_contents += f'{{\n '
618- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path should be a directory: {{}}", s.{ camel_name } ));\n '
618+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path should be a directory: {{}}", s.{ camel_name } ));\n '
619619 validation_contents += f'}}\n '
620620 validation_contents += f'}}\n '
621621
@@ -625,7 +625,7 @@ def option_validation_snippet(option):
625625 validation_contents += f'// s.{ camel_name } paths are required and have no default value\n '
626626 validation_contents += f'if (s.{ camel_name } .empty())\n '
627627 validation_contents += f'{{\n '
628- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option is required"));'
628+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option is required"));'
629629 validation_contents += f'}}\n '
630630 validation_contents += f'else\n '
631631 validation_contents += f'{{\n '
@@ -694,7 +694,7 @@ def option_validation_snippet(option):
694694 if option ['must-exist' ]:
695695 validation_contents += f' if (!files::exists(p))\n '
696696 validation_contents += f' {{\n '
697- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: path does not exist: {{}}", p));\n '
697+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: path does not exist: {{}}", p));\n '
698698 validation_contents += f' }}\n '
699699 if option ['command-line-sink' ] and 'filename-mapping' in option :
700700 validation_contents += f' auto f = files::getFileName(p);\n '
@@ -724,7 +724,7 @@ def option_validation_snippet(option):
724724 validation_contents += f'// s.{ camel_name } is required with no default value.'
725725 validation_contents += f'if (s.{ camel_name } .empty())\n '
726726 validation_contents += f'{{\n '
727- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option is required"));'
727+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option is required"));'
728728 validation_contents += f'}}\n '
729729 else :
730730 validation_contents += f'// s.{ camel_name } is not required and has no default value\n '
@@ -745,7 +745,7 @@ def option_validation_snippet(option):
745745 validation_contents += f'// s.{ camel_name } is required with no default value.'
746746 validation_contents += f'if (s.{ camel_name } .empty())\n '
747747 validation_contents += f'{{\n '
748- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option is required"));'
748+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option is required"));'
749749 validation_contents += f'}}\n '
750750 else :
751751 validation_contents += f'// s.{ camel_name } is not required and has no default value\n '
@@ -766,12 +766,12 @@ def option_validation_snippet(option):
766766 if 'min-value' in option :
767767 validation_contents += f'if (std::cmp_less(s.{ camel_name } , { option ["min-value" ]} ))\n '
768768 validation_contents += f'{{\n '
769- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: value is less than { option ["min-value" ]} : {{}}", s.{ camel_name } ));\n '
769+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: value is less than { option ["min-value" ]} : {{}}", s.{ camel_name } ));\n '
770770 validation_contents += f'}}\n '
771771 if 'max-value' in option :
772772 validation_contents += f'if (std::cmp_greater(s.{ camel_name } , { option ["max-value" ]} ))\n '
773773 validation_contents += f'{{\n '
774- validation_contents += f' return Unexpected(formatError("{ option ["name" ]} option: value is greater than { option ["max-value" ]} : {{}}", s.{ camel_name } ));\n '
774+ validation_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: value is greater than { option ["max-value" ]} : {{}}", s.{ camel_name } ));\n '
775775 validation_contents += f'}}\n '
776776
777777 contents += validation_contents
@@ -830,7 +830,7 @@ def generate_public_settings_cpp(config):
830830 for option in category ['options' ]:
831831 if not option ["command-line-only" ]:
832832 contents += f' // { option ["brief" ]} \n '
833- contents += f' io.mapOptional("{ option ["name" ]} ", s.{ to_camel_case (option ["name" ])} );\n '
833+ contents += f' io.mapOptional("` { option ["name" ]} ` ", s.{ to_camel_case (option ["name" ])} );\n '
834834 contents += ' }\n '
835835 contents += '};\n \n '
836836
@@ -1060,7 +1060,7 @@ def generate_public_toolargs_cpp(config):
10601060 option_contents += f' }}\n '
10611061 option_contents += f' else\n '
10621062 option_contents += f' {{\n '
1063- option_contents += f' return Unexpected(formatError("{ option ["name" ]} option: invalid value: {{}}", this->{ camel_name } ));\n '
1063+ option_contents += f' return Unexpected(formatError("` { option ["name" ]} ` option: invalid value: {{}}", this->{ camel_name } ));\n '
10641064 option_contents += f' }}\n '
10651065 else :
10661066 option_contents += f' s.{ camel_name } = this->{ camel_name } ;\n '
@@ -1149,7 +1149,7 @@ def to_cpp_default_value(option):
11491149 if option_default .startswith ('<' ):
11501150 closing_bracket = option_default .find ('>' )
11511151 if closing_bracket == - 1 :
1152- raise ValueError (f'Invalid default value { option_default } for option { option ["name" ]} ' )
1152+ raise ValueError (f'Invalid default value { option_default } for option ` { option ["name" ]} ` ' )
11531153 reference_path = option_default [1 :closing_bracket ]
11541154 if reference_path == 'config-dir' :
11551155 option_default = '.' + option_default [closing_bracket + 1 :]
0 commit comments