Rename project to actions-sync
This commit is contained in:
+31
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user