comparison lxmldump.py @ 73:4e27677ca5a9

More work on help.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Dec 2021 10:35:59 +0200
parents 0849d65fabce
children f1fd5a53c341
comparison
equal deleted inserted replaced
72:0849d65fabce 73:4e27677ca5a9
552 ### Parse arguments 552 ### Parse arguments
553 optparser = pkk_get_argparser() 553 optparser = pkk_get_argparser()
554 pkk_cfg = optparser.parse_args() 554 pkk_cfg = optparser.parse_args()
555 555
556 if pkk_cfg.list_values: 556 if pkk_cfg.list_values:
557 print(u"\nAvailable output modes:") 557 if pkk_cfg.mode in [PKK_MODE_NORMAL, PKK_MODE_ANKI]:
558 print(" " + ", ".join(pkk_modes_list.values())) 558 print(u"Available format strings and values (mode '{}'):".format(
559 559 pkk_modes_list[pkk_cfg.mode]))
560 if pkk_cfg.mode not in [PKK_MODE_NORMAL, PKK_MODE_ANKI]: 560
561 pkk_cfg.mode = PKK_MODE_NORMAL 561 for mid in pkk_mode_defaults:
562 562 stmp = pkk_get_value(mid).replace("\\", "\\\\").replace("\n", "\\n")
563 print(u"\nAvailable format strings and values (mode '{}'):".format( 563 print(u" {:22s} : '{}'".format(mid, stmp))
564 pkk_modes_list[pkk_cfg.mode])) 564 else:
565 565 print(u"Mode '{}' does not use format strings.".format(
566 for mid in pkk_mode_defaults: 566 pkk_modes_list[pkk_cfg.mode]))
567 stmp = pkk_get_value(mid).replace("\\", "\\\\").replace("\n", "\\n")
568 print(u" {:22s} : '{}'".format(mid, stmp))
569 567
570 sys.exit(0) 568 sys.exit(0)
571 569
572 elif len(pkk_cfg.filenames) == 0: 570 elif len(pkk_cfg.filenames) == 0:
573 optparser.print_help() 571 optparser.print_help()