clang-format-wheel
clang-format-wheel copied to clipboard
Make method for getting the executable public
This is useful if one wants to call the executable in Python
For instance I use this to format my code like so:
def check_call_clang_format(cmd: str) -> None:
clang_format_exe = clang_format.get_executable("clang-format")
clang_format_sw_styles_path = importlib.resources.files("mylib.utils").joinpath(".clang-format")
clang_format_cmd = [
clang_format_exe,
f"--style=file:{clang_format_sw_styles_path}",
cmd,
]
subprocess.check_call(
" ".join(clang_format_cmd),
shell=True,
)