mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Also the instructions on customizing `pre-commit`'s behaviour have been updated to use the `--config` option.
29 lines
705 B
Python
Executable File
29 lines
705 B
Python
Executable File
#!/bin/env python3
|
|
|
|
"""cross platform wrapper around codeql generate query-help to check .qhelp files
|
|
|
|
This takes care of:
|
|
* providing a temporary directory to --output
|
|
* turning .inc.qhelp arguments into their containing directory
|
|
"""
|
|
|
|
import pathlib
|
|
import tempfile
|
|
import sys
|
|
import subprocess
|
|
|
|
def transform_input(arg):
|
|
arg = pathlib.Path(arg)
|
|
if arg.suffixes == ['.inc', '.qhelp']:
|
|
return str(arg.parent)
|
|
return str(arg)
|
|
|
|
cmd = ["codeql", "generate", "query-help", "--format=markdown"]
|
|
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
cmd += [f"--output={tmp}", "--"]
|
|
cmd.extend(transform_input(x) for x in sys.argv[1:])
|
|
res = subprocess.run(cmd)
|
|
|
|
sys.exit(res.returncode)
|