display

package
v0.18.3-0...-c90ca1e Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskSpinner  = []string{"⣷", "⣯", "⣟", "⡿", "⢿", "⣻", "⣽", "⣾"}
	TaskComplete = "✓"
	TaskPause    = "*"
)

...

View Source
var (
	// Log - enable logging to a file
	Log = true

	// LogFile - the location of logfile
	LogFile = filepath.ToSlash(filepath.Join(config.GlobalDir(), "process.log"))

	// Summary - summarize the output and hide log details
	Summary = true

	// Interactive - re-draw the summary when updates occur
	Interactive = terminal.IsTerminal(int(os.Stderr.Fd()))

	// Level - info, warn, error, debug, trace
	Level = "info"

	// Mode - text, json
	Mode = "text"

	// Out - writer to send output to
	Out io.Writer = os.Stdout
)
View Source
var (
	EscSeqRegex   = regexp.MustCompile("\\x1b[[][?0123456789]*;?[?0123456789]*[ABEFHJRSTfminsulhp]")
	LogStripRegex = regexp.MustCompile("^[ \t-]*")
)

...

View Source
var (
	CmdErrRegex = regexp.MustCompile(":\\s?$")
)

Functions

func Ask

func Ask(question string) (string, error)

func BadPortType

func BadPortType(protocol string)

func BadTerminal

func BadTerminal()

func CloseContext

func CloseContext() error

CloseContext closes the context level and prints a newline

func CommandErr

func CommandErr(err error)

CommandErr ...

We hit a minor bump, which can be quickly resolved following the instructions above. If not, come talk and we'll walk you through the resolution.

func ConsoleLocalCode

func ConsoleLocalCode()

func ConsoleNodeNotFound

func ConsoleNodeNotFound()

func Debug

func Debug(message string, args ...interface{}) error

Debug sends a debug level message to the current task

func DeployComplete

func DeployComplete()

func DevRunEmpty

func DevRunEmpty()

func Error

func Error(message string, args ...interface{}) error

Error sends an error level message to the current task

func ErrorTask

func ErrorTask() error

ErrorTask errors the current task

func FirstBuild

func FirstBuild()

func FirstDeploy

func FirstDeploy()

func FormatLogMessage

func FormatLogMessage(msg mist.Message, showTimestamp bool)

FormatLogMessage takes a Logvac/Mist and formats it into a pretty message to be output to the terminal

func FormatLogvacMessage

func FormatLogvacMessage(msg logvac.Message, showTimestamp bool)

FormatLogvacMessage takes a Logvac/Mist and formats it into a pretty message to be output to the terminal

func Info

func Info(message string, args ...interface{}) error

Info sends an info level message to the current task

func InfoDevContainer

func InfoDevContainer(ip string)

func InfoDevRunContainer

func InfoDevRunContainer(cmd, ip string)

func InfoLocalContainer

func InfoLocalContainer()

func InfoProductionContainer

func InfoProductionContainer()

func InfoProductionHost

func InfoProductionHost()

func InfoSimDeploy

func InfoSimDeploy(ip string)

func InvalidBoxfile

func InvalidBoxfile()

func LocalEngineNotFound

func LocalEngineNotFound()

func LoginComplete

func LoginComplete()

func LoginRequired

func LoginRequired()

func MOTD

func MOTD()

func MigrateOldRequired

func MigrateOldRequired()

func MigrateProviderRequired

func MigrateProviderRequired()

func MissingBoxfile

func MissingBoxfile()

func MissingDependencies

func MissingDependencies(provider string, missingParts []string)

func NetworkCreateError

func NetworkCreateError(name, network string)

func NoGonanaUser

func NoGonanaUser()

func OpenContext

func OpenContext(format string, args ...interface{}) error

OpenContext opens a context level and prints the header

func PauseTask

func PauseTask()

PauseTask pauses the summarizer so you can print to stdout.

func PortInUse

func PortInUse(port string)

func PortPrivileged

func PortPrivileged(port string)

func PrintRequiresPrivilege

func PrintRequiresPrivilege(reason string)

PrintRequiresPrivilege prints a message informing privilege escalation is required

func ProviderSetup

func ProviderSetup()

func ReadPassword

func ReadPassword(label string) (string, error)

ReadPassword reads a password from the terminal and masks the input

func ReadUsername

func ReadUsername() (string, error)

get the username

func ResumeTask

func ResumeTask()

ResumeTask resumes the summarizer, so output is swallowed unless `-v` is passed.

func StartTask

func StartTask(format string, args ...interface{}) error

StartTask starts a new task

func StopTask

func StopTask() error

StopTask stops the current task

func TooManyKeys

func TooManyKeys()

func Trace

func Trace(message string, args ...interface{}) error

Trace sends a trace level message to the current task

func TunnelEstablished

func TunnelEstablished(component, port string)

func UnexpectedPrivilage

func UnexpectedPrivilage()

func VMCommunicationError

func VMCommunicationError()

func Warn

func Warn(message string, args ...interface{}) error

Warn sends a warn level message to the current task

func WorldWritable

func WorldWritable()

Types

type Details

type Details struct {
	Current int `json:"current"`
	Total   int `json:"total"`
}

Details ...

type DockerPercentDisplay

type DockerPercentDisplay struct {
	Output io.Writer
	Prefix string
	// contains filtered or unexported fields
}

DockerPercentDisplay ...

func (*DockerPercentDisplay) Write

func (display *DockerPercentDisplay) Write(data []byte) (int, error)

Write ...

type DockerPercentPart

type DockerPercentPart struct {
	// contains filtered or unexported fields
}

DockerPercentPart ...

type DownloadPercent

type DownloadPercent struct {
	Total  int64
	Output io.Writer
	// contains filtered or unexported fields
}

func (*DownloadPercent) Copy

func (dp *DownloadPercent) Copy(writer io.Writer, reader io.Reader) (err error)

func (*DownloadPercent) SimpleDisplay

func (dp *DownloadPercent) SimpleDisplay()

func (*DownloadPercent) UpdateDisplay

func (dp *DownloadPercent) UpdateDisplay()

type Entry

type Entry struct {
	Time     time.Time `json:"time"`     // "2016-09-07T20:33:34.446275741Z"
	UTime    int       `json:"utime"`    // 1473280414446275741
	ID       string    `json:"id"`       // "mist"
	Tag      []string  `json:"tag"`      // ["mist[daemon]", "mist"]
	Type     string    `json:"type"`     // "app"
	Priority int       `json:"priority"` // 4
	Message  string    `json:"message"`  // "2016-09-07T20:33:34.44586 2016-09-07 20:33:34 INFO  Api Listening on https://0.0.0.0:6361..."
}

Entry represents the data comming back from a mist message (mist.Message.Data)

type Prefixer

type Prefixer struct {
	// contains filtered or unexported fields
}

Prefixer ...

func NewPrefixer

func NewPrefixer(prefix string) *Prefixer

NewPrefixer returns a Prefixer struct

func (*Prefixer) Parse

func (p *Prefixer) Parse(data string) string

Parse ...

type Status

type Status struct {
	Status  string  `json:"status,omitempty"`
	ID      string  `json:"id,omitempty"`
	Details Details `json:"progressDetail"`
}

Status ... {"status":"Downloading","progressDetail":{"current":676,"total":755},"progress":"[============================================\u003e ] 676 B/755 B","id":"166102ec41af"}

type Streamer

type Streamer struct {
	// contains filtered or unexported fields
}

Streamer ...

func NewPrefixedStreamer

func NewPrefixedStreamer(logLevel string, prefix string) Streamer

NewPrefixedStreamer returns a new Streamer with a Prefixer

func NewStreamer

func NewStreamer(logLevel string) *Streamer

NewStreamer returns a new Streamer

func (*Streamer) CaptureOutput

func (s *Streamer) CaptureOutput(output bool)

CaptureOutput will write messages to the message var.

func (Streamer) Output

func (s Streamer) Output() string

func (*Streamer) Write

func (s *Streamer) Write(p []byte) (n int, err error)

Write implements the io.Writer interface to write bytes on a writer

type Summarizer

type Summarizer struct {
	Label  string    // the task label to print as the header
	Prefix string    // the prefix to prepend to the summary
	Out    io.Writer // writer to send output to
	// contains filtered or unexported fields
}

Summarizer ...

func NewSummarizer

func NewSummarizer(label string, prefix string) *Summarizer

NewSummarizer returns a new Summarizer

func (*Summarizer) Error

func (s *Summarizer) Error()

Error will stop the summary process and print an error header

func (*Summarizer) Log

func (s *Summarizer) Log(msg string)

Log sends a log message to the summary process

func (*Summarizer) Pause

func (s *Summarizer) Pause()

Pause ...

func (*Summarizer) Resume

func (s *Summarizer) Resume()

Resume prints the "complete" label and toggles shutdown

func (*Summarizer) Start

func (s *Summarizer) Start()

Start starts the summary process in a goroutine

func (*Summarizer) Stop

func (s *Summarizer) Stop()

Stop stops the summary process

Jump to

Keyboard shortcuts

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