# HG changeset patch # User Matti Hamalainen # Date 1621935635 -10800 # Node ID 4cbefe4c6f53d5ecca395f2b4b80fdc70f864231 # Parent 34755af2ea1f50f8edbf95cef94b869ea73a6637 Improve help, list the default Ptr format strings for each mode. diff -r 34755af2ea1f -r 4cbefe4c6f53 lxmldump.py --- a/lxmldump.py Tue May 25 12:40:03 2021 +0300 +++ b/lxmldump.py Tue May 25 12:40:35 2021 +0300 @@ -250,7 +250,7 @@ optparser = argparse.ArgumentParser( description="lxmldump - Dump ISO/FDIS 1951 XML file data", usage="%(prog)s [options] ", - epilog="\n\n" + add_help=False ) optparser.add_argument("filenames", @@ -258,6 +258,11 @@ metavar="filename", help="XML filename(s)") +optparser.add_argument("-h", "--help", + dest="show_help", + action="store_true", + help="show this help message and exit") + optparser.add_argument("-d", "--dump", dest="mode", action="store_const", const=PKK_MODE_DUMP, default=PKK_MODE_NORMAL, @@ -299,8 +304,14 @@ ### Show help if needed pkk_cfg = optparser.parse_args() -if len(pkk_cfg.filenames) == 0: +if len(pkk_cfg.filenames) == 0 or pkk_cfg.show_help: optparser.print_help() + + print(u"\nDefault Ptr format strings per mode:") + for pmode in pkk_modes_list: + if pmode in pkk_ptr_url_fmt: + print(u" {:6s} : \"{}\"".format(pkk_modes_list[pmode], pkk_ptr_url_fmt[pmode])) + print(u"") sys.exit(0)