Skip to content

Instantly share code, notes, and snippets.

@thebabush
Last active June 10, 2020 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebabush/db1edf57769139bd1978787530c7ebe8 to your computer and use it in GitHub Desktop.
Save thebabush/db1edf57769139bd1978787530c7ebe8 to your computer and use it in GitHub Desktop.
bash/python one-liner to merge all compile_commands.json files in a directory tree
python3 -c 'import json; import glob; import itertools; print(json.dumps(list(itertools.chain(*[json.load(open(f, "rb")) for f in glob.glob("**/compile_commands.json", recursive=True)])), indent=4))' > ../compile_commands.json
@thebabush
Copy link
Author

thebabush commented Jun 10, 2020

note to self: do not redirect into a file in the current directory tree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment