MCPcopy
hub / github.com/tsenart/vegeta / encodeCmd

Function encodeCmd

encode.go:55–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53`
54
55func encodeCmd() command {
56 encs := "[" + strings.Join([]string{encodingCSV, encodingGob, encodingJSON}, ", ") + "]"
57 fs := flag.NewFlagSet("vegeta encode", flag.ExitOnError)
58 to := fs.String("to", encodingJSON, "Output encoding "+encs)
59 output := fs.String("output", "stdout", "Output file")
60
61 fs.Usage = func() {
62 fmt.Fprintf(os.Stderr, "%s\n", encodeUsage)
63 }
64
65 return command{fs, func(args []string) error {
66 fs.Parse(args)
67 files := fs.Args()
68 if len(files) == 0 {
69 files = append(files, "stdin")
70 }
71 return encode(files, *to, *output)
72 }}
73}
74
75func encode(files []string, to, output string) error {
76 dec, mc, err := decoder(files)

Callers 1

mainFunction · 0.85

Calls 2

encodeFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected