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

internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

This package is an abstraction of the Terminal UI itself.

Index

Constants

View Source
const FeedlySubscribers = "feedly.box_subscribers"
View Source
const SchemaURL = "https://raw.githubusercontent.com/PiercingXX/devdash/master/doc/devdash.schema.json"

SchemaURL where the JSON schema of the dashboards is published.

Variables

This section is empty.

Functions

func AllOptions

func AllOptions() []string

AllOptions of every widget, sorted.

func Blog

func Blog() string

func CreateBlogConfig

func CreateBlogConfig(keyfile string, address string, propertyID string) blogConfig

func CreateGitHubProjectConfig

func CreateGitHubProjectConfig(token string, owner string, repo string) githubConfig

func DisplayError

func DisplayError(tui *Tui, err error) func() error

func ExtractDimensions

func ExtractDimensions(widgetOptions map[string]string) (dimensions []string)

func ExtractMetric

func ExtractMetric(widgetOptions map[string]string) (metric string)

func ExtractTimeRange

func ExtractTimeRange(base time.Time, widgetOptions map[string]string) (sd time.Time, ed time.Time, err error)

func GitHubProject

func GitHubProject() string

func MapSize

func MapSize(size string) (int, error)

Map the size of each column if t-shirt size is provided (XXS to XL). Otherwise use the numerical value provided in the config directly.

func NewDisplayWidget

func NewDisplayWidget() *displayWidget

func NewFeedlyWidget

func NewFeedlyWidget(address string) *feedlyWidget

NewFeedlyWidget with all information necessary to connect to the Feedly API.

func NewGaWidget

func NewGaWidget(keyfile string, propertyID string) (*gaWidget, error)

NewGaWidget including all information to connect to the Google Analytics API.

func NewGitWidget

func NewGitWidget(path string) *gitWidget

func NewGithubWidget

func NewGithubWidget(token string, owner string, repo string) (*githubWidget, error)

NewGithubWidget with all information necessary to connect to the Github API.

func NewGscWidget

func NewGscWidget(keyfile string, address string) (*gscWidget, error)

NewGscWidget including everything to connect to the Google Search Console API.

func NewJSONWidget

func NewJSONWidget() *jsonWidget

func NewMonitorWidget

func NewMonitorWidget(address string) (*monitorWidget, error)

NewMonitorWidget with the address of the website to monitor.

func NewProject

func NewProject(
	name string,
	nameOptions map[string]string,
	widgets [][][]Widget,
	sizes [][]string,
	themes map[string]map[string]string,
	tui *Tui,
) *project

NewProject for the dashboard.

func Schema

func Schema() ([]byte, error)

Schema of the dashboards, in JSON.

func WidgetNames

func WidgetNames() []string

WidgetNames of every widget, sorted. The host widgets are listed for the local host (lh) and the remote host (rh).

func WidgetOptions

func WidgetOptions(name string) ([]string, bool)

WidgetOptions accepted by a widget: its own options and the display options of its type. False if the widget doesn't exist.

Types

type HostWidget

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

func NewHostWidget

func NewHostWidget(username, addr, knownHosts string) (*HostWidget, error)

func (*HostWidget) CreateWidgets

func (ms *HostWidget) CreateWidgets(widget Widget, tui *Tui) (f func() error, err error)

type Problem

type Problem struct {
	Path    string
	Message string
}

Problem found in a dashboard.

func CheckDashboard

func CheckDashboard(cfg map[string]any) []Problem

CheckDashboard finds the problems of a dashboard, given as its raw configuration.

func (Problem) String

func (p Problem) String() string

type Tui

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

func NewTUI

func NewTUI(instance manager) *Tui

func (*Tui) AddBarChart

func (t *Tui) AddBarChart(
	data []int,
	dimensions []string,
	title string,
	options map[string]string,
) (err error)

AddBarChart to the TUI, a representation of the evolution of a dataset overtime.

func (*Tui) AddCol

func (t *Tui) AddCol(size string) error

AddCol to the TUI grid.

func (*Tui) AddGauge

func (t *Tui) AddGauge(
	data float64,
	title string,
	options map[string]string,
) (err error)

func (*Tui) AddKAction

func (t *Tui) AddKAction(key string, action func())

AddKAction runs an action when the key is pressed.

func (*Tui) AddKEdit

func (t *Tui) AddKEdit(
	key string,
	editDashboard func(),
)

func (*Tui) AddKHotReload

func (t *Tui) AddKHotReload(key string, c chan<- time.Time)

func (*Tui) AddKQuit

func (t *Tui) AddKQuit(key string)

Add keyboard shortcut from the config to quit DevDash. Default Control C.

func (*Tui) AddProjectTitle

func (t *Tui) AddProjectTitle(title string, options map[string]string) (err error)

AddProjectTitle to the TUI.

func (*Tui) AddRow

func (t *Tui) AddRow()

AddRow to the TUI grid.

func (*Tui) AddStackedBarChart

func (t *Tui) AddStackedBarChart(
	data [8][]int,
	dimensions []string,
	title string,
	colors []uint16,
	options map[string]string,
) (err error)

AddStackedBarChart to the TUI, which represent two or more dataset overtime.

func (*Tui) AddTable

func (t *Tui) AddTable(data [][]string, title string, options map[string]string) error

AddTable to the TUI, with a header and the dataset.

func (*Tui) AddTextBox

func (t *Tui) AddTextBox(
	data string,
	title string,
	options map[string]string,
) (err error)

AddTextBox to the TUI.

func (*Tui) Clean

func (t *Tui) Clean()

Clean and reinitialize the TUI.

func (*Tui) Close

func (t *Tui) Close()

Close the TUI.

func (*Tui) HotReload

func (t *Tui) HotReload()

Hot reload the whole TUI

func (*Tui) Loop

func (t *Tui) Loop()

Loop the TUI to receive events.

func (*Tui) Render

func (t *Tui) Render()

Render the TUI.

type Widget

type Widget struct {
	Name    string            `mapstructure:"name"`
	Options map[string]string `mapstructure:"options"`
	Theme   string            `mapstructure:"theme"`
}

A widget is a representation of a set of data in the screen.

Directories

Path Synopsis
Google Search Console
Google Search Console

Jump to

Keyboard shortcuts

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