From cecc2288b47699ad101142c73d959a719667dd0c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 20 Jan 2018 00:10:03 +0800 Subject: bin/fg21sim: add --version argument, and log version information --- bin/fg21sim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/fg21sim b/bin/fg21sim index cce91dc..052c50e 100755 --- a/bin/fg21sim +++ b/bin/fg21sim @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- mode: python -*- # -# Copyright (c) 2016-2017 Weitian LI +# Copyright (c) 2016-2018 Weitian LI # MIT license """ @@ -14,6 +14,7 @@ import argparse import logging import time +import fg21sim from fg21sim.share import CONFIGS, COSMO from fg21sim.utils import setup_logging @@ -23,6 +24,8 @@ def main(): description="Simulate the radio foregrounds for 21cm EoR signal", epilog="Set environment variable 'DEBUG_FG21SIM=1' to force debug!") parser.add_argument("config", help="user configuration file") + parser.add_argument("-v", "--version", action="version", + version="%(prog)s: version "+fg21sim.__version__) parser.add_argument("-l", "--log", dest="loglevel", default=None, choices=["debug", "info", "warning", "error", "critical"], @@ -49,6 +52,7 @@ def main(): logfile=args.logfile) tool = os.path.basename(sys.argv[0]) logger = logging.getLogger(tool) + logger.info("FG21sim: version %s" % fg21sim.__version__) logger.info("COMMAND: {0}".format(" ".join(sys.argv))) # Save/backup current configurations -- cgit v1.2.2