1 Star 0 Fork 0

lollipop-xyz / g7-keyauth

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
root.go 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
xy 提交于 2022-11-01 16:54 . add keyauth init
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"gitee.com/lollipop-xyz/g7-keyauth/version"
)
var (
// pusher service config option
confType string
confFile string
confETCD string
)
var vers bool
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "g7-keyauth",
Short: "用户中心",
Long: "用户中心",
RunE: func(cmd *cobra.Command, args []string) error {
if vers {
fmt.Println(version.FullVersion())
return nil
}
return cmd.Help()
},
}
// Execute adds all child commands to the root command sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
}
}
func init() {
RootCmd.PersistentFlags().StringVarP(&confType, "config-type", "t", "file", "the service config type [file/env/etcd]")
RootCmd.PersistentFlags().StringVarP(&confFile, "config-file", "f", "etc/config.toml", "the service config from file")
RootCmd.PersistentFlags().StringVarP(&confETCD, "config-etcd", "e", "127.0.0.1:2379", "the service config from etcd")
RootCmd.PersistentFlags().BoolVarP(&vers, "version", "v", false, "the g7-keyauth version")
}
1
https://gitee.com/lollipop-xyz/g7-keyauth.git
git@gitee.com:lollipop-xyz/g7-keyauth.git
lollipop-xyz
g7-keyauth
g7-keyauth
v0.0.8

搜索帮助