# HG changeset patch # User Matti Hamalainen # Date 1639038959 -7200 # Node ID 4e27677ca5a98165b6eef0c424f897d979347777 # Parent 0849d65fabce8f1e6493976bd8ac35ad6d78c7c0 More work on help. diff -r 0849d65fabce -r 4e27677ca5a9 lxmldump.py --- a/lxmldump.py Thu Dec 09 10:31:50 2021 +0200 +++ b/lxmldump.py Thu Dec 09 10:35:59 2021 +0200 @@ -554,18 +554,16 @@ pkk_cfg = optparser.parse_args() if pkk_cfg.list_values: - print(u"\nAvailable output modes:") - print(" " + ", ".join(pkk_modes_list.values())) - - if pkk_cfg.mode not in [PKK_MODE_NORMAL, PKK_MODE_ANKI]: - pkk_cfg.mode = PKK_MODE_NORMAL + if pkk_cfg.mode in [PKK_MODE_NORMAL, PKK_MODE_ANKI]: + print(u"Available format strings and values (mode '{}'):".format( + pkk_modes_list[pkk_cfg.mode])) - print(u"\nAvailable format strings and values (mode '{}'):".format( - pkk_modes_list[pkk_cfg.mode])) - - for mid in pkk_mode_defaults: - stmp = pkk_get_value(mid).replace("\\", "\\\\").replace("\n", "\\n") - print(u" {:22s} : '{}'".format(mid, stmp)) + for mid in pkk_mode_defaults: + stmp = pkk_get_value(mid).replace("\\", "\\\\").replace("\n", "\\n") + print(u" {:22s} : '{}'".format(mid, stmp)) + else: + print(u"Mode '{}' does not use format strings.".format( + pkk_modes_list[pkk_cfg.mode])) sys.exit(0)