changeset 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
files lxmldump.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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)