1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-04 18:07:38 +00:00
MarlinFirmware/buildroot/bin/opt_set

26 lines
575 B
Plaintext
Raw Normal View History

2024-10-19 09:55:04 +00:00
#!/usr/bin/env python
2024-10-19 09:55:04 +00:00
import sys, os, config
2024-10-19 09:55:04 +00:00
def main():
args = sys.argv[1:]
if len(args) % 2 != 0:
print("ERROR: Please provide pairs of <name> <value>")
return
2024-10-19 09:55:04 +00:00
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()