app

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package app provides the main application logic and lifecycle management for s9s.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCommand added in v0.4.0

func ParseCommand(input string) (name string, args []string)

ParseCommand splits input into command name and arguments

Types

type ArgType added in v0.4.0

type ArgType int

ArgType identifies what kind of argument a command expects

const (
	ArgTypeNone ArgType = iota
	ArgTypeJobID
	ArgTypeNodeName
)

type CommandDef added in v0.4.0

type CommandDef struct {
	Name        string
	Aliases     []string
	Description string
	Usage       string
	MinArgs     int
	MaxArgs     int // -1 for unlimited
	Handler     CommandHandler
}

CommandDef defines a command with metadata

type CommandHandler added in v0.4.0

type CommandHandler func(args []string) CommandResult

CommandHandler is the new signature supporting arguments

type CommandResult added in v0.4.0

type CommandResult struct {
	Success bool
	Message string
	Error   error
}

CommandResult represents the outcome of a command execution

type KeyHandler added in v0.3.0

type KeyHandler func(*S9s, *tcell.EventKey) *tcell.EventKey

KeyHandler is a function that handles a keyboard event

type PluginViewAdapter

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

PluginViewAdapter adapts a plugin view to the s9s view interface.

func (*PluginViewAdapter) Hints

func (p *PluginViewAdapter) Hints() []string

Hints returns keyboard hints for the plugin view.

func (*PluginViewAdapter) Init

func (p *PluginViewAdapter) Init(ctx context.Context) error

Init initializes the plugin view with the provided context.

func (*PluginViewAdapter) Name

func (p *PluginViewAdapter) Name() string

Name returns the name of the plugin view.

func (*PluginViewAdapter) OnFocus

func (p *PluginViewAdapter) OnFocus() error

OnFocus handles focus events for the plugin view.

func (*PluginViewAdapter) OnKey

func (p *PluginViewAdapter) OnKey(event *tcell.EventKey) *tcell.EventKey

OnKey handles keyboard events for the plugin view.

func (*PluginViewAdapter) OnLoseFocus

func (p *PluginViewAdapter) OnLoseFocus() error

OnLoseFocus handles loss of focus events for the plugin view.

func (*PluginViewAdapter) Refresh

func (p *PluginViewAdapter) Refresh() error

Refresh refreshes the plugin view.

func (*PluginViewAdapter) Render

func (p *PluginViewAdapter) Render() tview.Primitive

Render returns the tview.Primitive representation of the plugin view.

func (*PluginViewAdapter) SetSwitchViewFn added in v0.3.0

func (p *PluginViewAdapter) SetSwitchViewFn(fn func(string))

SetSwitchViewFn sets the callback function to switch to another view

func (*PluginViewAdapter) Stop

func (p *PluginViewAdapter) Stop() error

Stop stops the plugin view.

func (*PluginViewAdapter) SwitchToView added in v0.3.0

func (p *PluginViewAdapter) SwitchToView(viewName string)

SwitchToView switches to another view

func (*PluginViewAdapter) Title

func (p *PluginViewAdapter) Title() string

Title returns the title of the plugin view.

type S9s

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

S9s represents the main application

func New

func New(ctx context.Context, cfg *config.Config) (*S9s, error)

New creates a new S9s application instance

func NewWithScreen added in v0.3.0

func NewWithScreen(ctx context.Context, cfg *config.Config, screen tcell.Screen) (*S9s, error)

NewWithScreen creates a new S9s application instance with an optional screen for testing

func (*S9s) GetApp added in v0.3.0

func (s *S9s) GetApp() *tview.Application

GetApp returns the tview application (for testing)

func (*S9s) GetCurrentViewName added in v0.3.0

func (s *S9s) GetCurrentViewName() string

GetCurrentViewName returns the name of the current view

func (*S9s) GetModalName added in v0.3.0

func (s *S9s) GetModalName() string

GetModalName returns the name of the currently open modal, if any

func (*S9s) GetPages added in v0.3.0

func (s *S9s) GetPages() *tview.Pages

GetPages returns the pages container (for testing)

func (*S9s) GetViewManager added in v0.3.0

func (s *S9s) GetViewManager() *views.ViewManager

GetViewManager returns the view manager (for testing)

func (*S9s) HideModal

func (s *S9s) HideModal(name string)

HideModal removes a modal dialog

func (*S9s) IsCmdVisible added in v0.3.0

func (s *S9s) IsCmdVisible() bool

IsCmdVisible returns whether the command line is visible

func (*S9s) IsModalOpen added in v0.3.0

func (s *S9s) IsModalOpen() bool

IsModalOpen checks if a modal dialog is open

func (*S9s) Run

func (s *S9s) Run() error

Run starts the application

func (*S9s) ShowModal

func (s *S9s) ShowModal(name string, modal tview.Primitive)

ShowModal displays a modal dialog over the main interface

func (*S9s) Stop

func (s *S9s) Stop() error

Stop gracefully stops the application

Jump to

Keyboard shortcuts

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