Forráskód Böngészése

Improve usability of transliteration CLI command.

scossu 5 hónapja
szülő
commit
2c04c28389
2 módosított fájl, 13 hozzáadás és 13 törlés
  1. 9 2
      README.md
  2. 4 11
      sscli

+ 9 - 2
README.md

@@ -114,8 +114,9 @@ the drop-down automatically. The value must be one of the keys found in
 ## Command-line interface
 
 Various Scriptshifter commands can be accessed via the shell command `sscli`.
-At the moment only a few essential admin and testing tools are available. More
-commands can be made avaliable on an as-needed basis.
+At the moment a few essential admin and testing tools are available, as well as
+a transliteration function. More commands can be made available on an as-needed
+basis.
 
 Help menu:
 
@@ -129,6 +130,12 @@ Section help:
 /path/to/sscli admin --help
 ```
 
+Transliteration:
+
+```
+echo "王正强" | /path/to/sscli trans chinese -c first -o "marc_field=100"
+```
+
 
 ## Contributing
 

+ 4 - 11
sscli

@@ -65,15 +65,9 @@ def samples(lang):
     return test_sample(lang)
 
 
-@cli.group(name="trans")
-def trans_grp():
-    """ Transliteration and transcription operations. """
-    pass
-
-
-@trans_grp.command()
-@click.argument("src", type=click.File("r"))
+@cli.command(name="trans")
 @click.argument("lang")
+@click.argument("src", type=click.File("r"), default="-")
 @click.option(
         "-c", "--capitalize", default=None,
         help="Capitalize output: `first`, `all`, ot none (the default).")
@@ -85,12 +79,11 @@ def trans_grp():
         help=(
             "Language=specific option. Format: key=value. Multiple -o entries "
             "are possible."))
-def transliterate(src, lang, t_dir, capitalize, option):
+def trans_(src, lang, t_dir, capitalize, option):
     """
     Transliterate text from standard input.
 
-    e.g.: `echo "王正强" | /path/to/sscli trans transliterate chinese
-    -o "marc_field=100"'
+    e.g.: `echo "王正强" | /path/to/sscli trans chinese -o "marc_field=100"'
     """
     options = {}
     for opt in option: