add version command

This commit is contained in:
c9s 2021-02-22 15:23:09 +08:00
parent 6bde66825d
commit e93b5a1868
2 changed files with 24 additions and 4 deletions

View File

@ -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
}

24
pkg/cmd/version.go Normal file
View File

@ -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)
},
}