status

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 34 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

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)

func (*Client) Version

func (self *Client) Version() (v version.ZreplVersionInformation, err error)

type FilterState

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

type ItemStyle

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

func DefaultItemStyle() (s ItemStyle)

type JobDelegate

type JobDelegate struct {
	list.DefaultDelegate

	Style ItemStyle
	// contains filtered or unexported fields
}

func NewJobDelegate

func NewJobDelegate() *JobDelegate

func (*JobDelegate) Render

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

func (*JobDelegate) SetStatus

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

type JobKeys

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

func DefaultJobKeys() JobKeys

func (*JobKeys) SetEnabled

func (self *JobKeys) SetEnabled(v bool)

type JobRender

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

func NewJobRender

func NewJobRender() *JobRender

func (*JobRender) JobTimeLine

func (self *JobRender) JobTimeLine() int

func (*JobRender) JumpLines

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

func (*JobRender) Reset

func (self *JobRender) Reset()

func (*JobRender) ResetFilter

func (self *JobRender) ResetFilter()

func (*JobRender) SetFilter

func (self *JobRender) SetFilter(value string)

func (*JobRender) SetJob

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

func (*JobRender) View

func (self *JobRender) View() string

type JobStatus

type JobStatus struct {
	Styles JobStyles
	Keys   JobKeys

	Help        help.Model
	FilterInput textinput.Model

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

func NewJobStatus

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

func (*JobStatus) FullHelp

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

func (*JobStatus) NewStatusMessage

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

func (*JobStatus) Reset

func (self *JobStatus) Reset()

func (*JobStatus) SetJob

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

func (*JobStatus) ShortHelp

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

func (*JobStatus) Update

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

func (*JobStatus) View

func (self *JobStatus) View() string

func (*JobStatus) WithBackTo

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

type JobStyles

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

func DefaultJobStyles() (s JobStyles)

type JobsList

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

func NewJobsList

func NewJobsList() *JobsList

func (*JobsList) List

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

func (*JobsList) Loading

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

func (*JobsList) RefreshTitle

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

func (*JobsList) Select

func (self *JobsList) Select(name string)

func (*JobsList) SetItems

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

func (*JobsList) Update

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

func (*JobsList) View

func (self *JobsList) View() string

func (*JobsList) WithSelected

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

type ListItem

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

func (*ListItem) Description

func (self *ListItem) Description() string

func (*ListItem) FilterValue

func (self *ListItem) FilterValue() string

func (*ListItem) Title

func (self *ListItem) Title() string

type ListModel

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

func NewList

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

func NewSimpleList

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

func (*ListModel) InitDelegate

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

func (*ListModel) List

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

func (*ListModel) SetItems

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

func (*ListModel) Update

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

func (*ListModel) View

func (self *ListModel) View() string

func (*ListModel) WithBackTo

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

func (*ListModel) WithItemFunc

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

type RenderStyles

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

func DefaultRenderStyles() (s RenderStyles)

func (*RenderStyles) Filesystem

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

type StatusTUI

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

func NewStatusTUI

func NewStatusTUI(client *Client) *StatusTUI

func (*StatusTUI) Err

func (self *StatusTUI) Err() error

func (*StatusTUI) Init

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

func (*StatusTUI) Update

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

func (*StatusTUI) View

func (self *StatusTUI) View() string

func (*StatusTUI) WithInitialJob

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

func (*StatusTUI) WithUpdateEvery

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