configcobra

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Overview

Package configcobra provides a target for embedding the config command group in another cobra command.

Index

Examples

Constants

This section is empty.

Variables

Export commands publicly for composition

Functions

func AddCommands added in v0.2.0

func AddCommands(root *cobra.Command, name string) *cobra.Command

AddCommands adds the cfg and fn commands to kustomize.

Example

ExampleAddCommands demonstrates how to embed the config command as a command inside another group.

package main

import (
	"os"

	"github.com/spf13/cobra"
	"sigs.k8s.io/kustomize/cmd/config/configcobra"
	"sigs.k8s.io/kustomize/kyaml/commandutil"
)

func main() {
	// enable the config commands
	os.Setenv(commandutil.EnableAlphaCommmandsEnvName, "true")
	_ = configcobra.AddCommands(&cobra.Command{
		Use:   "my-cmd",
		Short: "My command.",
		Long:  `My command.`,
	}, "my-cmd")
}
Output:

func GetCfg added in v0.2.0

func GetCfg(name string) *cobra.Command

func GetFn added in v0.2.0

func GetFn(name string) *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL