cmd

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 17 Imported by: 42

Documentation

Overview

Copyright © 2019 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Plugin source originally from: github.com/kubernetes/kubernetes/pkg/kubectl/cmd/cmd.go

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	PxVersion = "(DEV)"
)

Functions

func ContextAddCommand added in v0.21.4

func ContextAddCommand(cmd *cobra.Command)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GenDocAddCommand added in v0.21.4

func GenDocAddCommand(cmd *cobra.Command)

func GetConfigFile

func GetConfigFile() string

GetConfigFile returns the current config file

func HandlePluginCommand added in v0.24.0

func HandlePluginCommand(pluginHandler PluginHandler, cmdArgs []string) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

func Main added in v0.21.3

func Main() error

Main starts the pxc cli Any initialization to pxc should be added to root.PersistentPreRunE

func RootAddCommand added in v0.21.4

func RootAddCommand(c *cobra.Command)

func VersionAddCommand added in v0.21.4

func VersionAddCommand(cmd *cobra.Command)

Types

type DefaultPluginHandler added in v0.24.0

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements PluginHandler

func NewDefaultPluginHandler added in v0.24.0

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute added in v0.24.0

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements PluginHandler

func (*DefaultPluginHandler) Lookup added in v0.24.0

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements PluginHandler

type PluginHandler added in v0.24.0

type PluginHandler interface {
	// exists at the given filename, or a boolean false.
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// The first filepath to match a prefix is returned.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins.

Jump to

Keyboard shortcuts

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