1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-22 11:12:29 +00:00

Add more options to the command line

This commit is contained in:
J. Fernando Sánchez 2017-10-05 16:20:33 +02:00
parent ccc8e43416
commit e8988015e2

View File

@ -2,7 +2,7 @@ import importlib
import sys import sys
import os import os
__version__ = "0.9.3" __version__ = "0.9.4"
try: try:
basestring basestring
@ -27,6 +27,10 @@ def main():
help='python module containing the simulation configuration.') help='python module containing the simulation configuration.')
parser.add_argument('--module', '-m', type=str, parser.add_argument('--module', '-m', type=str,
help='file containing the code of any custom agents.') help='file containing the code of any custom agents.')
parser.add_argument('--dry-run', '--dry', action='store_true',
help='Do not store the results of the simulation.')
parser.add_argument('--output', '-o', type=str,
help='folder to write results to. It defaults to the current directory.')
args = parser.parse_args() args = parser.parse_args()
@ -34,8 +38,8 @@ def main():
sys.path.append(os.getcwd()) sys.path.append(os.getcwd())
importlib.import_module(args.module) importlib.import_module(args.module)
print('Loading config file: {}'.format(args.file)) print('Loading config file: {}'.format(args.file, args.output))
simulation.run_from_config(args.file) simulation.run_from_config(args.file, dump=(not args.dry_run), results_dir=args.output)
if __name__ == '__main__': if __name__ == '__main__':