You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
297 B
18 lines
297 B
1 year ago
|
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))
|
||
|
}
|
||
|
}
|