24 lines
436 B
Go
24 lines
436 B
Go
|
package stackops
|
||
|
|
||
|
import (
|
||
|
basetypes "code.apps.glenux.net/glenux/kiwimix/pkg/basetypes"
|
||
|
)
|
||
|
|
||
|
type SaveOperation struct {
|
||
|
filePath string
|
||
|
}
|
||
|
|
||
|
func NewSaveOperation(filePath string) *SaveOperation {
|
||
|
saveop := new(SaveOperation)
|
||
|
return saveop
|
||
|
}
|
||
|
|
||
|
func (op *SaveOperation) Execute(stack *basetypes.CalendarStack) error {
|
||
|
cal, err := basetypes.ParseCalendarFile(op.filePath)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
stack.Push(cal)
|
||
|
return nil
|
||
|
}
|