| #!/usr/bin/env python3 |
| import sys |
| import logging |
| from MassPnfSim import MassPnfSim, get_parser |
| |
| if __name__ == '__main__': |
| parser = get_parser() |
| args = parser.parse_args() |
| log_lvl = getattr(logging, args.verbose.upper()) |
| |
| if sys.stdout.isatty(): |
| logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s') |
| else: |
| logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s') |
| |
| logger = logging.getLogger(__name__) |
| logger.setLevel(log_lvl) |
| MassPnfSim.log_lvl = log_lvl |
| |
| if args.subcommand is not None: |
| sim_routine = getattr(MassPnfSim(args), args.subcommand) |
| sim_routine() |
| else: |
| parser.print_usage() |