Documentation
¶
Overview ¶
Package app provides the main application logic and lifecycle management for s9s.
Index ¶
- func ParseCommand(input string) (name string, args []string)
- type ArgType
- type CommandDef
- type CommandHandler
- type CommandResult
- type KeyHandler
- type PluginViewAdapter
- func (p *PluginViewAdapter) Hints() []string
- func (p *PluginViewAdapter) Init(ctx context.Context) error
- func (p *PluginViewAdapter) Name() string
- func (p *PluginViewAdapter) OnFocus() error
- func (p *PluginViewAdapter) OnKey(event *tcell.EventKey) *tcell.EventKey
- func (p *PluginViewAdapter) OnLoseFocus() error
- func (p *PluginViewAdapter) Refresh() error
- func (p *PluginViewAdapter) Render() tview.Primitive
- func (p *PluginViewAdapter) SetSwitchViewFn(fn func(string))
- func (p *PluginViewAdapter) Stop() error
- func (p *PluginViewAdapter) SwitchToView(viewName string)
- func (p *PluginViewAdapter) Title() string
- type S9s
- func (s *S9s) GetApp() *tview.Application
- func (s *S9s) GetCurrentViewName() string
- func (s *S9s) GetModalName() string
- func (s *S9s) GetPages() *tview.Pages
- func (s *S9s) GetViewManager() *views.ViewManager
- func (s *S9s) HideModal(name string)
- func (s *S9s) IsCmdVisible() bool
- func (s *S9s) IsModalOpen() bool
- func (s *S9s) Run() error
- func (s *S9s) ShowModal(name string, modal tview.Primitive)
- func (s *S9s) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCommand ¶ added in v0.4.0
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
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
CommandResult represents the outcome of a command execution
type KeyHandler ¶ added in v0.3.0
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 NewWithScreen ¶ added in v0.3.0
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
GetCurrentViewName returns the name of the current view
func (*S9s) GetModalName ¶ added in v0.3.0
GetModalName returns the name of the currently open modal, if any
func (*S9s) GetViewManager ¶ added in v0.3.0
func (s *S9s) GetViewManager() *views.ViewManager
GetViewManager returns the view manager (for testing)
func (*S9s) IsCmdVisible ¶ added in v0.3.0
IsCmdVisible returns whether the command line is visible
func (*S9s) IsModalOpen ¶ added in v0.3.0
IsModalOpen checks if a modal dialog is open