Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultWrapHelpString(val string) string
- func SetupRoot(rootCmd *cobra.Command, appLongName, version string)
- func WrapString(val string, lineLen int) string
- type AerospikeFlags
- type AuthModeFlag
- type CertFlag
- type CertPathFlag
- type ConfFileFlags
- type HostTLSPortSliceFlag
- func (slice *HostTLSPortSliceFlag) Append(val string) error
- func (slice *HostTLSPortSliceFlag) GetSlice() []string
- func (slice *HostTLSPortSliceFlag) Replace(vals []string) error
- func (slice *HostTLSPortSliceFlag) Set(commaSepVal string) error
- func (slice *HostTLSPortSliceFlag) String() string
- func (slice *HostTLSPortSliceFlag) Type() string
- type PasswordFlag
- type TLSProtocolsFlag
- type UsageFormatter
Constants ¶
const ( DefaultPort = 3000 DefaultIPv4 = "127.0.0.1" )
const (
DefaultMaxLineLength = 65
)
Variables ¶
var (
ErrEnvironmentVariableNotFound = fmt.Errorf("environment variable not found")
)
Functions ¶
func DefaultWrapHelpString ¶
func SetupRoot ¶
SetupRoot sets up the root command with common flags and options. It takes the rootCmd and appLongName as parameters. It registers the "help" alias for the "usage" flag. It adds the "version" as uppercase "V" flag to the rootCmd. It sets the version template for the rootCmd using appLongName. If appLongName is "Unique Data Agent", the version template will be:
Unique Data Agent Version 1.2.3
func WrapString ¶
Types ¶
type AerospikeFlags ¶
type AerospikeFlags struct { Seeds HostTLSPortSliceFlag `mapstructure:"host"` DefaultPort int `mapstructure:"port"` User string `mapstructure:"user"` Password PasswordFlag `mapstructure:"password"` AuthMode AuthModeFlag `mapstructure:"auth"` TLSEnable bool `mapstructure:"tls-enable"` TLSName string `mapstructure:"tls-name"` TLSProtocols TLSProtocolsFlag `mapstructure:"tls-protocols"` TLSRootCAFile CertFlag `mapstructure:"tls-cafile"` TLSRootCAPath CertPathFlag `mapstructure:"tls-capath"` TLSCertFile CertFlag `mapstructure:"tls-certfile"` TLSKeyFile CertFlag `mapstructure:"tls-keyfile"` TLSKeyFilePass PasswordFlag `mapstructure:"tls-keyfile-password"` }
AerospikeFlags defines the storage backing for Aerospike pflags.FlagSet returned from SetAerospikeFlags.
func NewDefaultAerospikeFlags ¶
func NewDefaultAerospikeFlags() *AerospikeFlags
func (*AerospikeFlags) NewAerospikeConfig ¶
func (af *AerospikeFlags) NewAerospikeConfig() *client.AerospikeConfig
func (*AerospikeFlags) NewFlagSet ¶
func (af *AerospikeFlags) NewFlagSet(fmtUsage UsageFormatter) *pflag.FlagSet
NewAerospikeFlagSet returns a new pflag.FlagSet with Aerospike flags defined. Values set in the returned FlagSet will be stored in the AerospikeFlags argument.
type AuthModeFlag ¶
AuthModeFlag defines a Cobra compatible flag for the --auth flag.
func (*AuthModeFlag) Set ¶
func (mode *AuthModeFlag) Set(val string) error
func (*AuthModeFlag) String ¶
func (mode *AuthModeFlag) String() string
func (*AuthModeFlag) Type ¶
func (mode *AuthModeFlag) Type() string
type CertFlag ¶
type CertFlag []byte
CertFlag defines a Cobra compatible flag for retrieving cryptographic certificates. This supports various Aerospike certificate configurations. examples include... --tls-cafile --tls-certfile --tls-keyfile
type CertPathFlag ¶
type CertPathFlag [][]byte
CertFlag defines a Cobra compatible flag for flags that resolve to a list of certificates. examples include... --tls-capath
func (*CertPathFlag) Set ¶
func (slice *CertPathFlag) Set(val string) error
func (*CertPathFlag) String ¶
func (slice *CertPathFlag) String() string
func (*CertPathFlag) Type ¶
func (slice *CertPathFlag) Type() string
type ConfFileFlags ¶
type ConfFileFlags struct { File string // Config file path. Instance string // Instance name appended to top-level context e.g. instance=tls will read from cluster_tls. }
ConfFileFlags represents the flags related to setting up the config file.
func NewConfFileFlags ¶
func NewConfFileFlags() *ConfFileFlags
func (*ConfFileFlags) NewFlagSet ¶
func (cf *ConfFileFlags) NewFlagSet(fmtUsage UsageFormatter) *pflag.FlagSet
NewFlagSet creates a new pflag.FlagSet with the config file flags. The fmtUsage parameter is a function that formats the usage string.
type HostTLSPortSliceFlag ¶
type HostTLSPortSliceFlag struct { Seeds client.HostTLSPortSlice // contains filtered or unexported fields }
A cobra PFlag to parse and display help info for the host[:tls-name][:port] input option. It implements the pflag Value and SliceValue interfaces to enable automatic parsing by cobra.
func NewHostTLSPortSliceFlag ¶
func NewHostTLSPortSliceFlag() HostTLSPortSliceFlag
func (*HostTLSPortSliceFlag) Append ¶
func (slice *HostTLSPortSliceFlag) Append(val string) error
Append adds the specified value to the end of the flag value list.
func (*HostTLSPortSliceFlag) GetSlice ¶
func (slice *HostTLSPortSliceFlag) GetSlice() []string
GetSlice returns the flag value list as an array of strings.
func (*HostTLSPortSliceFlag) Replace ¶
func (slice *HostTLSPortSliceFlag) Replace(vals []string) error
Replace will fully overwrite any data currently in the flag value list.
func (*HostTLSPortSliceFlag) Set ¶
func (slice *HostTLSPortSliceFlag) Set(commaSepVal string) error
func (*HostTLSPortSliceFlag) String ¶
func (slice *HostTLSPortSliceFlag) String() string
func (*HostTLSPortSliceFlag) Type ¶
func (slice *HostTLSPortSliceFlag) Type() string
type PasswordFlag ¶
type PasswordFlag []byte
PasswordFlag defines a Cobra compatible flag for password related options. examples include --password --tls-keyfile-password
func (*PasswordFlag) Set ¶
func (flag *PasswordFlag) Set(val string) error
func (*PasswordFlag) String ¶
func (flag *PasswordFlag) String() string
func (*PasswordFlag) Type ¶
func (flag *PasswordFlag) Type() string
type TLSProtocolsFlag ¶
type TLSProtocolsFlag struct {
// contains filtered or unexported fields
}
TLSProtocolsFlag defines a Cobra compatible flag for dealing with tls protocols. Example flags include. --tls--protocols
func NewDefaultTLSProtocolsFlag ¶
func NewDefaultTLSProtocolsFlag() TLSProtocolsFlag
func (*TLSProtocolsFlag) Set ¶
func (flag *TLSProtocolsFlag) Set(val string) error
func (*TLSProtocolsFlag) String ¶
func (flag *TLSProtocolsFlag) String() string
func (*TLSProtocolsFlag) Type ¶
func (flag *TLSProtocolsFlag) Type() string
type UsageFormatter ¶
UsageFormatter provides a method for modifying the usage text of the flags returned by SetAerospikeFlags.