2024-10-19 09:55:04 +00:00
|
|
|
#!/usr/bin/env python
|
2016-03-22 14:13:38 +00:00
|
|
|
|
2024-10-19 09:55:04 +00:00
|
|
|
import sys, os, config
|
2019-12-20 03:03:42 +00:00
|
|
|
|
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
|
2018-05-16 03:22:03 +00:00
|
|
|
|
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()
|