diff options
Diffstat (limited to 'lib/python/qmk/cli/chibios/confmigrate.py')
-rw-r--r-- | lib/python/qmk/cli/chibios/confmigrate.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/python/qmk/cli/chibios/confmigrate.py b/lib/python/qmk/cli/chibios/confmigrate.py index 9d2548858..3e348b2b0 100644 --- a/lib/python/qmk/cli/chibios/confmigrate.py +++ b/lib/python/qmk/cli/chibios/confmigrate.py | |||
@@ -111,6 +111,7 @@ def migrate_mcuconf_h(to_override, outfile): | |||
111 | @cli.argument('-r', '--reference', type=normpath, arg_only=True, help='Specify the reference file to compare against') | 111 | @cli.argument('-r', '--reference', type=normpath, arg_only=True, help='Specify the reference file to compare against') |
112 | @cli.argument('-o', '--overwrite', arg_only=True, action='store_true', help='Overwrites the input file during migration.') | 112 | @cli.argument('-o', '--overwrite', arg_only=True, action='store_true', help='Overwrites the input file during migration.') |
113 | @cli.argument('-d', '--delete', arg_only=True, action='store_true', help='If the file has no overrides, migration will delete the input file.') | 113 | @cli.argument('-d', '--delete', arg_only=True, action='store_true', help='If the file has no overrides, migration will delete the input file.') |
114 | @cli.argument('-f', '--force', arg_only=True, action='store_true', help='Re-migrates an already migrated file, even if it doesn\'t detect a full ChibiOS config.') | ||
114 | @cli.subcommand('Generates a migrated ChibiOS configuration file, as a result of comparing the input against a reference') | 115 | @cli.subcommand('Generates a migrated ChibiOS configuration file, as a result of comparing the input against a reference') |
115 | def chibios_confmigrate(cli): | 116 | def chibios_confmigrate(cli): |
116 | """Generates a usable ChibiOS replacement configuration file, based on a fully-defined conf and a reference config. | 117 | """Generates a usable ChibiOS replacement configuration file, based on a fully-defined conf and a reference config. |
@@ -142,19 +143,19 @@ def chibios_confmigrate(cli): | |||
142 | 143 | ||
143 | eprint('--------------------------------------') | 144 | eprint('--------------------------------------') |
144 | 145 | ||
145 | if "CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"]: | 146 | if cli.args.input.name == "chconf.h" and ("CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"] or cli.args.force): |
146 | migrate_chconf_h(to_override, outfile=sys.stdout) | 147 | migrate_chconf_h(to_override, outfile=sys.stdout) |
147 | if cli.args.overwrite: | 148 | if cli.args.overwrite: |
148 | with open(cli.args.input, "w") as out_file: | 149 | with open(cli.args.input, "w") as out_file: |
149 | migrate_chconf_h(to_override, outfile=out_file) | 150 | migrate_chconf_h(to_override, outfile=out_file) |
150 | 151 | ||
151 | elif "HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"]: | 152 | elif cli.args.input.name == "halconf.h" and ("HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"] or cli.args.force): |
152 | migrate_halconf_h(to_override, outfile=sys.stdout) | 153 | migrate_halconf_h(to_override, outfile=sys.stdout) |
153 | if cli.args.overwrite: | 154 | if cli.args.overwrite: |
154 | with open(cli.args.input, "w") as out_file: | 155 | with open(cli.args.input, "w") as out_file: |
155 | migrate_halconf_h(to_override, outfile=out_file) | 156 | migrate_halconf_h(to_override, outfile=out_file) |
156 | 157 | ||
157 | elif "MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"]: | 158 | elif cli.args.input.name == "mcuconf.h" and ("MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"] or cli.args.force): |
158 | migrate_mcuconf_h(to_override, outfile=sys.stdout) | 159 | migrate_mcuconf_h(to_override, outfile=sys.stdout) |
159 | if cli.args.overwrite: | 160 | if cli.args.overwrite: |
160 | with open(cli.args.input, "w") as out_file: | 161 | with open(cli.args.input, "w") as out_file: |