-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpolicytools.go
44 lines (34 loc) · 1.18 KB
/
policytools.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
39
40
41
42
43
44
package policytools
import (
"github.com/spf13/cobra"
templateresolver "github.com/stolostron/go-template-utils/v6/cmd/template-resolver/utils"
"open-cluster-management.io/config-policy-controller/pkg/dryrun"
"github.com/stolostron/policy-cli/internal"
)
// policyCmd represents the base command when called without any subcommands
type Cmd struct{}
func (a Cmd) GetCmd() *cobra.Command {
policyCmd := &cobra.Command{
Use: "policytools",
Short: "Red Hat Advanced Cluster Management Policy Toolset",
Long: `Red Hat Advanced Cluster Management Policy Toolset
This toolset helps you manage the policies in multicluster Kubernetes
environments that are managed by Red Hat Advanced Cluster Management.`,
Version: internal.GetVersion(),
}
policyCmd.SetVersionTemplate(`{{ printf "%s\n" .Version }}`)
// Load subcommands
internal.LoadSubCmds(
// Root command
policyCmd, // policytools
// Subcommands
&templateresolver.TemplateResolver{}, // template-resolver
&dryrun.DryRunner{}, // dryrun
)
return policyCmd
}
// Execute loads subcommands and runs the `acm` command.
func Execute() error {
policytoolsCmd := Cmd{}.GetCmd()
return policytoolsCmd.Execute()
}