forked from networktocode/ntc-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.py
75 lines (61 loc) · 1.42 KB
/
cli.py
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
75
"""CLI for acitool."""
import click
from tests.test_development_scripts import (
build_parsed_data_from_dir,
build_parsed_data_from_output,
transform_file,
transform_glob,
)
@click.group()
def base():
"""Base entry for click."""
@click.command()
@click.option(
"-f",
"--file",
"file",
type=str,
help="File that you are targetting.",
)
def clean_yaml_file(file):
"""Transform a yaml file to expected output."""
transform_file(file)
@click.command()
@click.option(
"-f",
"--folder",
"folder",
type=str,
help="Folder that you are targetting.",
)
def clean_yaml_folder(folder):
"""Transform a yaml file to expected output to a folder."""
transform_glob(folder)
@click.command()
@click.option(
"-f",
"--file",
"file",
type=str,
help="File that you are targetting.",
)
def gen_yaml_file(file):
"""Generate a yaml file from raw a data file."""
build_parsed_data_from_output(file, "./tests/")
@click.command()
@click.option(
"-f",
"--folder",
"folder",
type=str,
help="Folder that you are targetting.",
)
def gen_yaml_folder(folder):
"""Generate a yaml file from folder of raw data files."""
build_parsed_data_from_dir(folder, "./tests/")
base.add_command(clean_yaml_file)
base.add_command(clean_yaml_folder)
base.add_command(gen_yaml_file)
base.add_command(gen_yaml_folder)
if __name__ == "__main__":
base()