MCPcopy Index your code
hub / github.com/dnote/dnote / NewDnoteCmd

Function NewDnoteCmd

pkg/cli/testutils/main.go:124–139  ·  view source on GitHub ↗

NewDnoteCmd returns a new Dnote command and a pointer to stderr

(opts RunDnoteCmdOptions, binaryName string, arg ...string)

Source from the content-addressed store, hash-verified

122
123// NewDnoteCmd returns a new Dnote command and a pointer to stderr
124func NewDnoteCmd(opts RunDnoteCmdOptions, binaryName string, arg ...string) (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error) {
125 var stderr, stdout bytes.Buffer
126
127 binaryPath, err := filepath.Abs(binaryName)
128 if err != nil {
129 return &exec.Cmd{}, &stderr, &stdout, errors.Wrap(err, "getting the absolute path to the test binary")
130 }
131
132 cmd := exec.Command(binaryPath, arg...)
133 cmd.Stderr = &stderr
134 cmd.Stdout = &stdout
135
136 cmd.Env = opts.Env
137
138 return cmd, &stderr, &stdout, nil
139}
140
141// RunDnoteCmdOptions is an option for RunDnoteCmd
142type RunDnoteCmdOptions struct {

Callers 1

RunDnoteCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected