cmd

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 41 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"
)

Variables

View Source
var ErrRegistryRequired = errors.New(`A container registry is required.  For example:
--registry docker.io/myusername

To run the command in an interactive mode, use --confirm (-c)`)
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

View Source
var ErrURLRequired = errors.New(`The function is not associated with a Git repository, and needs one in order to perform a remote deployment.  For example:

--remote --git-url=https://git.example.com/namespace/myFunction

To run the deploy command in an interactive mode, use --confirm (-c)`)

Functions

func CompleteBuilderImageList added in v0.23.0

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 added in v0.19.0

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

func GetDefaultRegistry added in v0.22.0

func GetDefaultRegistry() string

func KnownBuilders added in v0.26.0

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 added in v0.23.0

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. Example:

client, done := NewClient("",false)
defer done()

func NewCompletionCmd added in v0.22.0

func NewCompletionCmd() *cobra.Command

func NewConfigCmd added in v0.22.0

func NewConfigCmd(loadSaver functionLoaderSaver) *cobra.Command

func NewConfigEnvsAddCmd added in v0.22.0

func NewConfigEnvsAddCmd(loadSaver functionLoaderSaver) *cobra.Command

func NewConfigEnvsCmd added in v0.22.0

func NewConfigEnvsCmd(loadSaver functionLoaderSaver) *cobra.Command

func NewConfigEnvsRemoveCmd added in v0.22.0

func NewConfigEnvsRemoveCmd() *cobra.Command

func NewConfigLabelsCmd added in v0.18.0

func NewConfigLabelsCmd(loaderSaver functionLoaderSaver) *cobra.Command

func NewConfigVolumesAddCmd added in v0.22.0

func NewConfigVolumesAddCmd() *cobra.Command

func NewConfigVolumesCmd added in v0.22.0

func NewConfigVolumesCmd() *cobra.Command

func NewConfigVolumesRemoveCmd added in v0.22.0

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 NewInfoCmd added in v0.18.0

func NewInfoCmd(newClient ClientFactory) *cobra.Command

func NewInvokeCmd added in v0.22.0

func NewInvokeCmd(newClient ClientFactory) *cobra.Command

func NewLanguagesCmd added in v0.26.0

func NewLanguagesCmd(newClient ClientFactory) *cobra.Command

func NewListCmd

func NewListCmd(newClient ClientFactory) *cobra.Command

func NewRegistryValidator added in v0.34.0

func NewRegistryValidator(path string) survey.Validator

func NewRepositoryAddCmd added in v0.18.0

func NewRepositoryAddCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryCmd added in v0.18.0

func NewRepositoryCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryListCmd added in v0.18.0

func NewRepositoryListCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryRemoveCmd added in v0.18.0

func NewRepositoryRemoveCmd(newClient ClientFactory) *cobra.Command

func NewRepositoryRenameCmd added in v0.18.0

func NewRepositoryRenameCmd(newClient ClientFactory) *cobra.Command

func NewRootCmd

func NewRootCmd(config 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 NewTemplatesCmd added in v0.26.0

func NewTemplatesCmd(newClient ClientFactory) *cobra.Command

func NewVersionCmd added in v0.22.0

func NewVersionCmd(version Version) *cobra.Command

func RuntimeTemplateOptions added in v0.26.0

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

RuntimeTemplateOptions is a human-friendly table of valid Language Runtime to Template combinations.

func ValidateBuilder added in v0.26.0

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 added in v0.23.0

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 added in v0.22.0

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 NewClientFactory added in v0.23.0

func NewClientFactory(n func() *fn.Client) ClientFactory

NewClientFactory enables simple instantiation of an fn.Client, such as for mocking during tests or for minimal api usage. Given is a minimal Client constructor, Returned is full ClientFactory with the aspects of normal (full) Client construction (namespace, verbosity level, additional options and the returned cleanup function) ignored.

type ErrInvalidRuntime added in v0.20.0

type ErrInvalidRuntime error

ErrInvalidRuntime indicates that the passed language runtime was invalid.

type ErrInvalidTemplate added in v0.20.0

type ErrInvalidTemplate error

ErrInvalidTemplate indicates that the passed template was invalid.

type ErrNoRuntime added in v0.20.0

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 added in v0.22.0

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

type Version

type Version struct {
	// Date of compilation
	Date string
	// Version tag of the git commit, or 'tip' if no tag.
	Vers string
	// Hash of the currently active git commit on build.
	Hash string
	// Verbose printing enabled for the string representation.
	Verbose bool
}

func (Version) String

func (v Version) String() string

Return the stringification of the Version struct, which takes into account the verbosity setting.

func (Version) StringVerbose added in v0.23.0

func (v Version) StringVerbose() string

StringVerbose returns the verbose version of the version stringification. The format returned is [semver]-hash-[date] where the special value 'v0.0.0' and 'source' are used when version is not available and/or the libray has been built from source, respectively.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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