// VulcanizeDB // Copyright © 2022 Vulcanize // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package cmd import ( "fmt" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" v "github.com/vulcanize/ipld-eth-beacon-indexer/pkg/version" ) var ( Major = 0 // Major version component of the current release Minor = 0 // Minor version component of the current release Patch = 0 // Patch version component of the current release Meta = "" // Version metadata to append to the version string ) // versionCmd represents the version command var versionCmd = &cobra.Command{ Use: "version", Short: "Prints the version of ipld-eth-server", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { version := v.Version{ Major: Major, Minor: Minor, Patch: Patch, Meta: Meta, } log.Infof("ipld-eth-beacon-indexer version: %s", version.GetVersionWithMeta()) fmt.Println(version.GetVersionWithMeta()) }, } func init() { rootCmd.AddCommand(versionCmd) // Here you will define your flags and configuration settings. // Cobra supports Persistent Flags which will work for this command // and all subcommands, e.g.: // versionCmd.PersistentFlags().String("foo", "", "A help for foo") // Cobra supports local flags which will only run when this command // is called directly, e.g.: // versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") }