mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-28 12:56:35 +08:00
test cobra
This commit is contained in:
parent
f5309ee3b8
commit
320c978e94
@ -18,7 +18,7 @@ func main() {
|
|||||||
rootCmd := cmd.NewRootCmd()
|
rootCmd := cmd.NewRootCmd()
|
||||||
rootCmd.AddPortFlag()
|
rootCmd.AddPortFlag()
|
||||||
rootCmd.AddRunE(run)
|
rootCmd.AddRunE(run)
|
||||||
if err := rootCmd.Command.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ func NewRootCmd() RootCmd {
|
|||||||
return rootCmd.getConfFromCmdAndInit(cmd)
|
return rootCmd.getConfFromCmdAndInit(cmd)
|
||||||
}
|
}
|
||||||
rootCmd.init()
|
rootCmd.init()
|
||||||
|
rootCmd
|
||||||
return rootCmd
|
return rootCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,3 +74,7 @@ func (r RootCmd) getConfFromCmdAndInit(cmdLines *cobra.Command) error {
|
|||||||
configFolderPath, _ := cmdLines.Flags().GetString(constant.FlagConf)
|
configFolderPath, _ := cmdLines.Flags().GetString(constant.FlagConf)
|
||||||
return config.InitConfig(configFolderPath)
|
return config.InitConfig(configFolderPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r RootCmd) Execute() error {
|
||||||
|
return r.Command.Execute()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user