blob: fe6062637adf112ecc386151d2ba6ace69e42e08 [file] [log] [blame]
TamasBakaid38feb62019-02-28 09:06:19 +00001#!/usr/bin/env python3
TamasBakaid38feb62019-02-28 09:06:19 +00002import sys
Bartek Grzybowski1f762342020-05-05 08:54:37 -07003import logging
Bartek Grzybowskic85faa42020-05-11 05:38:08 -07004from MassPnfSim import MassPnfSim, get_parser
TamasBakaid38feb62019-02-28 09:06:19 +00005
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -07006if __name__ == '__main__':
7 parser = get_parser()
8 args = parser.parse_args()
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -07009 log_lvl = getattr(logging, args.verbose.upper())
Bartek Grzybowski6a09dd62020-05-08 04:39:22 -070010
Bartek Grzybowskic85faa42020-05-11 05:38:08 -070011 if sys.stdout.isatty():
12 logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
13 else:
14 logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')
15
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -070016 logger = logging.getLogger(__name__)
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -070017 logger.setLevel(log_lvl)
18 MassPnfSim.log_lvl = log_lvl
TamasBakaid38feb62019-02-28 09:06:19 +000019
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -070020 if args.subcommand is not None:
Bartek Grzybowski950cbad2020-05-11 06:00:00 -070021 sim_routine = getattr(MassPnfSim(args), args.subcommand)
22 sim_routine()
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -070023 else:
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -070024 parser.print_usage()