Rename project to actions-sync

This commit is contained in:
Anthony Sterling
2020-07-02 19:36:10 +01:00
commit f7954c5ebf
1249 changed files with 376757 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package src
import (
"context"
"github.com/spf13/cobra"
)
type SyncFlags struct {
PullFlags
PushFlags
}
func (f *SyncFlags) Init(cmd *cobra.Command) {
f.PullFlags.Init(cmd)
f.PushFlags.Init(cmd)
}
func (f *SyncFlags) Validate() Validations {
return f.PullFlags.Validate().Join(f.PushFlags.Validate())
}
func Sync(ctx context.Context, cacheDir string, flags *SyncFlags) error {
if err := Pull(ctx, cacheDir, &flags.PullFlags); err != nil {
return err
}
if err := Push(ctx, cacheDir, &flags.PushFlags); err != nil {
return err
}
return nil
}