34 lines
631 B
Go
34 lines
631 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"code.icb4dc0.de/buildr/buildr/internal/rpc"
|
|
)
|
|
|
|
func ServerCommand(cmder ServerCommander) *cobra.Command {
|
|
cfg := new(rpc.GrpcConfig)
|
|
|
|
serverCmd := &cobra.Command{
|
|
Use: "serve",
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
Hidden: true,
|
|
}
|
|
|
|
serveAPICmd := &cobra.Command{
|
|
Use: "api",
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return cmder.ServeAPI(cmd.Context(), cfg)
|
|
},
|
|
}
|
|
|
|
serveAPICmd.Flags().AddGoFlagSet(cfg.Flags())
|
|
|
|
serverCmd.AddCommand(serveAPICmd)
|
|
|
|
return serverCmd
|
|
}
|