Files
kustomize/cmd/config/cmds/example_test.go
Phillip Wittrock 6484259632 Disable alpha kustomize commands by default.
- enable alpha commands with env KUSTOMIZE_SHOW_ALPHA_COMMANDS=true
2019-12-11 18:42:46 -08:00

26 lines
614 B
Go

// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package cmds_test
import (
"os"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/cmd/config/cmds"
"sigs.k8s.io/kustomize/kyaml/commandutil"
)
// ExampleNewConfigCommand demonstrates how to embed the config command as a command inside
// another group.
func ExampleNewConfigCommand() {
// enable the config commands
os.Setenv(commandutil.EnableAlphaCommmandsEnvName, "true")
var root = &cobra.Command{
Use: "my-cmd",
Short: "My command.",
Long: `My command.`,
}
root.AddCommand(cmds.NewConfigCommand("my-cmd"))
}