1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-01 23:58:33 +00:00
MarlinFirmware/buildroot/bin/opt_set
2024-10-19 04:55:04 -05:00

26 lines
575 B
Python
Executable File

#!/usr/bin/env python
import sys, os, config
def main():
args = sys.argv[1:]
if len(args) % 2 != 0:
print("ERROR: Please provide pairs of <name> <value>")
return
for i in range(0, len(args), 2):
name = args[i]
value = args[i + 1]
changed = False
for file in config.FILES:
if os.path.exists(file):
if config.set(file, name, value):
changed = True
if not changed:
config.add(config.FILES[0], name, value)
if __name__ == "__main__":
main()