cmd: make sync command consistent

This commit is contained in:
c9s 2024-03-31 19:32:37 +08:00
parent f300791e34
commit 39d9445529
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -2,10 +2,8 @@ package cmd
import (
"context"
"os"
"time"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/c9s/bbgo/pkg/bbgo"
@ -25,24 +23,6 @@ var SyncCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
configFile, err := cmd.Flags().GetString("config")
if err != nil {
return err
}
if len(configFile) == 0 {
return errors.New("--config option is required")
}
if _, err := os.Stat(configFile); os.IsNotExist(err) {
return err
}
userConfig, err := bbgo.Load(configFile, false)
if err != nil {
return err
}
since, err := cmd.Flags().GetString("since")
if err != nil {
return err