status

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Subcommand = &cli.Subcommand{
	Use:   "status",
	Short: "display daemon status information",

	SetupCobra: func(cmd *cobra.Command) {
		cmd.Args = cobra.ExactArgs(0)
		addSelectedJob(cmd)
		cmd.Flags().DurationVarP(&refreshInterval, "delay", "d", 1*time.Second,
			"refresh interval")
	},

	SetupSubcommands: func() []*cli.Subcommand {
		return []*cli.Subcommand{dumpCmd, rawCmd}
	},

	Run: func(ctx context.Context, cmd *cli.Subcommand, args []string) error {
		return withStatusClient(cmd, func(c *Client) error {
			model := NewStatusTUI(c).WithInitialJob(selectedJob).
				WithUpdateEvery(refreshInterval)
			p := tea.NewProgram(model, tea.WithAltScreen())
			if _, err := p.Run(); err != nil {
				return fmt.Errorf("running program: %w", err)
			}
			return model.Err()
		})
	},
}

Functions

This section is empty.

Types

type Client

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

func NewClient added in v0.8.0

func NewClient(network, addr string) (*Client, error)

func (*Client) SignalReset

func (self *Client) SignalReset(job string) error

func (*Client) SignalWakeup

func (self *Client) SignalWakeup(job string) error

func (*Client) Status

func (self *Client) Status() (s daemon.Status, err error)

func (*Client) StatusRaw

func (self *Client) StatusRaw() ([]byte, error)

type FilterState added in v0.8.0

type FilterState uint
const (
	Unfiltered FilterState = iota
	Filtering
	FilterApplied
)

type ItemStyle added in v0.8.0

type ItemStyle struct {
	Time lipgloss.Style

	Running  lipgloss.Style
	Sleeping lipgloss.Style

	WithError lipgloss.Style

	Steps           lipgloss.Style
	ActiveStepDot   lipgloss.Style
	InactiveStepDot lipgloss.Style

	Bar lipgloss.Style
}

func DefaultItemStyle added in v0.8.0

func DefaultItemStyle() (s ItemStyle)

type JobDelegate added in v0.8.0

type JobDelegate struct {
	list.DefaultDelegate

	Style ItemStyle
	// contains filtered or unexported fields
}

func NewJobDelegate added in v0.8.0

func NewJobDelegate() *JobDelegate

func (*JobDelegate) Render added in v0.8.0

func (self *JobDelegate) Render(w io.Writer, m list.Model, index int,
	item list.Item,
)

func (*JobDelegate) SetStatus added in v0.8.0

func (self *JobDelegate) SetStatus(s *daemon.Status, items []ListItem)

type JobKeys added in v0.8.0

type JobKeys struct {
	GoToStart   key.Binding
	GoToEnd     key.Binding
	Filter      key.Binding
	ClearFilter key.Binding

	CancelWhileFiltering key.Binding
	AcceptWhileFiltering key.Binding

	Jump   key.Binding
	Back   key.Binding
	Signal key.Binding

	ShowFullHelp  key.Binding
	CloseFullHelp key.Binding

	Quit      key.Binding
	ForceQuit key.Binding
}

func DefaultJobKeys added in v0.8.0

func DefaultJobKeys() JobKeys

func (*JobKeys) SetEnabled added in v0.8.0

func (self *JobKeys) SetEnabled(v bool)

type JobRender added in v0.8.0

type JobRender struct {
	Styles RenderStyles
	// contains filtered or unexported fields
}

func NewJobRender added in v0.8.0

func NewJobRender() *JobRender

func (*JobRender) JobTimeLine added in v0.8.1

func (self *JobRender) JobTimeLine() int

func (*JobRender) JumpLines added in v0.8.1

func (self *JobRender) JumpLines() []int

func (*JobRender) Reset added in v0.8.0

func (self *JobRender) Reset()

func (*JobRender) ResetFilter added in v0.8.0

func (self *JobRender) ResetFilter()

func (*JobRender) SetFilter added in v0.8.0

func (self *JobRender) SetFilter(value string)

func (*JobRender) SetJob added in v0.8.0

func (self *JobRender) SetJob(job *job.Status)

func (*JobRender) View added in v0.8.0

func (self *JobRender) View() string

type JobStatus added in v0.8.0

type JobStatus struct {
	Styles JobStyles
	Keys   JobKeys

	Help        help.Model
	FilterInput textinput.Model

	StatusMessageLifetime time.Duration
	// contains filtered or unexported fields
}

func NewJobStatus added in v0.8.0

func NewJobStatus(client *Client, render *JobRender) *JobStatus

func (*JobStatus) FullHelp added in v0.8.0

func (self *JobStatus) FullHelp() [][]key.Binding

func (*JobStatus) NewStatusMessage added in v0.8.0

func (self *JobStatus) NewStatusMessage(s string) tea.Cmd

func (*JobStatus) Reset added in v0.8.0

func (self *JobStatus) Reset()

func (*JobStatus) SetJob added in v0.8.0

func (self *JobStatus) SetJob(name string, job *job.Status)

func (*JobStatus) ShortHelp added in v0.8.0

func (self *JobStatus) ShortHelp() []key.Binding

func (*JobStatus) Update added in v0.8.0

func (self *JobStatus) Update(msg tea.Msg) tea.Cmd

func (*JobStatus) View added in v0.8.0

func (self *JobStatus) View() string

func (*JobStatus) WithBackTo added in v0.8.0

func (self *JobStatus) WithBackTo(fn func()) *JobStatus

type JobStyles added in v0.8.0

type JobStyles struct {
	TitleBar     lipgloss.Style
	Title        lipgloss.Style
	FilterPrompt lipgloss.Style
	FilterCursor lipgloss.Style

	StatusBar lipgloss.Style

	View lipgloss.Style

	Pagination lipgloss.Style
	Help       lipgloss.Style

	ActivePaginationDot   lipgloss.Style
	InactivePaginationDot lipgloss.Style
	ArabicPagination      lipgloss.Style

	DividerDot lipgloss.Style
}

func DefaultJobStyles added in v0.8.0

func DefaultJobStyles() (s JobStyles)

type JobsList added in v0.8.0

type JobsList struct {
	Choose key.Binding
	Style  lipgloss.Style
	// contains filtered or unexported fields
}

func NewJobsList added in v0.8.0

func NewJobsList() *JobsList

func (*JobsList) List added in v0.8.0

func (self *JobsList) List() *list.Model

func (*JobsList) Loading added in v0.8.0

func (self *JobsList) Loading() tea.Cmd

func (*JobsList) RefreshTitle added in v0.8.1

func (self *JobsList) RefreshTitle() tea.Cmd

func (*JobsList) Select added in v0.8.0

func (self *JobsList) Select(name string)

func (*JobsList) SetItems added in v0.8.0

func (self *JobsList) SetItems(status *daemon.Status) tea.Cmd

func (*JobsList) Update added in v0.8.0

func (self *JobsList) Update(msg tea.Msg) tea.Cmd

func (*JobsList) View added in v0.8.0

func (self *JobsList) View() string

func (*JobsList) WithSelected added in v0.8.0

func (self *JobsList) WithSelected(fn func(name string)) *JobsList

type ListItem added in v0.8.0

type ListItem struct {
	Caption  string
	Desc     string
	Func     func() tea.Cmd
	ItemFunc func(item *ListItem) tea.Cmd
}

func (*ListItem) Description added in v0.8.0

func (self *ListItem) Description() string

func (*ListItem) FilterValue added in v0.8.0

func (self *ListItem) FilterValue() string

func (*ListItem) Title added in v0.8.0

func (self *ListItem) Title() string

type ListModel added in v0.8.0

type ListModel struct {
	Choose key.Binding
	Style  lipgloss.Style
	// contains filtered or unexported fields
}

func NewList added in v0.8.0

func NewList(items []ListItem, d list.ItemDelegate, w, h int) *ListModel

func NewSimpleList added in v0.8.0

func NewSimpleList(items []ListItem, w, h int, title string) *ListModel

func (*ListModel) InitDelegate added in v0.8.0

func (self *ListModel) InitDelegate(d *list.DefaultDelegate)

func (*ListModel) List added in v0.8.0

func (self *ListModel) List() *list.Model

func (*ListModel) SetItems added in v0.8.0

func (self *ListModel) SetItems(items []ListItem)

func (*ListModel) Update added in v0.8.0

func (self *ListModel) Update(msg tea.Msg) tea.Cmd

func (*ListModel) View added in v0.8.0

func (self *ListModel) View() string

func (*ListModel) WithBackTo added in v0.8.0

func (self *ListModel) WithBackTo(fn func()) *ListModel

func (*ListModel) WithItemFunc added in v0.8.0

func (self *ListModel) WithItemFunc(fn func(item *ListItem) tea.Cmd,
) *ListModel

type RenderStyles added in v0.8.0

type RenderStyles struct {
	Title   lipgloss.Style
	Content lipgloss.Style
	Indent  lipgloss.Style

	NotYet lipgloss.Style

	InactiveFsIcon lipgloss.Style
	RunningFsIcon  lipgloss.Style

	InactiveFs lipgloss.Style
	RunningFs  lipgloss.Style
	FsNext     lipgloss.Style

	FilterMatch          lipgloss.Style
	StatusBar            lipgloss.Style
	StatusEmpty          lipgloss.Style
	StatusBarFilterCount lipgloss.Style
	DividerDot           lipgloss.Style

	SnapState lipgloss.Style
	SnapTime  lipgloss.Style
}

func DefaultRenderStyles added in v0.8.0

func DefaultRenderStyles() (s RenderStyles)

func (*RenderStyles) Filesystem added in v0.8.0

func (self *RenderStyles) Filesystem(running bool) (lipgloss.Style,
	lipgloss.Style,
)

type StatusTUI added in v0.8.0

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

func NewStatusTUI added in v0.8.0

func NewStatusTUI(client *Client) *StatusTUI

func (*StatusTUI) Err added in v0.8.0

func (self *StatusTUI) Err() error

func (*StatusTUI) Init added in v0.8.0

func (self *StatusTUI) Init() tea.Cmd

func (*StatusTUI) Update added in v0.8.0

func (self *StatusTUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*StatusTUI) View added in v0.8.0

func (self *StatusTUI) View() string

func (*StatusTUI) WithInitialJob added in v0.8.0

func (self *StatusTUI) WithInitialJob(name string) *StatusTUI

func (*StatusTUI) WithUpdateEvery added in v0.8.0

func (self *StatusTUI) WithUpdateEvery(d time.Duration) *StatusTUI

Jump to

Keyboard shortcuts

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