-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsscli
executable file
·74 lines (49 loc) · 1.42 KB
/
sscli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
__doc__ = """ Scriptshifter command line interface. """
import click
from glob import glob
from os import path
from scriptshifter import DB_PATH
from scriptshifter.tables import init_db as _init_db
from tests import test_sample
@click.group()
def cli():
""" Scriptshifter CLI. """
pass
@cli.group(name="admin")
def admin_grp():
""" Admin operations. """
pass
@admin_grp.command()
def init_db():
""" Initialize SS database. """
_init_db()
click.echo(f"Initialized Scriptshifter DB in {DB_PATH}")
@cli.group(name="test")
def test_grp():
""" Test operations. """
pass
@test_grp.command()
def list_samples():
""" List string sample sets that can be tested. """
path_ptn = path.join(
path.dirname(path.realpath(__file__)),
"tests", "data", "script_samples", "*.csv")
click.echo("Sample string sets available for batch testing:")
for fn in glob(path_ptn):
click.echo(path.splitext(path.basename(fn))[0])
@test_grp.command()
@click.argument("lang")
def samples(lang):
"""
Test sample strings for language LANG.
LANG must match one of the names obtained with `test list-samples` command.
The command will generate a test report file.
"""
return test_sample(lang)
@cli.group(name="trans")
def trans_grp():
""" Transliteration and transcription operations. """
pass
if __name__ == "__main__":
cli()