Allow for reading from stdin and writing to stdout.
SanjayVas opened this issue · comments
addlicense
currently always modifies source files in-place. This makes it difficult to use in scripts or integrate into other formatting tools, such as the fix
Mercurial extension.
Since the filename is unknown when operating on content from stdin, this would entail adding an option to specify the filename to assume. For example, clang-format
has an --assume-filename
option for this purpose.
A workaround is to create a wrapper script that reads from stdin and writes to a temporary file with a specified basename. After addlicense
modifies this file in place, the script can print it to stdout.