Documentation ¶
Overview ¶
Package cli provides the required tools to build a CLI utility that creates scaffolds for operator projects.
It is the entrypoint for any CLI that wants to use kubebuilder's scaffolding capabilities.
Index ¶
- func DiscoverExternalPlugins(fs afero.Fs) (ps []plugin.Plugin, err error)
- type CLI
- type Option
- func WithCommandName(name string) Option
- func WithCompletion() Option
- func WithDefaultPlugins(projectVersion config.Version, plugins ...plugin.Plugin) Option
- func WithDefaultProjectVersion(version config.Version) Option
- func WithDescription(description string) Option
- func WithExtraAlphaCommands(cmds ...*cobra.Command) Option
- func WithExtraCommands(cmds ...*cobra.Command) Option
- func WithFilesystem(fs machinery.Filesystem) Option
- func WithPlugins(plugins ...plugin.Plugin) Option
- func WithVersion(version string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI is the command line utility that is used to scaffold kubebuilder project files.
func New ¶
New creates a new CLI instance.
It follows the functional options pattern in order to customize the resulting CLI.
It returns an error if any of the provided options fails. As some processing needs to be done, execution errors may be found here. Instead of returning an error, this function will return a valid CLI that errors in Run so that help is provided to the user.
type Option ¶
Option is a function used as arguments to New in order to configure the resulting CLI.
func WithCommandName ¶
WithCommandName is an Option that sets the CLI's root command name.
func WithCompletion ¶
func WithCompletion() Option
WithCompletion is an Option that adds the completion subcommand.
func WithDefaultPlugins ¶
WithDefaultPlugins is an Option that sets the CLI's default plugins.
Specifying any invalid plugin results in an error.
func WithDefaultProjectVersion ¶
WithDefaultProjectVersion is an Option that sets the CLI's default project version.
Setting an invalid version results in an error.
func WithDescription ¶
WithDescription is an Option that sets the CLI's root description.
func WithExtraAlphaCommands ¶
WithExtraAlphaCommands is an Option that adds extra alpha subcommands to the CLI.
Adding extra alpha commands that duplicate existing commands results in an error.
func WithExtraCommands ¶
WithExtraCommands is an Option that adds extra subcommands to the CLI.
Adding extra commands that duplicate existing commands results in an error.
func WithFilesystem ¶ added in v4.1.1
func WithFilesystem(fs machinery.Filesystem) Option
WithFilesystem is an Option that allows to set the filesystem used in the CLI.
func WithPlugins ¶
WithPlugins is an Option that sets the CLI's plugins.
Specifying any invalid plugin results in an error.
func WithVersion ¶
WithVersion is an Option that defines the version string of the CLI.