Sarcasm / compdb

The compilation database Swiss army knife
MIT License
292 stars 23 forks source link

Allow writing file from command line aguments #14

Closed avalonwilliams closed 5 years ago

avalonwilliams commented 5 years ago

Currently to write a compile_commands.json from the output of the command you have to do this:

compdb -p build/ list > compile_commands.json

While this is fine for just using the plain CLI, it is problematic for automating the process in programs that do not use the shell, but call the program directly.

I think that there should be a command line option to write the output to a file, not to stdout, so writing compile_commands.json could be like this:

compdb -o compile_commands.json -p build/ list
jbree commented 5 years ago

Is the issue you're seeing using compdb in a Makefile related to this?

https://stackoverflow.com/questions/11755312/redirecting-stdout-and-stderr-inside-a-makefile-rule

avalonwilliams commented 5 years ago

No, using it in a Makefile is fine, however, the problem is mostly with compatibility with certain plugins/ides that don't execute the command in /bin/sh or similar, but call the executable directly.

Sarcasm commented 5 years ago

Fixed in https://github.com/Sarcasm/compdb/commit/43a3455fc949e630cfb7a00a44cfdc7f08840924.

Thanks for the suggestion.