Documentation ¶
Index ¶
- Constants
- Variables
- func AnswerToBool(answer string) bool
- func ColorStatus(on bool)
- func Colorize(text string) string
- func FileExists(path string) bool
- func MappedStringOrDefault(data map[string]string, index, defaultValue string) string
- func PrefixLines(lines []string, prefix string) []string
- func PrefixLinesInString(s, prefix string) string
- func ReadFile(path string) ([]byte, error)
- func SplitLines(s string) []string
- func SubString(input string, start int, length int) string
- type CollectedMessage
- type CollectorIO
- func (c *CollectorIO) Argument(name, defaultValue string) string
- func (c *CollectorIO) Arguments() map[string]string
- func (c *CollectorIO) Ask(message, defaultValue string) string
- func (c *CollectorIO) HasCollectedMessages() bool
- func (c *CollectorIO) HasCollectedMessagesForVerbosity(verbosity int) bool
- func (c *CollectorIO) Input() Input
- func (c *CollectorIO) IsDebug() bool
- func (c *CollectorIO) IsInteractive() bool
- func (c *CollectorIO) IsQuiet() bool
- func (c *CollectorIO) IsVerbose() bool
- func (c *CollectorIO) Messages() []*CollectedMessage
- func (c *CollectorIO) Option(name, defaultValue string) string
- func (c *CollectorIO) Options() map[string]string
- func (c *CollectorIO) StandardInput() []string
- func (c *CollectorIO) Verbosity() int
- func (c *CollectorIO) Write(message string, newline bool, verbosity int)
- type Colorizer
- type DefaultIO
- func (d *DefaultIO) Argument(name, defaultValue string) string
- func (d *DefaultIO) Arguments() map[string]string
- func (d *DefaultIO) Ask(message string, defaultValue string) string
- func (d *DefaultIO) Input() Input
- func (d *DefaultIO) IsDebug() bool
- func (d *DefaultIO) IsInteractive() bool
- func (d *DefaultIO) IsQuiet() bool
- func (d *DefaultIO) IsVerbose() bool
- func (d *DefaultIO) Option(name, defaultValue string) string
- func (d *DefaultIO) Options() map[string]string
- func (d *DefaultIO) StandardInput() []string
- func (d *DefaultIO) Verbosity() int
- func (d *DefaultIO) Write(message string, newline bool, verbosity int)
- type IO
- type Input
- type StdIn
Constants ¶
View Source
const ( QUIET = 1 NORMAL = 2 VERBOSE = 4 DEBUG = 8 )
Variables ¶
View Source
var Color = NewColorizer()
Functions ¶
func AnswerToBool ¶
func ColorStatus ¶
func ColorStatus(on bool)
func FileExists ¶
func MappedStringOrDefault ¶
func PrefixLines ¶
func PrefixLinesInString ¶
func SplitLines ¶
Types ¶
type CollectedMessage ¶
type CollectorIO ¶
type CollectorIO struct {
// contains filtered or unexported fields
}
func NewCollectorIO ¶
func NewCollectorIO(verbosity int, input Input) *CollectorIO
func (*CollectorIO) Argument ¶
func (c *CollectorIO) Argument(name, defaultValue string) string
func (*CollectorIO) Arguments ¶
func (c *CollectorIO) Arguments() map[string]string
func (*CollectorIO) Ask ¶
func (c *CollectorIO) Ask(message, defaultValue string) string
func (*CollectorIO) HasCollectedMessages ¶
func (c *CollectorIO) HasCollectedMessages() bool
func (*CollectorIO) HasCollectedMessagesForVerbosity ¶
func (c *CollectorIO) HasCollectedMessagesForVerbosity(verbosity int) bool
func (*CollectorIO) Input ¶
func (c *CollectorIO) Input() Input
func (*CollectorIO) IsDebug ¶
func (c *CollectorIO) IsDebug() bool
func (*CollectorIO) IsInteractive ¶
func (c *CollectorIO) IsInteractive() bool
func (*CollectorIO) IsQuiet ¶
func (c *CollectorIO) IsQuiet() bool
func (*CollectorIO) IsVerbose ¶
func (c *CollectorIO) IsVerbose() bool
func (*CollectorIO) Messages ¶
func (c *CollectorIO) Messages() []*CollectedMessage
func (*CollectorIO) Option ¶
func (c *CollectorIO) Option(name, defaultValue string) string
func (*CollectorIO) Options ¶
func (c *CollectorIO) Options() map[string]string
func (*CollectorIO) StandardInput ¶
func (c *CollectorIO) StandardInput() []string
func (*CollectorIO) Verbosity ¶
func (c *CollectorIO) Verbosity() int
type Colorizer ¶
type Colorizer struct {
// contains filtered or unexported fields
}
Colorizer adds ascii color to a string
func NewColorizer ¶
func NewColorizer() *Colorizer
NewColorizer creates a new Colorizer and checks if the current terminal supports colors Currently windows is just a hard disable
type DefaultIO ¶
type DefaultIO struct {
// contains filtered or unexported fields
}
func NewDefaultIO ¶
func (*DefaultIO) IsInteractive ¶
func (*DefaultIO) StandardInput ¶
type IO ¶
type IO interface { Verbosity() int Options() map[string]string Option(name, defaultValue string) string Arguments() map[string]string Argument(name, defaultValue string) string StandardInput() []string Input() Input IsInteractive() bool IsDebug() bool IsQuiet() bool IsVerbose() bool Write(message string, newline bool, verbosity int) Ask(message string, defaultValue string) string }
Click to show internal directories.
Click to hide internal directories.