
* refactor: take clients out of internal * refactor: move stdio to pkg * Move internal/api to api * refactor: final changes for Kapacitor to access shared functionality * chore: regenerate mocks * fix: bad automated refactor * chore: extra formatting not caught by make fmt
30 lines
411 B
Go
30 lines
411 B
Go
package write
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/influxdata/influx-cli/v2/clients"
|
|
)
|
|
|
|
type DryRunClient struct {
|
|
clients.CLI
|
|
LineReader
|
|
}
|
|
|
|
func (c DryRunClient) WriteDryRun(ctx context.Context) error {
|
|
r, closer, err := c.LineReader.Open(ctx)
|
|
if closer != nil {
|
|
defer closer.Close()
|
|
}
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if _, err := io.Copy(c.StdIO, r); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|