func runDumpCommand(rrdFileName string) (string, error) { rrd, err := cdata.OpenRrdRawFile(rrdFileName, true) if err != nil { return "", err } defer rrd.Close() buffer := bytes.NewBufferString("") xmlDumper, err := dump.NewXmlOutput(buffer, true) if err != nil { return "", err } if err := rrd.DumpTo(xmlDumper); err != nil { return "", err } return buffer.String(), nil }
func dumpCommand(ctx *cli.Context) { filename, err := getFilenameArg(ctx) if err != nil { showError(ctx, err) return } rrd, err := cdata.OpenRrdRawFile(filename, true) if err != nil { fmt.Fprintln(ctx.App.Writer, err) return } defer rrd.Close() xmlDumper, err := dump.NewXmlOutput(ctx.App.Writer, true) if err != nil { fmt.Fprintln(ctx.App.Writer, err) return } if err := rrd.DumpTo(xmlDumper); err != nil { fmt.Fprintln(ctx.App.Writer, err) return } }