console

package
v0.0.0-...-d7f6bd1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Bar print progress bar
	Bar = func(data ...interface{}) {
		print(themesDB[currThemeName].Bar, data...)
	}

	// Print prints a message
	Print = func(data ...interface{}) {
		print(themesDB[currThemeName].Print, data...)
		return
	}

	// PrintC prints a message with color
	PrintC = func(data ...interface{}) {
		print(themesDB[currThemeName].PrintC, data...)
		return
	}

	// Printf prints a formatted message
	Printf = func(f string, data ...interface{}) {
		printf(themesDB[currThemeName].Print, f, data...)
		return
	}

	// Println prints a message with a newline
	Println = func(data ...interface{}) {
		println(themesDB[currThemeName].Print, data...)
	}

	// Fatal print a error message and exit
	Fatal = func(data ...interface{}) {
		defer os.Exit(1)
		print(themesDB[currThemeName].Fatal, data...)
		return
	}

	// Fatalf print a error message with a format specified and exit
	Fatalf = func(f string, data ...interface{}) {
		defer os.Exit(1)
		printf(themesDB[currThemeName].Fatal, f, data...)
		return
	}

	// Fatalln print a error message with a new line and exit
	Fatalln = func(data ...interface{}) {
		defer os.Exit(1)
		println(themesDB[currThemeName].Fatal, data...)
		return
	}

	// Error prints a error message
	Error = func(data ...interface{}) {
		print(themesDB[currThemeName].Error, data...)
		return
	}

	// Errorf print a error message with a format specified
	Errorf = func(f string, data ...interface{}) {
		printf(themesDB[currThemeName].Error, f, data...)
		return
	}

	// Errorln prints a error message with a new line
	Errorln = func(data ...interface{}) {
		println(themesDB[currThemeName].Error, data...)
		return
	}

	// Info prints a informational message
	Info = func(data ...interface{}) {
		print(themesDB[currThemeName].Info, data...)
		return
	}

	// Infof prints a informational message in custom format
	Infof = func(f string, data ...interface{}) {
		printf(themesDB[currThemeName].Info, f, data...)
		return
	}

	// Infoln prints a informational message with a new line
	Infoln = func(data ...interface{}) {
		println(themesDB[currThemeName].Info, data...)
		return
	}

	// Debug prints a debug message without a new line
	// Debug prints a debug message
	Debug = func(data ...interface{}) {
		if !NoDebugPrint {
			print(themesDB[currThemeName].Debug, data...)
		}
	}

	// Debugf prints a debug message with a new line
	Debugf = func(f string, data ...interface{}) {
		if !NoDebugPrint {
			printf(themesDB[currThemeName].Debug, f, data...)
		}
	}

	// Debugln prints a debug message with a new line
	Debugln = func(data ...interface{}) {
		if !NoDebugPrint {
			println(themesDB[currThemeName].Debug, data...)
		}
	}

	// Time helper to print Time theme
	Time = themesDB[currThemeName].Time.SprintfFunc()
	// Size helper to print Size theme
	Size = themesDB[currThemeName].Size.SprintfFunc()
	// File helper to print File theme
	File = themesDB[currThemeName].File.SprintfFunc()
	// Dir helper to print Dir theme
	Dir = themesDB[currThemeName].Dir.SprintfFunc()
	// Command helper to print command theme
	Command = themesDB[currThemeName].Command.SprintfFunc()
	// SessionID helper to print sessionid theme
	SessionID = themesDB[currThemeName].SessionID.SprintfFunc()
	// JSON helper to print json strings
	JSON = themesDB[currThemeName].JSON.SprintfFunc()
)

MiniTheme - Minio's default color theme

View Source
var NoColorTheme = Theme{
	Debug:     (color.New()),
	Fatal:     (color.New()),
	Error:     (color.New()),
	Info:      (color.New()),
	File:      (color.New()),
	Dir:       (color.New()),
	Command:   (color.New()),
	SessionID: (color.New()),
	Size:      (color.New()),
	Time:      (color.New()),
	JSON:      (color.New()),
	Bar:       (color.New()),
	PrintC:    (color.New()),
	Print:     (color.New()),
}

NoColorTheme - Disables color theme

View Source
var NoDebugPrint = true

NoDebugPrint defines if the input should be printed in debug or not. By default it's set to true.

WhiteTheme - All white color theme

Functions

func GetDefaultThemeName

func GetDefaultThemeName() string

GetDefaultThemeName returns the default theme

func GetThemeName

func GetThemeName() string

GetThemeName returns currently set theme name

func GetThemeNames

func GetThemeNames() (themeNames []string)

GetThemeNames returns currently supported list of themes

func IsValidTheme

func IsValidTheme(themeName string) bool

IsValidTheme returns true if "themeName" is currently supported

func Lock

func Lock()

Lock console

func ProgramName

func ProgramName() string

ProgramName - return the name of the executable program

func SetTheme

func SetTheme(themeName string) error

SetTheme sets a color theme

func Unlock

func Unlock()

Unlock locked console

Types

type Theme

type Theme struct {
	Fatal     *color.Color
	Error     *color.Color
	Info      *color.Color
	Debug     *color.Color
	Size      *color.Color
	Time      *color.Color
	File      *color.Color
	Dir       *color.Color
	Command   *color.Color
	SessionID *color.Color
	JSON      *color.Color
	Bar       *color.Color
	PrintC    *color.Color
	Print     *color.Color
}

Theme holds console color scheme

Jump to

Keyboard shortcuts

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