packer-cn/builder/hyperv/common/powershell/scriptbuilder.go

30 lines
487 B
Go
Raw Normal View History

package powershell
import (
"bytes"
)
type ScriptBuilder struct {
buffer bytes.Buffer
}
func (b *ScriptBuilder) WriteLine(s string) (n int, err error) {
2016-11-06 11:02:00 -05:00
n, err = b.buffer.WriteString(s)
b.buffer.WriteString("\n")
2016-11-06 11:02:00 -05:00
return n + 1, err
}
func (b *ScriptBuilder) WriteString(s string) (n int, err error) {
2016-11-06 11:02:00 -05:00
n, err = b.buffer.WriteString(s)
return n, err
}
func (b *ScriptBuilder) String() string {
return b.buffer.String()
}
func (b *ScriptBuilder) Reset() {
b.buffer.Reset()
}