* Improved command line usage help.
authorUrban Wallasch <urban.wallasch@freenet.de>
Wed, 23 Jun 2021 16:20:52 +0000 (18:20 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Wed, 23 Jun 2021 16:20:52 +0000 (18:20 +0200)
README.md
jiten-pai.py
kanjidic.py

index af079628514fe2cedf4995a29d08e41796dd2b2a..a19098cd3f5bd8f914eed2fdc0e3cfaba9d2fa78 100644 (file)
--- a/README.md
+++ b/README.md
@@ -83,6 +83,27 @@ dictionary copyright information and licensing terms.
     will not be available.
 
 
+## Command Line
+
+Jiten-pai supports a few command line options which might come in handy
+for workflow integration.  They should be fairly self explaining:
+```
+    usage: jiten-pai.py [-h] [-k] [-c] [-v] [-l KANJI] [-w WORD]
+
+    Jiten-pai Japanese dictionary
+
+    optional arguments:
+      -h, --help                      show this help message and exit
+      -k, --kanjidic                  start with KanjiDic
+      -c, --clip-kanji                look up kanji from clipboard
+      -v, --clip-word                 look up word from clipboard
+      -l KANJI, --kanji-lookup KANJI  look up KANJI in kanji dictionary
+      -w WORD, --word-lookup WORD     look up WORD in word dictionary
+
+    Only one of these options should be used at a time.
+```
+
+
 ## Known issues
 
 * *TBD*
index adb94d751b148dfb78563c57b3fa2840fe1383c3..0eebdd315701114440570566c5337db2b55f2fab 100755 (executable)
@@ -1463,15 +1463,15 @@ def dict_lookup(dict_fname, pattern, mode, limit=0):
 
 def _parse_cmdline():
     parser = ArgumentParser(
-        formatter_class=RawTextHelpFormatter,
+        formatter_class=lambda prog: RawTextHelpFormatter(prog, max_help_position=40),
         description='Jiten-pai Japanese dictionary',
-        epilog='\n'
+        epilog='Only one of these options should be used at a time.\n'
     )
     parser.add_argument('-k', '--kanjidic', action='count', help='start with KanjiDic')
     parser.add_argument('-c', '--clip-kanji', action='count', help='look up kanji from clipboard')
+    parser.add_argument('-v', '--clip-word', action='count', help='look up word from clipboard')
     parser.add_argument('-l', '--kanji-lookup', metavar='KANJI', help='look up KANJI in kanji dictionary')
     parser.add_argument('-w', '--word-lookup', metavar='WORD', help='look up WORD in word dictionary')
-    parser.add_argument('-v', '--clip-word', action='count', help='look up word from clipboard')
     return parser.parse_args()
 
 def main():
index 4075e9e0b3ed923ad788fb521abebd2c280425da..af1037598b61226031add9317bb124797b2575f9 100755 (executable)
@@ -895,9 +895,9 @@ class kdMainWindow(QDialog):
 
 def _parse_cmdline():
     parser = ArgumentParser(
-        formatter_class=RawTextHelpFormatter,
+        formatter_class=lambda prog: RawTextHelpFormatter(prog, max_help_position=40),
         description='Jiten-pai kanji dictionary',
-        epilog='\n'
+        epilog='Only one of these options should be used at a time.\n'
     )
     parser.add_argument('-c', '--clip-kanji', action='count', help='look up kanji from clipboard')
     parser.add_argument('-l', '--kanji-lookup', metavar='KANJI', help='look up KANJI in kanji dictionary')