cmd

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Human Format = "human" // Headers, indentation, justification etc.
	Plain        = "plain" // Suitable for cli automation via sed/awk etc.
	JSON         = "json"  // Technically a ⊆ yaml, but no one likes yaml.
	XML          = "xml"
	YAML         = "yaml"
	URL          = "url"
)
View Source
const DefaultVersion = "v0.0.0+source"

DefaultVersion when building source directly (bypassing the Makefile)

Variables

View Source
var ErrTemplateRepoDoesNotExist = errors.New("template repo does not exist")

ErrTemplateRepoDoesNotExist is a sentinel error if a template repository responds with 404 status code

Functions

func CompleteBuilderImageList

func CompleteBuilderImageList(cmd *cobra.Command, args []string, complete string) (builderImages []string, directive cobra.ShellCompDirective)

func CompleteBuilderList

func CompleteBuilderList(cmd *cobra.Command, args []string, complete string) (matches []string, d cobra.ShellCompDirective)

func CompleteFunctionList

func CompleteFunctionList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)

func CompleteOutputFormatList

func CompleteOutputFormatList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)

func CompleteRegistryList

func CompleteRegistryList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)

func CompleteRuntimeList

func CompleteRuntimeList(cmd *cobra.Command, args []string, toComplete string, client *fn.Client) (matches []string, directive cobra.ShellCompDirective)

func CompleteTemplateList

func CompleteTemplateList(cmd *cobra.Command, args []string, toComplete string, client *fn.Client) (matches []string, directive cobra.ShellCompDirective)

func KnownBuilders

func KnownBuilders() builders.Known

KnownBuilders are a typed string slice of builder short names which this CLI understands. Includes a customized String() representation intended for use in flags and help text.

func NewBuildCmd

func NewBuildCmd(newClient ClientFactory) *cobra.Command

func NewClient

func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func())

NewClient constructs an fn.Client with the majority of the concrete implementations set. Provide additional Options to this constructor to override or augment as needed, or override the ClientFactory passed to commands entirely to mock for testing. Note the returned cleanup function. 'Namespace' is optional. If not provided (see DefaultNamespace commentary), the currently configured is used. 'Verbose' indicates the system should write out a higher amount of logging.

func NewCompletionCmd

func NewCompletionCmd() *cobra.Command

func NewConfigCmd

func NewConfigCmd(loadSaver functionLoaderSaver, newClient ClientFactory) *cobra.Command

func NewConfigEnvsAddCmd

func NewConfigEnvsAddCmd(loadSaver functionLoaderSaver) *cobra.Command

func NewConfigEnvsCmd

func NewConfigEnvsCmd(loadSaver functionLoaderSaver) *cobra.Command

func NewConfigEnvsRemoveCmd

func NewConfigEnvsRemoveCmd() *cobra.Command

func NewConfigGitCmd added in v0.37.0

func NewConfigGitCmd(newClient ClientFactory) *cobra.Command

func NewConfigGitRemoveCmd added in v0.37.0

func NewConfigGitRemoveCmd(newClient ClientFactory) *cobra.Command

func NewConfigGitSetCmd added in v0.37.0

func NewConfigGitSetCmd(newClient ClientFactory) *cobra.Command

func NewConfigLabelsCmd

func NewConfigLabelsCmd(loaderSaver functionLoaderSaver) *cobra.Command

func NewConfigVolumesAddCmd

func NewConfigVolumesAddCmd() *cobra.Command

func NewConfigVolumesCmd

func NewConfigVolumesCmd() *cobra.Command

func NewConfigVolumesRemoveCmd

func NewConfigVolumesRemoveCmd() *cobra.Command

func NewCreateCmd

func NewCreateCmd(newClient ClientFactory) *cobra.Command

NewCreateCmd creates a create command using the given client creator.

func NewDeleteCmd

func NewDeleteCmd(newClient ClientFactory) *cobra.Command

func NewDeployCmd

func NewDeployCmd(newClient ClientFactory) *cobra.Command

func NewDescribeCmd added in v0.36.0

func NewDescribeCmd(newClient ClientFactory) *cobra.Command

func NewEnvironmentCmd added in v0.37.1

func NewEnvironmentCmd(newClient ClientFactory, version *Version) *cobra.Command

func NewInvokeCmd

func NewInvokeCmd(newClient ClientFactory) *cobra.Command

func NewLanguagesCmd

func NewLanguagesCmd(newClient ClientFactory) *cobra.Command

func NewListCmd

func NewListCmd(newClient ClientFactory) *cobra.Command

func NewRegistryValidator

func NewRegistryValidator(path string) survey.Validator

func NewRepositoryAddCmd

func NewRepositoryAddCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryCmd

func NewRepositoryCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryListCmd

func NewRepositoryListCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryRemoveCmd

func NewRepositoryRemoveCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryRenameCmd

func NewRepositoryRenameCmd(newClient ClientFactory) *cobra.Command

func NewRootCmd

func NewRootCmd(cfg RootCommandConfig) *cobra.Command

NewRootCmd creates the root of the command tree defines the command name, description, globally available flags, etc. It has no action of its own, such that running the resultant binary with no arguments prints the help/usage text.

func NewRunCmd

func NewRunCmd(newClient ClientFactory) *cobra.Command

func NewSubscribeCmd added in v0.40.0

func NewSubscribeCmd() *cobra.Command

func NewTemplatesCmd

func NewTemplatesCmd(newClient ClientFactory) *cobra.Command

func NewVersionCmd

func NewVersionCmd(version Version) *cobra.Command

func RuntimeTemplateOptions

func RuntimeTemplateOptions(client *fn.Client) (string, error)

RuntimeTemplateOptions is a human-friendly table of valid Language Runtime to Template combinations. Exported for use in docs.

func ValidateBuilder

func ValidateBuilder(name string) (err error)

ValidateBuilder ensures that the given builder is one that the CLI knows how to instantiate, returning a builkder.ErrUnknownBuilder otherwise.

Types

type ClientConfig

type ClientConfig struct {
	// Namespace in the remote cluster to use for any client commands which
	// touch the remote.  Optional.  Empty namespace indicates the namespace
	// currently configured in the client's connection should be used.
	Namespace string

	// Verbose logging.  By default, logging output is kept to the bare minimum.
	// Use this flag to configure verbose logging throughout.
	Verbose bool

	// Allow insecure server connections when using SSL
	InsecureSkipVerify bool
}

ClientConfig settings for use with NewClient These are the minimum settings necessary to create the default client instance which has most subsystems initialized.

type ClientFactory

type ClientFactory func(ClientConfig, ...fn.Option) (*fn.Client, func())

ClientFactory defines a constructor which assists in the creation of a Client for use by commands. See the NewClient constructor which is the fully populated ClientFactory used by commands by default. See NewClientFactory which constructs a minimal ClientFactory for use during testing.

func NewTestClient added in v0.36.0

func NewTestClient(options ...fn.Option) ClientFactory

NewTestClient returns a client factory which will ignore options used, instead using those provided when creating the factory. This allows for tests to create an entirely default client but with N mocks.

type Environment added in v0.37.1

type Environment struct {
	Version              string
	GitRevision          string
	SpecVersion          string
	SocatImage           string
	TarImage             string
	Languages            []string
	DefaultImageBuilders map[string]map[string]string
	Templates            map[string][]string
	Environment          []string
	Cluster              string
	TektonTasks          map[string]string
	Defaults             config.Global
	Function             *functions.Function `json:",omitempty" yaml:",omitempty"`
	Instance             *functions.Instance `json:",omitempty" yaml:",omitempty"`
}

type ErrInvalidRuntime

type ErrInvalidRuntime error

ErrInvalidRuntime indicates that the passed language runtime was invalid.

type ErrInvalidTemplate

type ErrInvalidTemplate error

ErrInvalidTemplate indicates that the passed template was invalid.

type ErrNoRuntime

type ErrNoRuntime error

ErrNoRuntime indicates that the language runtime flag was not passed.

type Format

type Format string

type Formatter

type Formatter interface {
	Human(io.Writer) error
	Plain(io.Writer) error
	JSON(io.Writer) error
	XML(io.Writer) error
	YAML(io.Writer) error
	URL(io.Writer) error
}

formatter is any structure which has methods for serialization.

type RootCommandConfig

type RootCommandConfig struct {
	Name string // usually `func` or `kn func`
	Version
	NewClient ClientFactory
}

type Version

type Version struct {
	// Version tag of the git commit, or 'tip' if no tag.
	Vers string
	// Kver is the version of knative in which func was most recently
	// If the build is not tagged as being released with a specific Knative
	// build, this is the most recent version of knative along with a suffix
	// consisting of the number of commits which have been added since it was
	// included in Knative.
	Kver string
	// Hash of the currently active git commit on build.
	Hash string
	// Verbose printing enabled for the string representation.
	Verbose bool
}

Version information populated on build.

func (Version) String

func (v Version) String() string

Return the stringification of the Version struct.

func (Version) StringVerbose

func (v Version) StringVerbose() string

StringVerbose returns the version along with extended version metadata.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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