2020-11-14 13:44:35 +08:00
|
|
|
import click
|
|
|
|
|
from generate_ta import generate_ta_from_D
|
|
|
|
|
from file_object import TaFileObject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.group()
|
|
|
|
|
def cli():
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 注意d_files和s_files中文件名的顺序
|
|
|
|
|
@click.command()
|
|
|
|
|
@click.option("--s_files", help="s文件。以;分割")
|
|
|
|
|
@click.option("--d_files", help="d文件。以;分割")
|
|
|
|
|
@click.option("--ta_file", help="生成的Ta文件")
|
|
|
|
|
def generate_ta_file(s_files: str, d_files: str, ta_file: str):
|
|
|
|
|
s_files_list = s_files.split(",")
|
|
|
|
|
d_files_list = d_files.split(",")
|
|
|
|
|
generate_ta_from_D(ta_file, s_files_list, d_files_list)
|
|
|
|
|
print("生成Ta文件:{ta_file}".format(ta_file=ta_file))
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 将Ta文件里程同步到S文件中
|
|
|
|
|
@click.command()
|
|
|
|
|
@click.option("--s_files", help="s文件。以;分割")
|
|
|
|
|
@click.option("--ta_file", help="Ta文件")
|
|
|
|
|
def sync_all_tower_mileage_to_s(s_files: str, ta_file: str):
|
|
|
|
|
s_files_list = s_files.split(",")
|
|
|
|
|
ta_object = TaFileObject(ta_file, s_files_list)
|
|
|
|
|
ta_object.sync_all_tower_mileage_to_s()
|
2020-11-14 16:21:08 +08:00
|
|
|
print("同步TA文件中里程到S文件")
|
2020-11-14 13:44:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# 将Ta文件塔高同步到S文件中
|
|
|
|
|
@click.command()
|
|
|
|
|
@click.option("--s_files", help="s文件。以;分割")
|
|
|
|
|
@click.option("--ta_file", help="Ta文件")
|
|
|
|
|
def sync_all_tower_height_from_TA_to_S(s_files: str, ta_file: str):
|
|
|
|
|
s_files_list = s_files.split(",")
|
|
|
|
|
ta_object = TaFileObject(ta_file, s_files_list)
|
|
|
|
|
ta_object.sync_all_tower_height_from_TA_to_S(prompt=False)
|
2020-11-14 16:21:08 +08:00
|
|
|
print("同步TA文件中塔高到S文件")
|
2020-11-14 13:44:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# @click.command()
|
|
|
|
|
# @click.option('--count', default=1, help='Number of greetings.')
|
|
|
|
|
# @click.option('--name', prompt='Your name',
|
|
|
|
|
# help='The person to greet.')
|
|
|
|
|
# def hello(count, name):
|
|
|
|
|
# """Simple program that greets NAME for a total of COUNT times."""
|
|
|
|
|
# for x in range(count):
|
|
|
|
|
# click.echo('Hello %s!' % name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cli.add_command(generate_ta_file)
|
|
|
|
|
cli.add_command(sync_all_tower_mileage_to_s)
|
|
|
|
|
cli.add_command(sync_all_tower_height_from_TA_to_S)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
cli()
|