osbuild-pipeline: add tool to print pipelines to stdout

This tool outputs the pipeline associated with each output type. In
the future this should grow to take a blueprint as an input, and
also allow the arch/os/version/variant to be configured.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-08 01:15:13 +02:00 committed by Lars Karlitski
parent 22254637f8
commit b0d9423b73

View file

@ -0,0 +1,27 @@
package main
import (
"encoding/json"
"flag"
"os"
"osbuild-composer/internal/blueprint"
)
func main() {
var format string
flag.StringVar(&format, "output-format", "qcow2", "output format")
flag.Parse()
blueprint := &blueprint.Blueprint{}
pipeline, err := blueprint.ToPipeline(format)
if err != nil {
panic(err.Error())
}
bytes, err := json.Marshal(pipeline)
if err != nil {
panic("could not marshal pipeline into JSON")
}
os.Stdout.Write(bytes)
}