YAMLStar CLI¶
The yaml command loads YAML and prints JSON by default. It can also emit YAML
with -Y.
Examples¶
Read from standard input and print compact JSON:
Load a file:
Pretty-print JSON:
Emit YAML:
Load every document in a YAML stream:
Emit every document in a YAML stream:
Evaluate a YAML string directly:
Write output to a file:
Options¶
Usage: yaml [options] [file]
Default: Read stdin, output compact JSON
Options:
-f, --file FILE Input file (or use positional arg)
-e, --eval YAML Evaluate YAML string
-J, --json Output pretty JSON
-Y, --yaml Output YAML
-o, --output FILE Output file
-s, --stream Output all documents
-d, --debug Debug all stages
-D, --debug-stage STAGE Debug specific stage: parse, compose, resolve,
construct
-S, --stack-trace Show full stack traces
-v, --version Print version
-h, --help Print help
-Y emits YAML using YAMLStar's dump stack:
native value
-> representer/represent
-> desolver/desolve
-> serializer/serialize
-> emitter/emit
-> YAML string
With -s, it emits all input documents as a YAML stream with document
separators.
Debugging¶
The CLI can show each loader stage. This is useful when developing the parser or investigating how a YAML document is interpreted:
yaml -D parse config.yaml
yaml -D compose config.yaml
yaml -D resolve config.yaml
yaml -D construct config.yaml
Use -d to run every debug stage.