schema

package
v0.0.0-...-91e9092 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Copyright 2015 Gravitational, Inc.

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.

Copyright 2015 Gravitational, Inc.

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

This section is empty.

Functions

func SetParam

func SetParam(p Param, s kingpin.Settings)

Types

type BoolParam

type BoolParam struct {
	// contains filtered or unexported fields
}

func (*BoolParam) Args

func (p *BoolParam) Args() []string

Args returns argument strings in cli format

func (*BoolParam) CLIName

func (p *BoolParam) CLIName() string

func (*BoolParam) Check

func (p *BoolParam) Check() string

func (*BoolParam) Default

func (p *BoolParam) Default() string

func (*BoolParam) Description

func (p *BoolParam) Description() string

func (*BoolParam) EnvName

func (p *BoolParam) EnvName() string

func (*BoolParam) EnvVars

func (p *BoolParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*BoolParam) Name

func (p *BoolParam) Name() string

func (*BoolParam) New

func (p *BoolParam) New() Param

New clones this parameter

func (*BoolParam) Required

func (p *BoolParam) Required() bool

func (*BoolParam) Set

func (p *BoolParam) Set(s string) error

Set is required to set parameters from command line string

func (*BoolParam) String

func (p *BoolParam) String() string

func (*BoolParam) Vars

func (p *BoolParam) Vars() (string, string)

Vars returns a tuple with the variable name and value

type Config

type Config struct {
	Params []Param
}

func ParseJSON

func ParseJSON(r io.Reader) (*Config, error)

func ParseVariablesJSON

func ParseVariablesJSON(r io.Reader) (*Config, error)

func (*Config) Args

func (c *Config) Args() []string

Args returns the list of arguments for all parameters

func (*Config) EnvVars

func (c *Config) EnvVars() map[string]string

EnvVars returns a map with environment variables for all parameters

func (*Config) ParseArgs

func (c *Config) ParseArgs(args []string) error

func (*Config) ParseEnv

func (c *Config) ParseEnv() error

func (*Config) ParseVars

func (c *Config) ParseVars(vars map[string]string) error

func (*Config) Vars

func (c *Config) Vars() map[string]string

type EnumParam

type EnumParam struct {
	// contains filtered or unexported fields
}

func (*EnumParam) Args

func (p *EnumParam) Args() []string

Args returns argument strings in cli format

func (*EnumParam) CLIName

func (p *EnumParam) CLIName() string

func (*EnumParam) Check

func (p *EnumParam) Check() string

func (*EnumParam) Default

func (p *EnumParam) Default() string

func (*EnumParam) Description

func (p *EnumParam) Description() string

func (*EnumParam) EnvName

func (p *EnumParam) EnvName() string

func (*EnumParam) EnvVars

func (p *EnumParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*EnumParam) Name

func (p *EnumParam) Name() string

func (*EnumParam) New

func (p *EnumParam) New() Param

New clones this parameter

func (*EnumParam) Required

func (p *EnumParam) Required() bool

func (*EnumParam) Set

func (p *EnumParam) Set(s string) error

Set is required to set parameters from command line string

func (*EnumParam) String

func (p *EnumParam) String() string

func (*EnumParam) Vars

func (p *EnumParam) Vars() (string, string)

type IntParam

type IntParam struct {
	// contains filtered or unexported fields
}

func (*IntParam) Args

func (p *IntParam) Args() []string

Args returns argument strings in cli format

func (*IntParam) CLIName

func (p *IntParam) CLIName() string

func (*IntParam) Check

func (p *IntParam) Check() string

func (*IntParam) Default

func (p *IntParam) Default() string

func (*IntParam) Description

func (p *IntParam) Description() string

func (*IntParam) EnvName

func (p *IntParam) EnvName() string

func (*IntParam) EnvVars

func (p *IntParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*IntParam) Name

func (p *IntParam) Name() string

func (*IntParam) New

func (p *IntParam) New() Param

New clones this parameter

func (*IntParam) Required

func (p *IntParam) Required() bool

func (*IntParam) Set

func (p *IntParam) Set(s string) error

Set is required to set parameters from command line string

func (*IntParam) String

func (p *IntParam) String() string

func (*IntParam) Vars

func (p *IntParam) Vars() (string, string)

Vars returns a tuple with the variable name and value

type KVParam

type KVParam struct {
	// contains filtered or unexported fields
}

func (*KVParam) Args

func (p *KVParam) Args() []string

Args returns argument strings in cli format

func (*KVParam) CLIName

func (p *KVParam) CLIName() string

func (*KVParam) Check

func (p *KVParam) Check() string

func (*KVParam) Default

func (p *KVParam) Default() string

func (*KVParam) Description

func (p *KVParam) Description() string

func (*KVParam) EnvName

func (p *KVParam) EnvName() string

func (*KVParam) EnvVars

func (p *KVParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*KVParam) Name

func (p *KVParam) Name() string

func (*KVParam) New

func (p *KVParam) New() Param

New clones this parameter

func (*KVParam) Required

func (p *KVParam) Required() bool

func (*KVParam) Set

func (p *KVParam) Set(s string) error

Set is required to set parameters from command line string

func (*KVParam) String

func (p *KVParam) String() string

func (*KVParam) Vars

func (p *KVParam) Vars() (string, string)

type ListParam

type ListParam struct {
	// contains filtered or unexported fields
}

ListParam defines a flag that accumulates multiple values

func (*ListParam) Args

func (p *ListParam) Args() []string

Args returns argument strings in cli format

func (*ListParam) CLIName

func (p *ListParam) CLIName() string

CLIName specifies the name of the parameter as given on command line

func (*ListParam) Check

func (p *ListParam) Check() string

func (*ListParam) Default

func (p *ListParam) Default() string

func (*ListParam) Description

func (p *ListParam) Description() string

func (*ListParam) EnvName

func (p *ListParam) EnvName() string

EnvName specifies the name of the environment variable that specifies the value for the parameter

func (*ListParam) EnvVars

func (p *ListParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*ListParam) IsCumulative

func (p *ListParam) IsCumulative() bool

IsCumulative determines whether the flag is cumulative - i.e. can be specified multiple times. Implements kingpin.repeatableFlag

func (*ListParam) Name

func (p *ListParam) Name() string

func (*ListParam) New

func (p *ListParam) New() Param

New clones this parameter

func (*ListParam) Required

func (p *ListParam) Required() bool

func (*ListParam) Set

func (p *ListParam) Set(s string) error

Set is required to set parameters from command line string

func (*ListParam) String

func (p *ListParam) String() string

func (*ListParam) Vars

func (p *ListParam) Vars() (string, string)

Vars returns a tuple with the variable name and value

type Param

type Param interface {
	// Name is the parameter's name
	Name() string
	// CLIName specifies the name of the parameter as given on command line
	CLIName() string
	// Description specifies human-friendly parameter's description
	Description() string
	Check() string
	// Required is whether the parameter is required
	Required() bool
	// Default returns the default value for the parameter
	Default() string

	// New clones this parameter
	New() Param

	// Set is required to set parameters from command line string
	Set(string) error
	// String is required to output value to command line string
	String() string

	// Args returns argument strings in cli format
	Args() []string

	// EnvVars returns a tuple with environment variable name and value
	EnvVars() (string, string)

	// Vars returns a tuple with the variable name and value
	Vars() (string, string)

	// EnvName specifies the name of the environment variable that specifies
	// the value for the parameter
	EnvName() string
}

Param is the command line parameter

type PathParam

type PathParam struct {
	// contains filtered or unexported fields
}

func (*PathParam) Args

func (p *PathParam) Args() []string

Args returns argument strings in cli format

func (*PathParam) CLIName

func (p *PathParam) CLIName() string

func (*PathParam) Check

func (p *PathParam) Check() string

func (*PathParam) Default

func (p *PathParam) Default() string

func (*PathParam) Description

func (p *PathParam) Description() string

func (*PathParam) EnvName

func (p *PathParam) EnvName() string

func (*PathParam) EnvVars

func (p *PathParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*PathParam) Name

func (p *PathParam) Name() string

func (*PathParam) New

func (p *PathParam) New() Param

New clones this parameter

func (*PathParam) Required

func (p *PathParam) Required() bool

func (*PathParam) Set

func (p *PathParam) Set(s string) error

Set is required to set parameters from command line string

func (*PathParam) String

func (p *PathParam) String() string

func (*PathParam) Vars

func (p *PathParam) Vars() (string, string)

Vars returns a tuple with the variable name and value

type StringParam

type StringParam struct {
	// contains filtered or unexported fields
}

func (*StringParam) Args

func (p *StringParam) Args() []string

Args returns argument strings in cli format

func (*StringParam) CLIName

func (p *StringParam) CLIName() string

func (*StringParam) Check

func (p *StringParam) Check() string

func (*StringParam) Default

func (p *StringParam) Default() string

func (*StringParam) Description

func (p *StringParam) Description() string

func (*StringParam) EnvName

func (p *StringParam) EnvName() string

func (*StringParam) EnvVars

func (p *StringParam) EnvVars() (string, string)

EnvVars returns a tuple with environment variable name and value

func (*StringParam) Name

func (p *StringParam) Name() string

func (*StringParam) New

func (p *StringParam) New() Param

New clones this parameter

func (*StringParam) Required

func (p *StringParam) Required() bool

func (*StringParam) Set

func (p *StringParam) Set(s string) error

Set is required to set parameters from command line string

func (*StringParam) String

func (p *StringParam) String() string

func (*StringParam) Vars

func (p *StringParam) Vars() (string, string)

Vars returns a tuple with the variable name and value

Jump to

Keyboard shortcuts

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