aboutsummaryrefslogtreecommitdiffstats
path: root/mass-pnf-sim.py
diff options
context:
space:
mode:
Diffstat (limited to 'mass-pnf-sim.py')
-rwxr-xr-xmass-pnf-sim.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/mass-pnf-sim.py b/mass-pnf-sim.py
new file mode 100755
index 0000000..ce8cd73
--- /dev/null
+++ b/mass-pnf-sim.py
@@ -0,0 +1,24 @@
+#!/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.subcommand)
+ sim_routine(args)
+ else:
+ parser.print_usage()