Help us shape the future of Go! Take the 2026 Go Developer Survey

packages

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package packages implements the package search and dependency management views.

Example (NormalizeQuery)
fmt.Println(normalizeQuery("Requests-HTML_v2.0"))
Output:
requestshtmlv20

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchDescription

func FetchDescription(index int, name string) tea.Cmd

FetchDescription returns a Bubble Tea command that loads package metadata.

func IsAsyncMsg

func IsAsyncMsg(msg interface{}) bool

IsAsyncMsg returns true if msg is one of the async messages produced by requirements commands. Used by the top-level model to forward these messages to the requirements sub-model even when another screen is active.

func OpenManagerModalCmd

func OpenManagerModalCmd() tea.Cmd

OpenManagerModalCmd opens the package manager selector modal.

func RenderPackageDetails

func RenderPackageDetails(result *Result, width int, loading bool, query string, err error) string

RenderPackageDetails renders the package details pane content.

func RenderResults

func RenderResults(results []Result, width int, selectedIndex int) string

RenderResults renders the package search result list pane.

func Search(query string) tea.Cmd

Search returns a Bubble Tea command that searches PyPI package names.

func TruncateText

func TruncateText(text string, max int) string

TruncateText truncates text to max runes and appends an ellipsis when needed.

func WrapText

func WrapText(text string, width int) string

WrapText wraps plain text at the given width.

Types

type DescriptionLoadedMsg

type DescriptionLoadedMsg struct {
	Index  int
	Result Result
}

DescriptionLoadedMsg carries package metadata loaded asynchronously.

type DoneMsg

type DoneMsg struct {
	Results []Result
	Err     error
}

DoneMsg is emitted when a package search operation finishes.

type Result

type Result struct {
	Name        string
	Version     string
	Description string
	Readme      string
	URL         string
}

Result contains package information retrieved from PyPI.

func SelectedSearchResult

func SelectedSearchResult(results []Result, index int) *Result

SelectedSearchResult returns the currently selected result or nil.

type ViewModel

type ViewModel struct {
	Width           int
	Height          int
	PackageManager  packagemanager.PackageManager
	Interpreter     string
	InterpreterKind string

	Packages []packagemanager.Dependency
	Selected int
	Scroll   int

	ListSearchInput textinput.Model
	ListSearchMode  bool
	ListFilter      string

	LoadingList bool
	BusyAction  bool

	ModalOpen                  bool
	InstallInput               textinput.Model
	Suggestions                []packagemanager.Dependency
	SuggestionSelected         int
	SuggestionScroll           int
	ModalLoadingSuggestions    bool
	ModalLastQuery             string
	ModalSearchSeq             int
	ModalErrorText             string
	ModalLoading               bool
	ModalFocusedPane           int
	ModalSuggestionMeta        *Result
	ModalSuggestionMetaLoading bool
	ModalSuggestionMetaName    string
	ModalSuggestionMetaScroll  int
	InstallMeta                *Result
	InstallMetaLoading         bool
	InstallMetaErr             string
	ManagerModalOpen           bool
	ManagerOptions             []managerOption
	ManagerSelected            int
	ManagerScroll              int
	VersionModalOpen           bool
	VersionsList               []string
	VersionSelected            int
	VersionScroll              int
	VersionLoading             bool
	VersionPackageName         string
	VersionErrorText           string
	VersionFromMain            bool
	Loader                     spinner.Model

	ActionModalOpen    bool
	ActionModalLoading bool
	ActionModalTitle   string
	ActionModalText    string
	ActionModalKind    logKind
	HelpModalOpen      bool

	SearchMode  bool
	SearchQuery string

	LogText string
	LogKind logKind

	SelectedMeta        *Result
	SelectedMetaLoading bool
	SelectedMetaErr     string
	DetailsScroll       int
	FocusedPane         int // 0 = list, 1 = details
	// contains filtered or unexported fields
}

ViewModel stores state and behavior for the dependencies management screen.

func NewViewModel

func NewViewModel() ViewModel

NewViewModel creates a ViewModel with default inputs and detected manager.

func (ViewModel) Init

func (m ViewModel) Init() tea.Cmd

Init implements the Bubble Tea model initialization command.

func (ViewModel) IsLoading

func (m ViewModel) IsLoading() bool

IsLoading reports whether the screen has an active async operation.

func (ViewModel) Update

func (m ViewModel) Update(msg tea.Msg) (ViewModel, tea.Cmd)

Update handles messages and returns updated state plus optional command.

func (ViewModel) View

func (m ViewModel) View() string

View renders the complete dependencies management UI.

Directories

Path Synopsis
Package manager provides abstractions and implementations for Python package managers.
Package manager provides abstractions and implementations for Python package managers.

Jump to

Keyboard shortcuts

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