MCPcopy Create free account
hub / github.com/as/edit / Apply

Method Apply

cmd.go:73–85  ·  view source on GitHub ↗
(ed Editor)

Source from the content-addressed store, hash-verified

71}
72
73func (c WriteFile) Apply(ed Editor) {
74 fd, err := os.Create(c.Name)
75 if err != nil {
76 eprint(err)
77 return
78 }
79 defer fd.Close()
80 q0, q1 := ed.Dot()
81 _, err = io.Copy(fd, bytes.NewReader(ed.Bytes()[q0:q1]))
82 if err != nil {
83 eprint(err)
84 }
85}
86
87func (c Pipe) Apply(ed Editor) {
88 x := strings.Fields(c.To)

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.80
BytesMethod · 0.80
DotMethod · 0.65

Tested by

no test coverage detected