Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add option to read configuration from stdin #59

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

mpartio
Copy link
Contributor

@mpartio mpartio commented Nov 21, 2024

If configuration filename is a hyphen "-", we attempt to parse the input from stdin. This makes it possible to modify configuration files with linux command line tools and pipe the results to (for example) "anemoi-dataset create". Both linux pipes and input redirection is supported.

cat config.yaml | anemoi-datasets create - test.zarr
anemoi-datasets create - test.zarr < config.yaml

We attempt to read the contents using the supported parsers in the following order: yaml, json, toml.

If all parsers fail, an exception is raised.

If configuration filename is a hyphen "-", we attempt to parse
the input from stdin. This makes it possible to modify configuration files
with linux command line tools and pipe the results to (for example)
"anemoi-dataset create". Both linux pipes and input redirection is supported.

cat config.yaml | anemoi-datasets create - test.zarr
anemoi-datasets create - test.zarr < config.yaml

We attempt to read the contents using the supported parsers in the following
order: yaml, json, toml.

If all parsers fail, an exception is raised.
@FussyDuck
Copy link

FussyDuck commented Nov 21, 2024

CLA assistant check
All committers have signed the CLA.

@HCookie HCookie self-requested a review December 13, 2024 14:28
@b8raoult b8raoult merged commit a31d762 into ecmwf:develop Dec 13, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants