cmd

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2019 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Overview

DBDeployer - The MySQL Sandbox Copyright © 2006-2018 Giuseppe Maxia

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 CookbookNameExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "cookbook-name"},
	},
}

An annotation defining a string parameter of type sandbox cookbook-name

View Source
var DeployExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "version-dir"},
	},
}

An annotation defining a command that requires a version directory (such as 5.7.25) as an argument

View Source
var DoubleSandboxDirExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 2, Name: "sandbox-dir"},
	},
}

An annotation defining two parameters of type sandbox directory

View Source
var DoubleStringExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 2, Name: "string"},
	},
}

An annotation defining two generic string arguments

View Source
var IntegerExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "integer"},
	},
}

An annotation defining an argument as a generic integer

View Source
var ReplicationExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "version-dir"},
	},
	Options: []RequiredInfo{
		{HowMany: 1, Name: "topology", ReferenceData: "AllowedTopologies"},
	},
}

An annotation defining what are the minimum required arguments for replication

View Source
var SandboxDirExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "sandbox-dir"},
	},
}

An annotation for commands that require a sandbox directory (such as msb_5_7_25) as an argument

View Source
var StringExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "string"},
	},
}

An annotation defining an argument as a generic string

View Source
var TemplateGroupExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "template-group"},
		{HowMany: 1, Name: "string"},
	},
}

An annotation defining a string parameter of type sandbox template-group

View Source
var TemplateNameExport = ExportAnnotation{
	Arguments: []RequiredInfo{
		{HowMany: 1, Name: "template-name"},
	},
}

An annotation defining a string parameter of type sandbox template-name

Functions

func CommandToJson added in v1.28.0

func CommandToJson(c Command) string

Converts a Command structure to JSON

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 ExportAnnotationToJson added in v1.28.0

func ExportAnnotationToJson(ea ExportAnnotation) string

Converts an annotation structure to a JSON string

func ExportJson added in v1.28.0

func ExportJson() string

Exports the whole dbdeployer structure to JSON

func ExportJsonNamed added in v1.28.0

func ExportJsonNamed(name string, subCommand string) string

Export a given sub-command as JSON

func SandboxNames added in v1.28.0

func SandboxNames(n int) cobra.PositionalArgs

Types

type Command added in v1.28.0

type Command struct {
	Version string   `json:"version,omitempty"`
	Name    string   `json:"name"`
	Use     string   `json:"use"`
	Aliases []string `json:"aliases,omitempty"`
	Short   string   `json:"short,omitempty"`
	Long    string   `json:"long,omitempty"`
	Example string   `json:"example,omitempty"`

	SubCommands     []Command        `json:"commands,omitempty"`
	Options         []Option         `json:"flags,omitempty"`
	NeedSubCommands bool             `json:"needs_sub_commands"`
	Annotations     ExportAnnotation `json:"annotations,omitempty"`
}

Describes a command (or sub-command)

func Export added in v1.28.0

func Export() Command

Returns the dbdeployer structure as a Command type This is used to create Go applications with a different user interface

type ExportAnnotation added in v1.28.0

type ExportAnnotation struct {
	Arguments []RequiredInfo `json:"arguments"`
	Options   []RequiredInfo `json:"options"`
}

Defines what is needed for a command at the end of the known keywords

type Option added in v1.28.0

type Option struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Usage   string `json:"usage"`
	Short   string `json:"short"`
	Default string `json:"default"`
}

Describes a command option

type RequiredInfo added in v1.28.0

type RequiredInfo struct {
	HowMany       int    `json:"n"`
	Name          string `json:"name"`
	ReferenceData string `json:"ref_data,omitempty"`
}

Describes the parameters needed after a known parameter such as a command keyword or an option

type TemplateInfo

type TemplateInfo struct {
	TemplateInFile bool
	Group          string
	Name           string
	Description    string
}

Jump to

Keyboard shortcuts

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