mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-02 10:09:02 +01:00
33 lines
708 B
Go
33 lines
708 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/rcourtman/pulse-go-rewrite/internal/mutationregistry"
|
|
)
|
|
|
|
func main() {
|
|
check := flag.Bool("check", false, "validate the closed mutation registry")
|
|
format := flag.String("format", "json", "output format (json)")
|
|
flag.Parse()
|
|
if *check {
|
|
if err := mutationregistry.Validate(); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
if *format != "json" {
|
|
fmt.Fprintf(os.Stderr, "unsupported format %q\n", *format)
|
|
os.Exit(2)
|
|
}
|
|
encoder := json.NewEncoder(os.Stdout)
|
|
encoder.SetIndent("", " ")
|
|
if err := encoder.Encode(mutationregistry.Entries()); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|