#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
This script simply uses the Manager class to extract the settings of a simulation.
'''

import argparse
import json

from hateno.manager import Manager
from hateno.utils import utils

def addArguments(parser):
	parser.add_argument('simulation_id', type = str, help = 'identifier of the simulation (name or hashed settings)')

def main(args):
	folder = utils.findFolder()

	if folder is None:
		print('No Hateno folder found')
		return

	with Manager(folder) as manager:
		settings = manager.settingsOf(args.simulation_id)
		print(json.dumps(settings, indent = '\t'))

if __name__ == '__main__':
	parser = argparse.ArgumentParser(description = 'Extract the settings of a simulation.')
	addArguments(parser)
	main(parser.parse_args())
