Command processing

This commit is contained in:
2020-09-29 18:25:53 -04:00
parent 7c630474ef
commit 478b907071
5 changed files with 89 additions and 12 deletions

View File

@@ -146,6 +146,10 @@ func (b PlaceBuilder) Build() error {
return err
}
if b.Options.Writer != nil {
return xml.Serialize(b.Options.Writer, nil, b.root)
}
file, err := os.OpenFile(b.Options.Output, os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return fmt.Errorf("failed to open output file")

View File

@@ -15,7 +15,7 @@ type DumpSettings struct {
type BuildSettings struct {
Source string
Output string
Writer *io.Writer
Writer io.Writer
}
type Manifest struct {
@@ -28,13 +28,13 @@ type Script struct {
Class string
}
func NewPlaceDump(options *DumpSettings) error {
func DumpPlace(options *DumpSettings) error {
return PlaceDumper{
Options: options,
}.Dump()
}
func NewPlaceBuilder(options *BuildSettings) error {
func BuildPlace(options *BuildSettings) error {
return PlaceBuilder{
Options: options,
}.Build()