代码拉取完成,页面将自动刷新
#!/usr/bin/env python3
import os
import sys
import argparse
import subprocess
path_list = ['shadowhook/src/main/cpp/include',
'shadowhook/src/main/cpp',
'shadowhook/src/main/cpp/arch/arm',
'shadowhook/src/main/cpp/arch/arm64',
'shadowhook/src/main/cpp/common',
'app/src/main/cpp/unittest',
'app/src/main/cpp/hookee',
'app/src/main/cpp/hookee2',
'systest/src/main/cpp']
suffix_tuple = ('.h', '.c')
def main():
parser = argparse.ArgumentParser(description='clang-format runner')
parser.add_argument('-n', '--dry-run', action='store_true', help='If set, do not actually make the formatting changes')
options = parser.parse_args()
dry_run = '-n ' if options.dry_run else ''
for path in path_list:
for filename in sorted(os.listdir(path)):
f = os.path.join(path, filename)
if os.path.isfile(f) and f.endswith(suffix_tuple):
cmd = 'clang-format ' + dry_run + '--Werror -i -style=file ' + f
ret = subprocess.run(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
retcode = ('' if ret.returncode == 0 else (' >>> return code: ' + str(ret.returncode)))
print('>>> ' + cmd + retcode)
print(ret.stdout, end='')
if __name__ == '__main__':
sys.exit(main())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。