You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
import os,sys |
|
from auto_sliceing_operate import main_begin_sliceing |
|
from download_batch_data import main_download_batch_data_and_trans |
|
from auto_sliceing_operate import main_download_zip |
|
if __name__ == '__main__': |
|
# 根据参数决定执行哪个模块 |
|
# 命令映射表:命令名 -> 处理函数 |
|
command_handlers = { |
|
'batch_dwonload': main_download_batch_data_and_trans.main, |
|
'begin_sliceing': main_begin_sliceing.main, |
|
'download_zip': main_download_zip.main, |
|
} |
|
|
|
# 检查参数数量 |
|
if len(sys.argv) < 2: |
|
print('Usage: python main.py <command> <work_dir>') |
|
print('可用命令:', ' | '.join(command_handlers.keys())) |
|
sys.exit(1) |
|
|
|
command = sys.argv[1] |
|
|
|
# 检查命令是否存在 |
|
if command not in command_handlers: |
|
print(f'错误: 未知命令 "{command}"') |
|
print('可用命令:', ' | '.join(command_handlers.keys())) |
|
sys.exit(1) |
|
|
|
# 检查是否提供了 work_dir 参数 |
|
if len(sys.argv) < 3: |
|
print(f'Usage: python main.py {command} <work_dir>') |
|
sys.exit(1) |
|
|
|
work_dir = sys.argv[2] |
|
|
|
# 执行对应的处理函数 |
|
command_handlers[command](work_dir=work_dir) |