Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- func (s *Config) BoundFlags() []*pflag.Flag
- func (s *Config) ClientTimeout() time.Duration
- func (s *Config) ConfigBindFlagSet(flags *pflag.FlagSet)
- func (s *Config) CreateService() (internal.AllServices, error)
- func (s *Config) FlagByKey(key string) *pflag.Flag
- func (s *Config) Get(key string) interface{}
- func (s *Config) GetString(key string) string
- func (s *Config) InteractiveUI() bool
- func (s *Config) IsSet(key string) bool
- func (s *Config) Load() error
- func (s *Config) Output() string
- func (s *Config) OutputHuman() bool
- func (s *Config) Viper() *viper.Viper
- type GlobalFlags
Constants ¶
const ( // KeyClientTimeout defines the viper configuration key used to define client timeout KeyClientTimeout = "client-timeout" // KeyOutput defines the viper configuration key used to define the output KeyOutput = "output" // ValueOutputHuman defines the viper configuration value used to define human-readable output ValueOutputHuman = "human" // ValueOutputYAML defines the viper configuration value used to define YAML output ValueOutputYAML = "yaml" // ValueOutputJSON defines the viper configuration value used to define JSON output ValueOutputJSON = "json" )
Variables ¶
var ( // Version contains the current version. Version = "dev" // BuildDate contains a string with the build date. BuildDate = "unknown" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// TODO: remove this after refactored
Service internal.Wrapper
GlobalFlags GlobalFlags
// contains filtered or unexported fields
}
Config holds the configuration for running upctl
func New ¶
func New() *Config
New returns a new instance of Config bound to the given viper instance
func (*Config) BoundFlags ¶
BoundFlags returns the list of all the flags given to the config
func (*Config) ClientTimeout ¶
ClientTimeout is a convenience method that returns the user specified client timeout
func (*Config) ConfigBindFlagSet ¶
ConfigBindFlagSet sets the config flag set and binds them to the viper instance
func (*Config) CreateService ¶
func (s *Config) CreateService() (internal.AllServices, error)
CreateService creates a new service instance and puts in the conf struct
func (*Config) GetString ¶
GetString is a convenience method of getting a configuration value in the current namespace as a string
func (*Config) InteractiveUI ¶
InteractiveUI is a convenience method that returns true if the user has requested human output and the terminal supports it.
func (*Config) OutputHuman ¶
OutputHuman is a convenience method that returns true if the user specified human-readable output