Documentation ¶
Overview ¶
Package cli is copied and adjusted code from: https://github.com/kubernetes-sigs/kind/blob/b6bc112522651d98c81823df56b7afa511459a3b/pkg/internal/env/term.go#L51
Index ¶
- Constants
- Variables
- func IsSmartTerminal(w io.Writer) bool
- func RegisterVerboseModeFlag(flags *pflag.FlagSet)
- type Config
- type TelemetrySwitch
- type VerboseModeFlag
- func (o VerboseModeFlag) AllowedOptions() string
- func (o VerboseModeFlag) IsEnabled() bool
- func (o VerboseModeFlag) IsTracing() bool
- func (o VerboseModeFlag) IsValid() bool
- func (o *VerboseModeFlag) Set(in string) error
- func (o VerboseModeFlag) String() string
- func (o *VerboseModeFlag) Type() string
Constants ¶
const Name = "botkube"
Name represent the official CLI name
Variables ¶
var ErrInvalidFormatType = fmt.Errorf("unknown verbose mode")
ErrInvalidFormatType is returned when an unsupported verbose mode is used.
var VerboseMode = VerboseModeDisabled
VerboseMode defines if CLI should use verbose mode
var VerboseModeHumanMapping = map[VerboseModeFlag]string{ VerboseModeDisabled: "disable", VerboseModeSimple: "simple", VerboseModeTracing: "trace", }
VerboseModeHumanMapping holds mapping between IDs and human-readable modes.
Functions ¶
func IsSmartTerminal ¶
IsSmartTerminal returns true if the writer w is a terminal AND we think that the terminal is smart enough to use VT escape codes etc.
func RegisterVerboseModeFlag ¶
RegisterVerboseModeFlag registers VerboseMode flag.
Types ¶
type Config ¶ added in v1.4.0
type Config struct { Token string `json:"token"` Telemetry TelemetrySwitch `json:"telemetry"` }
Config is botkube cli config
func NewConfig ¶ added in v1.4.0
func NewConfig() *Config
NewConfig creates new Config from local data or empty one
func ReadConfig ¶ added in v1.5.0
ReadConfig creates new Config from local data
func (Config) IsTelemetryDisabled ¶ added in v1.5.0
IsTelemetryDisabled checks if telemetry is disabled
func (Config) IsUserLoggedIn ¶ added in v1.5.0
IsUserLoggedIn checks if user is logged in
type TelemetrySwitch ¶ added in v1.5.0
type TelemetrySwitch string
TelemetrySwitch controls telemetry
const ( // TelemetryEnabled is a value for enabled telemetry TelemetryEnabled TelemetrySwitch = "enabled" // TelemetryDisabled is a value for disabled telemetry TelemetryDisabled TelemetrySwitch = "disabled" )
type VerboseModeFlag ¶
type VerboseModeFlag int
VerboseModeFlag is a type for capturing supported verbose mode formats. Implements pflag.Value interface.
const ( // VerboseModeDisabled represents disabled verbose mode VerboseModeDisabled VerboseModeFlag = 0 // VerboseModeSimple represents simple verbose mode (human friendly) VerboseModeSimple VerboseModeFlag = 1 // VerboseModeTracing represents tracing verbose mode (output may be overwhelming) // In this mode http calls (request, response body, headers etc.) are logged VerboseModeTracing VerboseModeFlag = 2 )
func (VerboseModeFlag) AllowedOptions ¶
func (o VerboseModeFlag) AllowedOptions() string
AllowedOptions returns list of allowed verbose mode options.
func (VerboseModeFlag) IsEnabled ¶
func (o VerboseModeFlag) IsEnabled() bool
IsEnabled returns true if any verbose mode is enabled.
func (VerboseModeFlag) IsTracing ¶
func (o VerboseModeFlag) IsTracing() bool
IsTracing returns true if tracing verbose mode is enabled.
func (VerboseModeFlag) IsValid ¶
func (o VerboseModeFlag) IsValid() bool
IsValid returns true if VerboseModeFlag is valid.
func (*VerboseModeFlag) Set ¶
func (o *VerboseModeFlag) Set(in string) error
Set format type to a given input. Required by pflag.Value interface.
func (VerboseModeFlag) String ¶
func (o VerboseModeFlag) String() string
String returns the string representation of the Format. Required by pflag.Value interface.
func (*VerboseModeFlag) Type ¶
func (o *VerboseModeFlag) Type() string
Type returns data type. Required by pflag.Value interface.