Documentation
¶
Overview ¶
Package connectapp is the popup behind the "c" key and :connect: a QR code that gets the SwarmCLI phone app and, where an extension supplies one, a Connect tab that puts the current swarm on the phone.
Index ¶
Constants ¶
const ( AppURL = "https://swarmcli.io/app" DownloadURL = "https://swarmcli.io/get?ref=tui" )
AppURL is the web page about the app. DownloadURL sends a phone to its own app store and anything else to AppURL; ref=tui tells the site where the visit came from. Both are swarmcli.io addresses rather than store links, so a store listing can move without a release of this binary.
Variables ¶
var NewPane func() Pane
NewPane, when set by an extension in init(), builds the Connect tab each time the popup opens. Without it the popup offers the download alone, with UnavailableText saying why.
UnavailableText is what the popup says about connecting when no pane is registered. Override in init() to customise.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the popup. It is closed until Open.
func (*Model) Close ¶
func (m *Model) Close()
Close hides the popup and drops the pane, and with it anything it showed.
func (*Model) Open ¶
Open shows the popup sized to a width x height terminal, on the Connect tab when there is one.
func (*Model) Update ¶
Update handles msg while the popup is open: esc closes it, tab switches between Connect and Get the app, and the rest goes to the pane.
type Pane ¶
type Pane interface {
Init() tea.Cmd
// Update receives every key the popup does not use itself while the
// Connect tab is showing, and every non-key message while the popup is up.
Update(msg tea.Msg) tea.Cmd
// View renders the tab in at most width columns and height rows.
View(width, height int) string
// fix it, or "" when it can. While it is non-empty the popup shows the
// download code with this text beside it instead of the tab.
Unavailable() string
}
Pane is the popup's Connect tab. The popup owns the frame, the download code and the keys that move between them; a pane owns what connecting a swarm takes, which this repository does not implement.