Skip to content

Commit

Permalink
Improve usability of transliteration CLI command.
Browse files Browse the repository at this point in the history
  • Loading branch information
scossu committed Jan 3, 2025
1 parent 031eb4b commit 2c04c28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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

Expand Down
15 changes: 4 additions & 11 deletions sscli
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand All @@ -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:
Expand Down

0 comments on commit 2c04c28

Please sign in to comment.