Untitled
plain_text
2 months ago
449 B
1
Indexable
Never
import json, sys from pprint import pprint cli_args = sys.argv file_name = cli_args[1] docker_image = cli_args[2] with open(file_name, 'r') as data_file: data = json.load(data_file) data_file.close() data[0]['image'] = docker_image with open(file_name, 'w+') as data_file: json.dump(data, data_file, indent=2, sort_keys=True) data_file.close() pprint('Docker image in file ' + file_name + ' has been updated to ' + docker_image)