github.com/raghuse92/packer@v1.3.2/common/powershell/scriptbuilder.go (about) 1 package powershell 2 3 import ( 4 "bytes" 5 ) 6 7 type ScriptBuilder struct { 8 buffer bytes.Buffer 9 } 10 11 func (b *ScriptBuilder) WriteLine(s string) (n int, err error) { 12 n, err = b.buffer.WriteString(s) 13 b.buffer.WriteString("\n") 14 15 return n + 1, err 16 } 17 18 func (b *ScriptBuilder) WriteString(s string) (n int, err error) { 19 n, err = b.buffer.WriteString(s) 20 return n, err 21 } 22 23 func (b *ScriptBuilder) String() string { 24 return b.buffer.String() 25 } 26 27 func (b *ScriptBuilder) Reset() { 28 b.buffer.Reset() 29 }