myip/main.go

38 lines
625 B
Go

package main
import (
"fmt"
"log"
"os"
"github.com/spf13/cobra"
"kumoly.io/tools/myip/cmd"
)
var Version = "v0.1.0"
var Build = ""
var versionCmd = &cobra.Command{
Use: "version",
Short: "version",
Long: `Print the version number of myip`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(Version + Build)
},
}
func init() {
log.SetFlags(0)
log.SetOutput(os.Stdout)
cmd.ClientCmd.Version = Version
cmd.ClientCmd.AddCommand(versionCmd)
cmd.ClientCmd.AddCommand(cmd.ServerCmd)
}
func main() {
if err := cmd.ClientCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}