eclipse-dash / dash-licenses

Extract license information from content.
http://projects.eclipse.org/projects/technology.dash
Eclipse Public License 2.0
47 stars 33 forks source link

Handling package-lock.json content via stdin #373

Open gomes89 opened 1 week ago

gomes89 commented 1 week ago

When attempting to pipe the contents of an NPM package-lock.json file into the tool via stdin, the tool does not process the data correctly. The current implementation appears to rely on the filename to determine file type, which does not work when content is provided through standard input.

Expected Behavior: The tool should be able to interpret the package-lock.json format correctly when the content is piped in, regardless of the absence of a filename.

Suggested Solution: Implement an option or flag (e.g., --format json or --stdin-type package-lock) that allows users to specify the format of the input when using stdin. This would force the tool to interpret the piped content in the specified format.

waynebeaton commented 1 week ago

The tool currently supports four different file format readers:

Selection of the format reader is entirely based on the file name.

Adding a parameter to force the tool read the input should encourage some additional generalisation in the code.