Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make method for getting the executable public #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lauszus
Copy link

@Lauszus Lauszus commented Sep 11, 2024

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_styles_path = importlib.resources.files("mylib.utils").joinpath(".clang-format")
    clang_format_cmd = [
        clang_format_exe,
        f"--style=file:{clang_format_styles_path}",
        cmd,
    ]
    subprocess.check_call(
        " ".join(clang_format_cmd),
        shell=True,
    )

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,
        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant