您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
24 行
731 B
24 行
731 B
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import tempfile
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("files", nargs="*")
|
|
args = parser.parse_args()
|
|
|
|
with tempfile.TemporaryDirectory() as tempdir:
|
|
# Could potentially hit the commandline limit, so write files to a response file
|
|
# See https://github.com/dotnet/format/issues/699
|
|
resp_file = os.path.join(tempdir, "response.txt")
|
|
with open(resp_file, "w") as fp:
|
|
for f in args.files:
|
|
fp.write(f + "\n")
|
|
|
|
subprocess_args = ["dotnet", "format", "--folder", "--include", f"@{resp_file}"]
|
|
subprocess.check_call(subprocess_args)
|