Exemple #1
0
func main() {
	if flag.NArg() != 0 {
		flag.Usage()
	}

	var tmp interface{}
	if err := json.NewDecoder(os.Stdin).Decode(&tmp); err != nil {
		log.Fatalf("Error decoding JSON: %s", err)
	}

	tomlData := translate(tmp)
	if err := toml.NewEncoder(os.Stdout).Encode(tomlData); err != nil {
		log.Fatalf("Error encoding TOML: %s", err)
	}
}
Exemple #2
0
func (cfg *Config) Dump(w io.Writer) error {
	e := toml.NewEncoder(w)
	e.Indent = ""
	return e.Encode(cfg)
}