Documentation
¶
Overview ¶
Package tui implements the interactive Bubble Tea terminal interface for IServ.
Index ¶
- Constants
- Variables
- func BuildIServFileWebURL(baseURL, davPath string) string
- func CopyToClipboard(text string) error
- func DetectDefaultIconSet() string
- func ExtractShortcutURL(name string, raw []byte) string
- func FileIcon(f iserv.FileEntry, theme Theme, iconSet string) (string, lipgloss.Color, string)
- func IconSetLabel(s string) string
- func IconSetShort(s string) string
- func IsLinkShortcutFile(name string) bool
- func LangLabel(s string) string
- func LangShort(s string) string
- func NextIconSet(cur string) string
- func NextLang(cur string) string
- func NextThemeName(cur string) string
- func NormalizeIconSet(s string) string
- func NormalizeLang(s string) string
- func NotifIcon(module string, read bool, theme Theme, iconSet string) (string, lipgloss.Color)
- func OpenInBrowser(target string) error
- func PrevLang(cur string) string
- func ResolveIServURL(baseURL, raw string) string
- func ResolveIconSet(s string) string
- func SemanticIcon(kind string, theme Theme, iconSet string) (string, lipgloss.Color)
- func TabIconGlyph(tab Tab, iconSet string) string
- type ConnectFunc
- type FontInstallerFunc
- type IServClient
- type LoginModel
- type Model
- type Options
- type Tab
- type Theme
Constants ¶
const ( // LangEN selects English UI labels (default). LangEN = "en" // LangRU selects Russian UI labels. LangRU = "ru" // LangDE selects German UI labels. LangDE = "de" )
const ( // IconSetAuto selects Nerd Font glyphs when available and falls back to Universal Unicode. IconSetAuto = "auto" // IconSetUnicode renders universal 1-cell BMP geometric symbols (works on every OS/font). IconSetUnicode = "unicode" // IconSetEmoji renders optional color emoji icons. IconSetEmoji = "emoji" // IconSetNerd renders Catppuccin Nerd Font glyphs (requires Symbols Nerd Font or a Nerd Font). IconSetNerd = "nerd" // IconSetMinimal is kept as a backwards-compatible alias for [IconSetUnicode]. IconSetMinimal = IconSetUnicode )
const ( // MinTermWidth is the minimum terminal column count required to render the TUI. MinTermWidth = 100 // MinTermHeight is the minimum terminal row count required to render the TUI. MinTermHeight = 25 )
Variables ¶
var ThemeNames = []string{"Catppuccin", "Dracula"}
ThemeNames lists the supported theme presets in cycle order.
Functions ¶
func BuildIServFileWebURL ¶
BuildIServFileWebURL maps an IServ WebDAV path to the authenticated IServ web file browser URL.
func CopyToClipboard ¶
CopyToClipboard writes text to the OS clipboard (Wayland wl-copy, native OS clipboard via atotto/clipboard, and OSC 52 terminal fallback for SSH/headless).
func DetectDefaultIconSet ¶
func DetectDefaultIconSet() string
DetectDefaultIconSet returns IconSetNerd if a Nerd Font or built-in Nerd terminal is detected, otherwise IconSetUnicode.
func ExtractShortcutURL ¶
ExtractShortcutURL extracts and validates an HTTP(S) target URL from .url/.webloc/.desktop files.
func IconSetLabel ¶
IconSetLabel returns a human-readable display name for the active icon preset.
func IconSetShort ¶
IconSetShort returns a compact badge label for chips and sub-bars.
func IsLinkShortcutFile ¶
IsLinkShortcutFile reports whether name is an internet shortcut (.url, .webloc, .desktop).
func NextIconSet ¶
NextIconSet cycles icon presets: unicode -> emoji -> nerd -> unicode.
func NextThemeName ¶
NextThemeName returns the next theme preset name after cur.
func NormalizeIconSet ¶
NormalizeIconSet canonicalizes user-supplied icon preset names (including legacy "minimal").
func NormalizeLang ¶
NormalizeLang returns LangRU or LangDE when requested, otherwise LangEN.
func OpenInBrowser ¶
OpenInBrowser opens a validated HTTP(S) URL or existing local file using the OS handler.
func ResolveIServURL ¶
ResolveIServURL normalizes a relative or absolute IServ URL against baseURL.
func ResolveIconSet ¶
ResolveIconSet converts "auto" (or empty) to a concrete preset via DetectDefaultIconSet.
func SemanticIcon ¶
SemanticIcon returns a themed glyph paired with its accent color.
func TabIconGlyph ¶
TabIconGlyph returns the icon glyph for a workspace tab in the active icon set.
Types ¶
type ConnectFunc ¶
type ConnectFunc = client.ConnectFunc
ConnectFunc aliases the shared connection factory.
type FontInstallerFunc ¶
type FontInstallerFunc func(context.Context) (fonts.InstallResult, error)
FontInstallerFunc downloads and installs the Symbols Nerd Font fallback archive.
type IServClient ¶
type IServClient = client.IServClient
IServClient aliases the shared consumer interface for TUI callers and tests.
type LoginModel ¶
type LoginModel struct {
// contains filtered or unexported fields
}
LoginModel manages the interactive authentication splash screen.
func NewLoginModel ¶
func NewLoginModel(initialDomain, initialUser, initialPass string, theme Theme, zones *zone.Manager) LoginModel
NewLoginModel constructs a LoginModel pre-filled with initial domain/user defaults.
func (LoginModel) Update ¶
func (m LoginModel) Update(msg tea.Msg) (LoginModel, tea.Cmd)
Update handles Bubble Tea messages for the login splash screen.
func (LoginModel) View ¶
func (m LoginModel) View(width, height int) string
View renders the centered login splash screen.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model for iserv-cli.
func (Model) Close ¶
func (m Model) Close()
Close releases background zone-tracking resources held by the model.
func (Model) Init ¶
Init starts auto-login when credentials are pre-supplied, or blinks the login cursor.
type Options ¶
type Options struct {
Context context.Context
Domain string
Username string
Password string
InitialTheme string
InitialIconSet string
InitialLang string
InitialBookmarks []config.Bookmark
DownloadsDir string
ExportsDir string
Connect ConnectFunc
SaveCfg func(config.SavedConfig) error
LoadSpotlight func(domain, user string) []config.SpotlightEntry
SaveSpotlight func(domain, user string, entries []config.SpotlightEntry) error
OpenBrowser func(string) error
CopyClipboard func(string) error
InstallFont FontInstallerFunc
HasNerdFont func() bool
}
Options configures the initial state and dependencies of the Bubble Tea Model.
type Theme ¶
type Theme struct {
Name string
BrandBlue, Accent, Violet, Cyan, Sapphire lipgloss.Color
Green, Peach, Amber, Red, Pink, Teal lipgloss.Color
Text, Muted, Subtle, Border, BorderFocused lipgloss.Color
Surface, Highlight, PillFill, DividerColor lipgloss.Color
TileBg, TileFg lipgloss.Color
HeaderBar, BrandBadge, VersionPill, UserBadge, Divider lipgloss.Style
TabActive, TabInactive, TabBar, SubBar lipgloss.Style
PillActive, PillInactive, PillCount lipgloss.Style
ActionChip, ActionChipPrimary, AvatarTile, StatCard lipgloss.Style
GroupChip, Pane, PaneFocused, Card, PaneTitle lipgloss.Style
RowNormal, RowSelected, RowPast, RowToday lipgloss.Style
MutedText, SubtleText, SectionLabel lipgloss.Style
BadgeUnread, BadgeDone, BadgeOverdue, BadgeWarn, BadgeTag lipgloss.Style
Theme holds the Lip Gloss color palette and reusable component styles for iserv-cli.
func DefaultTheme ¶
func DefaultTheme() Theme
DefaultTheme builds the default Catppuccin Mocha palette.
func ThemeByName ¶
ThemeByName returns either "Catppuccin" (Mocha, default) or "Dracula".
func (Theme) SelectedChipStyle ¶
SelectedChipStyle styles a selected chip (text-only color change in Catppuccin, filled pill in Dracula).
func (Theme) SelectedPrefixStyle ¶
SelectedPrefixStyle styles a selected row's leading icon/dot (text-only in Catppuccin, shaded in Dracula).