Files
open-im-server/pkg/common/cmd/api.go
T

18 lines
297 B
Go
Raw Normal View History

2023-06-30 09:45:02 +08:00
package cmd
import "github.com/spf13/cobra"
type ApiCmd struct {
*RootCmd
}
func NewApiCmd() *ApiCmd {
return &ApiCmd{NewRootCmd("api")}
}
func (a *ApiCmd) AddApi(f func(port int) error) {
a.Command.RunE = func(cmd *cobra.Command, args []string) error {
return f(a.getPortFlag(cmd))
}
}