-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.go
38 lines (33 loc) · 974 Bytes
/
command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package repocmd
import (
"context"
//docs "github.com/kform-dev/pkg-server/internal/docs/generated/initdocs"
"github.com/kform-dev/pkg-server/cmd/pkgctl/commands/repocmd/createcmd"
"github.com/kform-dev/pkg-server/cmd/pkgctl/commands/repocmd/deletecmd"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// NewRunner returns a command runner.
func GetCommand(ctx context.Context, version string, cfg *genericclioptions.ConfigFlags, k8s bool) *cobra.Command {
cmd := &cobra.Command{
Use: "repo",
//Short: docs.InitShort,
//Long: docs.InitShort + "\n" + docs.InitLong,
//Example: docs.InitExamples,
RunE: func(cmd *cobra.Command, args []string) error {
h, err := cmd.Flags().GetBool("help")
if err != nil {
return err
}
if h {
return cmd.Help()
}
return cmd.Usage()
},
}
cmd.AddCommand(
createcmd.NewCommand(ctx, version, cfg, k8s),
deletecmd.NewCommand(ctx, version, cfg, k8s),
)
return cmd
}