Add cmd/gotoml-test-encoder (#907)

This commit is contained in:
Martin Tournoij
2023-10-23 22:40:44 +02:00
committed by GitHub
parent a76e18e8c5
commit fd8d0bf4d9
4 changed files with 72 additions and 5 deletions
@@ -0,0 +1,30 @@
package main
import (
"flag"
"log"
"os"
"path"
"github.com/pelletier/go-toml/v2/internal/testsuite"
)
func main() {
log.SetFlags(0)
flag.Usage = usage
flag.Parse()
if flag.NArg() != 0 {
flag.Usage()
}
err := testsuite.EncodeStdin()
if err != nil {
log.Fatal(err)
}
}
func usage() {
log.Printf("Usage: %s < toml-file\n", path.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(1)
}