The addition of the cdf-tk modules list --format json option is great, as we we have seen a desire to parse what modules exist in toolkit projects. Unfortunately, parsing the output of the command fails when the JSON output is preceded by warnings written to the same standard output stream.
Example:
$ cdf-tk modules list --format json | jq
parse error: Invalid numeric literal at line 1, column 10
$ cdf-tk modules list --format json | head
WARNING: Overriding environment variables with values from .env file...
In File '/home/ivartj/code/digital-twin/modules/valve_track/assets/raw/valvetrack-asset-data.Database.yaml'
* DuplicatedItemWarning: Duplicated item with identifier RawDatabaseId(name='raw_valvetrack-data') first seen in
'valvetrack-asset-data.Database.yaml'.
💡 HINT This is likely due to missing variable in the identifier when using the module 'assets' as a template.
In File '/home/ivartj/code/digital-twin/modules/valve_track/assets/raw/valvetrack-asset-data.Database.yaml'
* DuplicatedItemWarning: Duplicated item with identifier RawDatabaseId(name='raw_valvetrack-data') first seen in
'valvetrack-asset-data.Database.yaml'
Could warnings be written to standard error at least in cases where JSON output is expected?
The addition of the
cdf-tk modules list --format jsonoption is great, as we we have seen a desire to parse what modules exist in toolkit projects. Unfortunately, parsing the output of the command fails when the JSON output is preceded by warnings written to the same standard output stream.Example:
Could warnings be written to standard error at least in cases where JSON output is expected?