linux yaml validator command line 1

linux yaml validator command line

python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < cfg.yaml

Here is what the above code is Doing:
1. We're using the -c flag to tell Python to execute the code that follows.
2. We're importing the yaml and sys modules.
3. We're using the yaml.safe_load() function to load the YAML file.
4. We're using the sys.stdin function to read the YAML file.
5. We're using the < operator to redirect the contents of the YAML file into the Python script.

Similar Posts