Documentation
¶
Index ¶
- Variables
- func CheckZone(api *cloudflare.API, zoneID string, logger *log.Logger) tea.Cmd
- func CreateZone(api *cloudflare.API, name string, logger *log.Logger) tea.Cmd
- func DeleteRecord(api *cloudflare.API, zoneID, recordID string, logger *log.Logger) tea.Cmd
- func DeleteZone(api *cloudflare.API, zoneID string, logger *log.Logger) tea.Cmd
- func FetchRecords(api *cloudflare.API, zoneID string, logger *log.Logger) tea.Cmd
- func FetchZones(api *cloudflare.API, logger *log.Logger) tea.Cmd
- func SaveRecord(api *cloudflare.API, zoneID string, f *RecordForm, logger *log.Logger) tea.Cmd
- type ErrorMsg
- type FetchedRecordsMsg
- type FetchedZonesMsg
- type Model
- type RecordDeletedMsg
- type RecordForm
- type RecordItem
- type RecordSavedMsg
- type SessionState
- type Theme
- type ZoneCheckTriggeredMsg
- type ZoneCreatedMsg
- type ZoneDeletedMsg
- type ZoneForm
- type ZoneItem
Constants ¶
This section is empty.
Variables ¶
var ( DocStyle = lipgloss.NewStyle().Margin(1, 2) NoStyle = lipgloss.NewStyle() )
Styles are derived from the theme.
var AvailableThemes = map[string]Theme{ "ansi": { Primary: lipgloss.Color("5"), Secondary: lipgloss.Color("6"), Error: lipgloss.Color("1"), Warning: lipgloss.Color("3"), Inactive: lipgloss.Color("8"), }, "mocha": { Primary: lipgloss.Color("#fab387"), Secondary: lipgloss.Color("#89dceb"), Error: lipgloss.Color("#f38ba8"), Warning: lipgloss.Color("#f9e2af"), Inactive: lipgloss.Color("#585b70"), }, "nord": { Primary: lipgloss.Color("#88C0D0"), Secondary: lipgloss.Color("#81A1C1"), Error: lipgloss.Color("#BF616A"), Warning: lipgloss.Color("#EBCB8B"), Inactive: lipgloss.Color("#4C566A"), }, "dracula": { Primary: lipgloss.Color("#bd93f9"), Secondary: lipgloss.Color("#8be9fd"), Error: lipgloss.Color("#ff5555"), Warning: lipgloss.Color("#f1fa8c"), Inactive: lipgloss.Color("#6272a4"), }, "rose-pine": { Primary: lipgloss.Color("#ebbcba"), Secondary: lipgloss.Color("#31748f"), Error: lipgloss.Color("#eb6f92"), Warning: lipgloss.Color("#f6c177"), Inactive: lipgloss.Color("#908caa"), }, "tokyo-night": { Primary: lipgloss.Color("#7aa2f7"), Secondary: lipgloss.Color("#bb9af7"), Error: lipgloss.Color("#f7768e"), Warning: lipgloss.Color("#e0af68"), Inactive: lipgloss.Color("#565f89"), }, "gruvbox": { Primary: lipgloss.Color("#fabd2f"), Secondary: lipgloss.Color("#83a598"), Error: lipgloss.Color("#fb4934"), Warning: lipgloss.Color("#fe8019"), Inactive: lipgloss.Color("#928374"), }, "everforest": { Primary: lipgloss.Color("#a7c080"), Secondary: lipgloss.Color("#7fbbb3"), Error: lipgloss.Color("#e67e80"), Warning: lipgloss.Color("#dbbc7f"), Inactive: lipgloss.Color("#859289"), }, }
AvailableThemes is a registry of all supported color schemes.
var DefaultTheme = AvailableThemes["ansi"]
DefaultTheme provides the fallback ANSI palette.
Functions ¶
func CreateZone ¶ added in v0.3.0
CreateZone returns a tea.Cmd that creates a new zone.
func DeleteRecord ¶
DeleteRecord returns a tea.Cmd that deletes a DNS record.
func DeleteZone ¶ added in v0.3.0
DeleteZone returns a tea.Cmd that deletes a zone.
func FetchRecords ¶
FetchRecords returns a tea.Cmd that fetches DNS records for a specific zone.
func FetchZones ¶
FetchZones returns a tea.Cmd that fetches all Cloudflare zones.
func SaveRecord ¶
func SaveRecord(api *cloudflare.API, zoneID string, f *RecordForm, logger *log.Logger) tea.Cmd
SaveRecord returns a tea.Cmd that saves (creates or updates) a DNS record.
Types ¶
type FetchedRecordsMsg ¶
type FetchedRecordsMsg []cloudflare.DNSRecord
type Model ¶
type Model struct {
State SessionState
CfClient *cloudflare.API
Theme Theme
ZoneList list.Model
RecordList list.Model
Form RecordForm
ZoneForm ZoneForm
Spinner spinner.Model
Logger *log.Logger
LogFile *os.File
Err error
SelectedID string
// Dimensions
Width int
Height int
// Confirmation info
OldRecord *cloudflare.DNSRecord
PendingZone *cloudflare.Zone
PendingDeleteID string
PendingDeleteName string
}
Model represents the application state.
func InitialModel ¶
InitialModel returns the initial state of the application.
type RecordDeletedMsg ¶
type RecordDeletedMsg struct{}
type RecordForm ¶
type RecordForm struct {
ID string
Type string
TypeList list.Model
Inputs []textinput.Model
Focused int
Proxied bool
Comment string
FlattenCNAME bool
}
RecordForm manages input fields for adding/editing a record.
func NewRecordForm ¶
func NewRecordForm(r *cloudflare.DNSRecord, theme *Theme) RecordForm
NewRecordForm initializes a form for a DNS record.
type RecordItem ¶
type RecordItem struct {
DNS cloudflare.DNSRecord
}
RecordItem implements list.Item for the DNS Record view.
func (*RecordItem) Description ¶
func (i *RecordItem) Description() string
func (*RecordItem) FilterValue ¶
func (i *RecordItem) FilterValue() string
func (*RecordItem) Title ¶
func (i *RecordItem) Title() string
type RecordSavedMsg ¶
type RecordSavedMsg struct{}
type SessionState ¶
type SessionState int
SessionState tracks which view is currently active.
const ( LoadingZonesState SessionState = iota ZoneListState LoadingRecordsState RecordListState EditingRecordState PickingTypeState AddingZoneState PendingZoneState ConfirmingDeleteZoneState ConfirmingDeleteState ConfirmingSaveState ConfirmingQuitState )
type Theme ¶
type Theme struct {
Primary lipgloss.TerminalColor
Secondary lipgloss.TerminalColor
Error lipgloss.TerminalColor
Warning lipgloss.TerminalColor
Inactive lipgloss.TerminalColor
}
Theme defines the color scheme for the application.
type ZoneCheckTriggeredMsg ¶ added in v0.3.0
type ZoneCheckTriggeredMsg cloudflare.Zone
type ZoneCreatedMsg ¶ added in v0.3.0
type ZoneCreatedMsg cloudflare.Zone
type ZoneDeletedMsg ¶ added in v0.3.0
type ZoneDeletedMsg struct{}
type ZoneForm ¶ added in v0.3.0
type ZoneForm struct {
NameInput textinput.Model
ConfirmInput textinput.Model // For deletion safety
JumpToTUI bool // If we should jump to TUI after adding (always true for us)
}
ZoneForm manages input fields for adding/deleting a zone.
func NewZoneForm ¶ added in v0.3.0
NewZoneForm initializes a form for adding or confirming deletion of a zone.
type ZoneItem ¶
type ZoneItem struct {
ID string
Name string
Status string
Zone cloudflare.Zone
}
ZoneItem implements list.Item for the Zone Selection view.