mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-16 17:22:12 +08:00
test cobra
This commit is contained in:
parent
f0943276cb
commit
30e9b44054
@ -15,21 +15,21 @@ type RootCmd struct {
|
|||||||
prometheusPortFlag bool
|
prometheusPortFlag bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootCmd() *RootCmd {
|
func NewRootCmd() (rootCmd *RootCmd) {
|
||||||
|
rootCmd = &RootCmd{}
|
||||||
c := cobra.Command{
|
c := cobra.Command{
|
||||||
Use: "start",
|
Use: "start",
|
||||||
Short: "Start the server",
|
Short: "Start the server",
|
||||||
Long: `Start the server`,
|
Long: `Start the server`,
|
||||||
}
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
rootCmd := &RootCmd{}
|
if rootCmd.portFlag {
|
||||||
c.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
|
rootCmd.port = rootCmd.getPortFlag(cmd)
|
||||||
if rootCmd.portFlag {
|
}
|
||||||
rootCmd.port = rootCmd.getPortFlag(cmd)
|
if rootCmd.prometheusPortFlag {
|
||||||
}
|
rootCmd.prometheusPort = rootCmd.getPrometheusPortFlag(cmd)
|
||||||
if rootCmd.prometheusPortFlag {
|
}
|
||||||
rootCmd.prometheusPort = rootCmd.getPrometheusPortFlag(cmd)
|
return rootCmd.getConfFromCmdAndInit(cmd)
|
||||||
}
|
},
|
||||||
return rootCmd.getConfFromCmdAndInit(cmd)
|
|
||||||
}
|
}
|
||||||
rootCmd.Command = c
|
rootCmd.Command = c
|
||||||
rootCmd.init()
|
rootCmd.init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user