2015-06-21 07:36:07 -04:00
|
|
|
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)
|
2015-06-21 07:36:07 -04:00
|
|
|
b.buffer.WriteString("\n")
|
|
|
|
|
2016-11-06 11:02:00 -05:00
|
|
|
return n + 1, err
|
2015-06-21 07:36:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (b *ScriptBuilder) WriteString(s string) (n int, err error) {
|
2016-11-06 11:02:00 -05:00
|
|
|
n, err = b.buffer.WriteString(s)
|
2015-06-21 07:36:07 -04:00
|
|
|
return n, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *ScriptBuilder) String() string {
|
|
|
|
return b.buffer.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *ScriptBuilder) Reset() {
|
|
|
|
b.buffer.Reset()
|
|
|
|
}
|