mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 18:36:19 +08:00
test cobra
This commit is contained in:
parent
6eb13df2e2
commit
6bb8160a99
@ -29,7 +29,7 @@ var startCmd = &cobra.Command{
|
|||||||
func main() {
|
func main() {
|
||||||
startCmd.Flags().IntP(constant.FlagPort, "p", 0, "Port to listen on")
|
startCmd.Flags().IntP(constant.FlagPort, "p", 0, "Port to listen on")
|
||||||
startCmd.Flags().StringP(constant.FlagConf, "c", "", "Path to config file folder")
|
startCmd.Flags().StringP(constant.FlagConf, "c", "", "Path to config file folder")
|
||||||
rootCmd := cmd.NewRootCmd()
|
rootCmd := cmd.NewRootCmd(nil)
|
||||||
rootCmd.Command.AddCommand(startCmd)
|
rootCmd.Command.AddCommand(startCmd)
|
||||||
if err := startCmd.Execute(); err != nil {
|
if err := startCmd.Execute(); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -10,7 +10,7 @@ type RootCmd struct {
|
|||||||
Command cobra.Command
|
Command cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootCmd() RootCmd {
|
func NewRootCmd(f func() error) RootCmd {
|
||||||
c := cobra.Command{
|
c := cobra.Command{
|
||||||
Use: "start",
|
Use: "start",
|
||||||
Short: "Start the server",
|
Short: "Start the server",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user