feat(indicator): Make initialIndicator() take a job description
This commit is contained in:
parent
174dcb9706
commit
42679ee63b
@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type Indicator struct {
|
||||
text string
|
||||
spinner spinner.Model
|
||||
quitting bool
|
||||
err error
|
||||
@ -29,11 +30,11 @@ func (i IndicatorInfo) String() string {
|
||||
return fmt.Sprintf("%s %s", textStyle.Render(i.duration.String()), i.info)
|
||||
}
|
||||
|
||||
func initialIndicator() Indicator {
|
||||
func initialIndicator(text string) Indicator {
|
||||
s := spinner.New()
|
||||
s.Spinner = spinner.Dot
|
||||
s.Style = lipgloss.NewStyle().Foreground(colors.green)
|
||||
return Indicator{spinner: s}
|
||||
return Indicator{spinner: s, text: text}
|
||||
}
|
||||
func (m Indicator) Init() tea.Cmd {
|
||||
return m.spinner.Tick
|
||||
@ -59,7 +60,7 @@ func (m Indicator) View() string {
|
||||
}
|
||||
str := ""
|
||||
if !m.quitting {
|
||||
str += fmt.Sprintf("\n %s Loading time logs...\n %s\n", m.spinner.View(), m.info.String())
|
||||
str += fmt.Sprintf("\n %s %s\n %s\n", m.spinner.View(), m.text, m.info.String())
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user