websoft9/apps/create.py
chendelin1982 77c26cd7d5 action
2022-02-14 15:51:25 +08:00

29 lines
No EOL
876 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python2
#!/usr/bin/env python3
#coding: utf-8
import os, io, sys, platform, shutil, urllib3, time, json
def ReadLists(filename):
if os.path.getsize(filename) == 0:
print("\n清单中没有项目!")
sys.exit()
else:
with open("./"+filename,mode='r',newline='') as f:
templists=list(f)
rlist=[]
for templist in templists:
rlist.append(templist.replace('\n',''))
return rlist
mylists=ReadLists("add")
# 批量处理创建项目文件夹issue
for mylist in mylists:
print("处理 "+mylist+" ...\n")
os.system("git clone --depth=1 https://github.com/Websoft9/ansible-template.git "+ mylist + "rm -rf ansible-template")
os.system("cd "+ mylist +" && rm -rf .git .github docs")
os.system("echo '' > add")
print("\n执行完成,并清空列表")