cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeshKridikHelpFunc

func MeshKridikHelpFunc(app string) cli.HelpFunc

MeshKridikHelpFunc mesh-kridik Help function with all supported commands

func NewCliCommands

func NewCliCommands(ad ArgsData, plChan chan models.MeshCheckResults, completedChan chan bool, fi []utils.FilesInfo) []cli.Command

NewCliCommands return cli mesh obj commands accept cli args data , completion chan , result chan , spec files and return artay of cli commands

func NewCommandArgs

func NewCommandArgs(ad ArgsData) []string

NewCommandArgs return new cli command args accept cli args and return command args

func NewCompletionChan

func NewCompletionChan() chan bool

NewCompletionChan return plugin Completion chan

func NewMeshResultChan

func NewMeshResultChan() chan models.MeshCheckResults

NewMeshResultChan return plugin test result chan

func StartCLI

func StartCLI()

StartCLI start ldx-prob audit tester

func StartCLICommand

func StartCLICommand(fm utils.FolderMgr, plChan chan models.MeshCheckResults, completedChan chan bool, ad ArgsData, cmdArgs []string, commands map[string]cli.CommandFactory, log *logger.MeshKridikLogger)

StartCLICommand invoke cli mesh command mesh-kridik cli

Types

type ArgsData

type ArgsData struct {
	Filters     []string
	Help        bool
	SpecType    string
	SpecVersion string
}

ArgsData hold cli args data

func NewCliArgs

func NewCliArgs(sa SanitizeArgs) ArgsData

NewCliArgs return cli args

type SanitizeArgs

type SanitizeArgs func(str []string) ArgsData

SanitizeArgs sanitizer func

var ArgsSanitizer SanitizeArgs = func(str []string) ArgsData {
	ad := ArgsData{SpecType: "mesh"}
	args := make([]string, 0)
	if len(str) == 0 {
		args = append(args, "")
	}
	for _, arg := range str {
		arg = strings.Replace(arg, "--", "", -1)
		arg = strings.Replace(arg, "-", "", -1)
		switch {
		case arg == "help", arg == "h":
			ad.Help = true
			args = append(args, arg)
		case strings.HasPrefix(arg, "s="):
			ad.SpecType = arg[len("s="):]
		case strings.HasPrefix(arg, "spec="):
			ad.SpecType = arg[len("spec="):]
		case strings.HasPrefix(arg, "v="):
			ad.SpecVersion = fmt.Sprintf("v%s", arg[len("v="):])
		case strings.HasPrefix(arg, "version="):
			ad.SpecVersion = fmt.Sprintf("v%s", arg[len("version="):])
		default:
			args = append(args, arg)
		}
	}
	if ad.SpecType == "mesh" && len(ad.SpecVersion) == 0 {
		ad.SpecVersion = "istio"
	}
	ad.Filters = args
	return ad
}

ArgsSanitizer sanitize CLI arguments

func NewArgFunc

func NewArgFunc() SanitizeArgs

NewArgFunc return args func

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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