Documentation ¶
Index ¶
- type Job
- type JobState
- type UI
- func (ui *UI) AddJob(name, description string)
- func (ui *UI) SetJobProgress(name string, progress int) error
- func (ui *UI) SetJobProgressWithInfo(name string, progress int, infoText string) error
- func (ui *UI) SetJobState(name string, state JobState) error
- func (ui *UI) SetJobStateWithInfo(name string, state JobState, infoText string) error
- func (ui *UI) SetStatus(statusText string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { Name string Description string Progress int State JobState // contains filtered or unexported fields }
Job represents a simple job with name, description and status
func NewJob ¶
NewJob creates new Job object with given name The name parameter is not visible and is used to search for given job The description parameter is what will be shown in the ui
func (*Job) SetProgress ¶
SetProgress changes this job progress to given value. The progress value will be shown in the status text with % sign. for example [ 40% ]
func (*Job) SetProgressWithInfo ¶
SetProgressWithInfo changes this job progress to given value. The progress value will be shown in the status text with % sign. for example [ 40% ]
func (*Job) SetState ¶
SetState changes this job state to given one. The job will change it's text color and state text
func (*Job) SetStateWithInfo ¶
SetStateWithInfo changes this job state to the given one. The job will change it's text color and state text. Also additional text will be appended to the job description after ':' sign
type UI ¶
type UI struct { Jobs map[string]*Job JobsDone chan bool // contains filtered or unexported fields }
UI is a base struct for the interface
func NewUI ¶
func NewUI() *UI
NewUI creates new interface with empty jobs list The ui event loop is started immediately in a seperate gorotuine
func (*UI) AddJob ¶
AddJob adds job to the ui list with given name and description The name is used only internally for lookup operations The description is what will be visible in the ui
func (*UI) SetJobProgress ¶
SetJobProgress sets job to active state and set its progress to given value If value is >= 100 the job state will automatically change to Done
func (*UI) SetJobProgressWithInfo ¶
SetJobProgressWithInfo sets job to active state and set its progress to given value, with additional text appended to its description If value is >= 100 the job state will automatically change to Done
func (*UI) SetJobState ¶
SetJobState sets job to given state
func (*UI) SetJobStateWithInfo ¶
SetJobStateWithInfo sets job to given state, with additonal info text appended to its description