ui

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func NewApp

func NewApp() App

func (App) Init

func (a App) Init() tea.Cmd

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (App) View

func (a App) View() string

type BookmarksModel

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

func NewBookmarksModel

func NewBookmarksModel(host, port, user string) BookmarksModel

func (BookmarksModel) Init

func (m BookmarksModel) Init() tea.Cmd

func (BookmarksModel) Update

func (m BookmarksModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (BookmarksModel) View

func (m BookmarksModel) View() string

type BrowserModel

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

func NewBrowserModel

func NewBrowserModel(fs FileSystem) BrowserModel

func NewBrowserModelSide

func NewBrowserModelSide(fs FileSystem, side int) BrowserModel

NewBrowserModelSide constructs a browser tagged with a side identifier so the parent TwoPane can route async messages back to the panel that issued them. Single-pane callers should use NewBrowserModel.

func (BrowserModel) ConnInfo

func (m BrowserModel) ConnInfo() string

func (BrowserModel) CurrentPath

func (m BrowserModel) CurrentPath() string

func (BrowserModel) FS

func (m BrowserModel) FS() FileSystem

func (BrowserModel) Init

func (m BrowserModel) Init() tea.Cmd

func (BrowserModel) LoadPath

func (m BrowserModel) LoadPath(p string) tea.Cmd

LoadPath navigates the browser to p on its next tick. Used by the App when the user picks a bookmark — the BrowserModel itself remembers cursorMem, so backing out to the previous path with `h` still feels natural.

func (BrowserModel) Refresh

func (m BrowserModel) Refresh() tea.Cmd

func (BrowserModel) Side

func (m BrowserModel) Side() int

func (BrowserModel) Update

func (m BrowserModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (BrowserModel) View

func (m BrowserModel) View() string

type CachedFS

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

CachedFS wraps a FileSystem and memoises List(path) results. Cache is invalidated explicitly on Refresh (`R` in the UI) and on any write op that changes a directory's contents (Mkdir/Rename/Remove/Chmod). There's no TTL — stale entries persist until invalidated, which matches the requirement that stale cache reflects user intent ("I haven't pressed R").

func NewCachedFS

func NewCachedFS(inner FileSystem) *CachedFS

func (*CachedFS) Base

func (c *CachedFS) Base(p string) string

func (*CachedFS) Chmod

func (c *CachedFS) Chmod(p string, m os.FileMode) error

func (*CachedFS) Dir

func (c *CachedFS) Dir(p string) string

func (*CachedFS) Home

func (c *CachedFS) Home() string

func (*CachedFS) Inner

func (c *CachedFS) Inner() FileSystem

Inner returns the underlying FS — used by code that needs a concrete *RemoteFS (e.g. to access *sftp.Client for copy/edit).

func (*CachedFS) Invalidate

func (c *CachedFS) Invalidate(p string)

func (*CachedFS) InvalidateAll

func (c *CachedFS) InvalidateAll()

func (*CachedFS) Join

func (c *CachedFS) Join(parts ...string) string

func (*CachedFS) Kind

func (c *CachedFS) Kind() string

func (*CachedFS) Label

func (c *CachedFS) Label() string

func (*CachedFS) List

func (c *CachedFS) List(p string) ([]sftpclient.FileEntry, error)

func (*CachedFS) Mkdir

func (c *CachedFS) Mkdir(p string) error

func (*CachedFS) ReadFileChunk

func (c *CachedFS) ReadFileChunk(p string, n int64) ([]byte, bool, error)

func (*CachedFS) ReadFileRange

func (c *CachedFS) ReadFileRange(p string, offset, maxBytes int64) ([]byte, int64, error)
func (c *CachedFS) Readlink(p string) (string, error)

func (*CachedFS) Remove

func (c *CachedFS) Remove(p string) error

func (*CachedFS) RemoveAll

func (c *CachedFS) RemoveAll(p string) error

func (*CachedFS) Rename

func (c *CachedFS) Rename(o, n string) error

func (*CachedFS) Stat

func (c *CachedFS) Stat(p string) (sftpclient.FileEntry, error)

type ConnListModel

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

func NewConnListModel

func NewConnListModel() ConnListModel

func (ConnListModel) Init

func (m ConnListModel) Init() tea.Cmd

func (ConnListModel) Update

func (m ConnListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ConnListModel) View

func (m ConnListModel) View() string

type ConnectField

type ConnectField int

type ConnectModel

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

func NewConnectModel

func NewConnectModel() ConnectModel

func (ConnectModel) Init

func (m ConnectModel) Init() tea.Cmd

func (*ConnectModel) Prefill

func (m *ConnectModel) Prefill(c ConnectedMsg)

Prefill loads connection details into the form. Used when the user selects a saved/ssh-config entry from the connections list. KeyPath is included; password and passphrase are left blank deliberately — saved-connection records do not store secrets.

func (ConnectModel) Update

func (m ConnectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ConnectModel) View

func (m ConnectModel) View() string

type ConnectedMsg

type ConnectedMsg struct {
	Host          string
	Port          string
	User          string
	Password      string
	KeyPath       string
	KeyPassphrase string
	ProxyJump     string
}

type DownloadModel

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

func NewDownloadModel

func NewDownloadModel(client *sftpclient.Client, entries []sftpclient.FileEntry, localDir string) DownloadModel

func (DownloadModel) Init

func (m DownloadModel) Init() tea.Cmd

func (DownloadModel) Update

func (m DownloadModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DownloadModel) View

func (m DownloadModel) View() string

type EditModel

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

func NewEditModel

func NewEditModel(fs FileSystem, entry sftpclient.FileEntry) EditModel

func (EditModel) Init

func (m EditModel) Init() tea.Cmd

func (EditModel) Update

func (m EditModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (EditModel) View

func (m EditModel) View() string

type ErrLogModel

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

func NewErrLogModel

func NewErrLogModel(entries []errLogEntry) ErrLogModel

func (ErrLogModel) Init

func (m ErrLogModel) Init() tea.Cmd

func (ErrLogModel) Update

func (m ErrLogModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ErrLogModel) View

func (m ErrLogModel) View() string

type FileSystem

type FileSystem interface {
	List(path string) ([]sftpclient.FileEntry, error)
	Stat(path string) (sftpclient.FileEntry, error)
	Remove(path string) error
	RemoveAll(path string) error
	Rename(oldPath, newPath string) error
	Mkdir(path string) error
	Chmod(path string, mode os.FileMode) error
	ReadFileChunk(path string, maxBytes int64) (data []byte, truncated bool, err error)
	ReadFileRange(path string, offset, maxBytes int64) (data []byte, total int64, err error)
	Readlink(path string) (string, error)

	Home() string
	Join(parts ...string) string
	Dir(p string) string
	Base(p string) string

	// Kind returns "local" or "remote" — used by TwoPane to decide transfer
	// direction.
	Kind() string
	// Label is shown in the panel header (e.g. "local" or "user@host:port").
	Label() string
}

FileSystem is the minimal set of operations both panels need. The remote adapter wraps *sftpclient.Client; the local adapter calls into os/filepath. All methods take absolute paths in the filesystem's native format.

Path manipulation is delegated to the FS because the local side may use platform-specific separators (Windows in the future); both adapters here normalize to forward slashes on Linux/Mac.

type HostPromptModel

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

func NewHostPromptModel

func NewHostPromptModel(challenge *sftpclient.UnknownHostKeyError) HostPromptModel

func (HostPromptModel) Init

func (m HostPromptModel) Init() tea.Cmd

func (HostPromptModel) Update

func (m HostPromptModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (HostPromptModel) View

func (m HostPromptModel) View() string

type LocalFS

type LocalFS struct{}

func NewLocalFS

func NewLocalFS() *LocalFS

func (*LocalFS) Base

func (l *LocalFS) Base(p string) string

func (*LocalFS) Chmod

func (l *LocalFS) Chmod(p string, m os.FileMode) error

func (*LocalFS) Dir

func (l *LocalFS) Dir(p string) string

func (*LocalFS) Home

func (l *LocalFS) Home() string

func (*LocalFS) Join

func (l *LocalFS) Join(parts ...string) string

func (*LocalFS) Kind

func (l *LocalFS) Kind() string

func (*LocalFS) Label

func (l *LocalFS) Label() string

func (*LocalFS) List

func (l *LocalFS) List(p string) ([]sftpclient.FileEntry, error)

func (*LocalFS) Mkdir

func (l *LocalFS) Mkdir(p string) error

func (*LocalFS) ReadFileChunk

func (l *LocalFS) ReadFileChunk(p string, maxBytes int64) ([]byte, bool, error)

func (*LocalFS) ReadFileRange

func (l *LocalFS) ReadFileRange(p string, offset, maxBytes int64) ([]byte, int64, error)
func (l *LocalFS) Readlink(p string) (string, error)

func (*LocalFS) Remove

func (l *LocalFS) Remove(p string) error

func (*LocalFS) RemoveAll

func (l *LocalFS) RemoveAll(p string) error

func (*LocalFS) Rename

func (l *LocalFS) Rename(o, n string) error

func (*LocalFS) Stat

func (l *LocalFS) Stat(p string) (sftpclient.FileEntry, error)

type PassphraseModel

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

func NewPassphraseModel

func NewPassphraseModel(keyPath string, bad bool) PassphraseModel

func (PassphraseModel) Init

func (m PassphraseModel) Init() tea.Cmd

func (PassphraseModel) Update

func (m PassphraseModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PassphraseModel) View

func (m PassphraseModel) View() string

type PreviewModel

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

func NewPreviewModel

func NewPreviewModel(fs FileSystem, entry sftpclient.FileEntry) PreviewModel

func (PreviewModel) Init

func (m PreviewModel) Init() tea.Cmd

func (PreviewModel) Update

func (m PreviewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PreviewModel) View

func (m PreviewModel) View() string

type RemoteFS

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

func NewRemoteFS

func NewRemoteFS(client *sftpclient.Client, label string) *RemoteFS

func (*RemoteFS) Base

func (r *RemoteFS) Base(p string) string

func (*RemoteFS) Chmod

func (r *RemoteFS) Chmod(p string, m os.FileMode) error

func (*RemoteFS) Client

func (r *RemoteFS) Client() *sftpclient.Client

func (*RemoteFS) Dir

func (r *RemoteFS) Dir(p string) string

func (*RemoteFS) Home

func (r *RemoteFS) Home() string

func (*RemoteFS) Join

func (r *RemoteFS) Join(parts ...string) string

func (*RemoteFS) Kind

func (r *RemoteFS) Kind() string

func (*RemoteFS) Label

func (r *RemoteFS) Label() string

func (*RemoteFS) List

func (r *RemoteFS) List(p string) ([]sftpclient.FileEntry, error)

func (*RemoteFS) Mkdir

func (r *RemoteFS) Mkdir(p string) error

func (*RemoteFS) ReadFileChunk

func (r *RemoteFS) ReadFileChunk(p string, maxBytes int64) ([]byte, bool, error)

func (*RemoteFS) ReadFileRange

func (r *RemoteFS) ReadFileRange(p string, offset, maxBytes int64) ([]byte, int64, error)
func (r *RemoteFS) Readlink(p string) (string, error)

func (*RemoteFS) Remove

func (r *RemoteFS) Remove(p string) error

func (*RemoteFS) RemoveAll

func (r *RemoteFS) RemoveAll(p string) error

func (*RemoteFS) Rename

func (r *RemoteFS) Rename(o, n string) error

func (*RemoteFS) Stat

func (r *RemoteFS) Stat(p string) (sftpclient.FileEntry, error)

type TwoPaneModel

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

func NewTwoPaneModel

func NewTwoPaneModel(client *sftpclient.Client, leftFS, rightFS FileSystem) TwoPaneModel

func (TwoPaneModel) Init

func (m TwoPaneModel) Init() tea.Cmd

func (TwoPaneModel) Update

func (m TwoPaneModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TwoPaneModel) View

func (m TwoPaneModel) View() string

type UploadModel

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

func NewUploadModel

func NewUploadModel(client *sftpclient.Client, remoteDir string) UploadModel

func NewUploadModelMulti

func NewUploadModelMulti(client *sftpclient.Client, remoteDir string, sources []string) UploadModel

NewUploadModelMulti starts an upload of pre-known source paths without prompting the user. Used for the two-pane F5 copy where the source list is the active panel's selection — the view opens straight into progress.

func (UploadModel) Init

func (m UploadModel) Init() tea.Cmd

func (UploadModel) Update

func (m UploadModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (UploadModel) View

func (m UploadModel) View() string

Jump to

Keyboard shortcuts

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