open-simulation-platform / cosim-cli

Command-line interface for libcosim
https://open-simulation-platform.github.io/cosim
Mozilla Public License 2.0
10 stars 4 forks source link

Return model information as xml or json text when "cse inspect" is called #43

Open kevinksyTRD opened 4 years ago

kevinksyTRD commented 4 years ago

Hi,

It will be nice if the cse inspect command returns the model information as xml or json text. It makes it very easy for the external software to retrieve the model information.

Kevin

kyllingstad commented 4 years ago

I agree, this is something we really need. The default should probably remain a "human readable" format, but we can add a --json option to switch to JSON output.

Note that the current human readable output is actually also machine readable – it's YAML. :)

kevinksyTRD commented 4 years ago

If I am not wrong, the cli did not give any output to the function when it was run on a python script. So I assumed, it only prints out the output on the screen. Is that right?

kyllingstad commented 4 years ago

It prints the information to its standard output stream. So if you are running it from Python, you can get the output by using the subprocess.check_output() function.

By the way, please don't use email to reply to GitHub comments. That feature doesn't work very well and creates a lot of noise.

kevinksyTRD commented 4 years ago

This already solved a lot. YAML parsing is not difficult at all. So this feature doesn't need to be prioritized.