From 0906b3712840a41fb4481b7838bb18b08c892159 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 22 Feb 2021 15:23:09 +0800 Subject: [PATCH] add version command --- pkg/cmd/sync.go | 4 ---- pkg/cmd/version.go | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 pkg/cmd/version.go diff --git a/pkg/cmd/sync.go b/pkg/cmd/sync.go index 13cacd0543..734476f239 100644 --- a/pkg/cmd/sync.go +++ b/pkg/cmd/sync.go @@ -100,10 +100,6 @@ var SyncCmd = &cobra.Command{ sessions := environ.SelectSessions(selectedSessions...) for _, session := range sessions { - if err := session.Init(ctx, environ) ; err != nil { - return err - } - if err := environ.SyncSession(ctx, session, defaultSymbols...); err != nil { return err } diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go new file mode 100644 index 0000000000..5044058c6a --- /dev/null +++ b/pkg/cmd/version.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/c9s/bbgo/pkg/version" +) + +func init() { + // VersionCmd.Flags().String("session", "", "the exchange session name for sync") + RootCmd.AddCommand(VersionCmd) +} + +var VersionCmd = &cobra.Command{ + Use: "version", + Short: "show version name", + SilenceUsage: true, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version.Version) + }, +} +