mirror of
https://github.com/pim-n/pg-rad
synced 2026-03-11 19:58:11 +01:00
Add CLI entry point with --test flag for building test landscape using LandscapeDirector
This commit is contained in:
33
src/pg_rad/main.py
Normal file
33
src/pg_rad/main.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import argparse
|
||||||
|
|
||||||
|
from pg_rad.logger import setup_logger
|
||||||
|
from pg_rad.landscape import LandscapeDirector
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog="pg-rad",
|
||||||
|
description="Primary Gamma RADiation landscape tool"
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--test",
|
||||||
|
action="store_true",
|
||||||
|
help="Load and run the test landscape"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--loglevel",
|
||||||
|
default="INFO",
|
||||||
|
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
setup_logger(args.loglevel)
|
||||||
|
|
||||||
|
if args.test:
|
||||||
|
landscape = LandscapeDirector().build_test_landscape()
|
||||||
|
print(landscape.name)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user