show

package
v1.2.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package show contains the bootstrapping and tooling for the pizza show cobra command

Index

Constants

This section is empty.

Variables

View Source
var ActiveStyle = lipgloss.NewStyle().
	BorderStyle(lipgloss.NormalBorder()).
	BorderForeground(lipgloss.Color("#FF4500"))

ActiveStyle: table when selected (border:normal, border-foreground:#FF4500)

View Source
var BackToDashboard = key.NewBinding(key.WithKeys("B"), key.WithHelp("B", "back"))
View Source
var Color = lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FF4500"}

Color: the color palette (Light: #000000, Dark: #FF4500)

View Source
var Container = lipgloss.NewStyle().Width(80).Padding(0, 5)

Container: container styling (width: 80, py: 0, px: 5)

View Source
var HelpStyle = list.DefaultStyles().HelpStyle.PaddingLeft(4).PaddingBottom(1)

HelpStyle: style for help menu

View Source
var InactiveStyle = lipgloss.NewStyle().
	BorderStyle(lipgloss.NormalBorder()).
	BorderForeground(lipgloss.Color("#FFFFFF"))

InactiveStyle: table when not selected (border:normal, border-foreground:#FFFFFF)

View Source
var ItemStyle = lipgloss.NewStyle().PaddingLeft(4)

ItemStyle: style applied to items in a list.Model

View Source
var ListItemTitleStyle = lipgloss.NewStyle().MarginLeft(2)

ListItemTitle: style for the list.Model title

View Source
var OpenPR = key.NewBinding(key.WithKeys("O"), key.WithHelp("O", "open pr"))

Keymaps

View Source
var PaginationStyle = list.DefaultStyles().PaginationStyle.PaddingLeft(4)

PaginationStyle: style for pagination of list.Model

View Source
var SelectedItemStyle = lipgloss.NewStyle().PaddingLeft(2).Foreground(Color)

SelectedItemStyle: style applied when the item is selected in a list.Model

View Source
var SquareBorder = lipgloss.NewStyle().BorderStyle(lipgloss.RoundedBorder()).BorderForeground(Color)

SquareBorder: Style to draw a border around a section

View Source
var TableTitle = lipgloss.NewStyle().Width(25).AlignHorizontal(lipgloss.Center).Bold(true)

TableTitle: The style for table titles (width:25, align-horizontal:center, bold:true)

View Source
var TextContainer = lipgloss.NewStyle().Padding(1, 1)

TextContainer: container for text

View Source
var ToggleHelpMenu = key.NewBinding(key.WithKeys("H"), key.WithHelp("H", "toggle help"))
View Source
var Viewport = lipgloss.NewStyle().Margin(1, 2)

STYLES Viewport: The viewport of the tui (my:2, mx:2)

View Source
var WidgetContainer = lipgloss.NewStyle().Padding(2, 2)

WidgetContainer: container for tables, and graphs (py:2, px:2)

View Source
var WindowSize tea.WindowSizeMsg

WindowSize stores the size of the terminal

Functions

func InitContributor

func InitContributor(opts *Options) (tea.Model, error)

InitContributor: initializes the contributorModel

func InitDashboard

func InitDashboard(opts *Options) (tea.Model, error)

FetchRepoInfo: initializes the dashboard model

func NewShowCommand

func NewShowCommand() *cobra.Command

NewShowCommand returns a new cobra command for 'pizza show'

Types

type BackMsg

type BackMsg struct{}

BackMsg: message to signal main model that we are back to dashboard when backspace is pressed

type ContributorErrMsg

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

ContributorErrMsg: message to signal that an error occurred when fetching contributor information

type ContributorModel

type ContributorModel struct {
	APIClient *client.APIClient
	// contains filtered or unexported fields
}

ContributorModel holds all the information related to a contributor

func (ContributorModel) Init

func (m ContributorModel) Init() tea.Cmd

func (ContributorModel) Update

func (m ContributorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ContributorModel) View

func (m ContributorModel) View() string

type DashboardModel

type DashboardModel struct {
	RepositoryInfo *client.DbRepo

	APIClient *client.APIClient
	// contains filtered or unexported fields
}

DashboardModel holds all the information related to the repository queried (issues, stars, new contributors, alumni contributors)

func (*DashboardModel) FetchAllContributors

func (m *DashboardModel) FetchAllContributors() error

FetchAllContributors: fetchs and sets all the contributors (new, alumni)

func (*DashboardModel) FetchAlumniContributors

func (m *DashboardModel) FetchAlumniContributors() ([]client.DbPullRequestContributor, error)

FetchAlumniContributors: Returns all alumni contributors

func (*DashboardModel) FetchNewContributors

func (m *DashboardModel) FetchNewContributors() ([]client.DbPullRequestContributor, error)

FetchNewContributors: Returns all the new contributors

func (DashboardModel) Init

func (m DashboardModel) Init() tea.Cmd

func (DashboardModel) Update

func (m DashboardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (DashboardModel) View

func (m DashboardModel) View() string

type ErrMsg

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

ErrMsg: this message represents an error when fetching

type MainModel

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

MainModel: the main model is the central state manager of the TUI, decides which model is focused based on certain commands

func (MainModel) Init

func (m MainModel) Init() tea.Cmd

Init: initial IO before program start

func (MainModel) Update

func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update: Handle IO and Commands

func (MainModel) View

func (m MainModel) View() string

View: the view of the TUI

type Options

type Options struct {
	// Owner: the owner of the repository
	Owner string

	// RepoName: the name of the repository
	RepoName string

	// Page is the page to be requested
	Page int

	// Limit is the number of records to be retrieved
	Limit int

	// Range is the number of days to take into account when retrieving statistics
	Range int

	// APIClient is the api client to interface with open sauced api
	APIClient *client.APIClient

	ServerContext context.Context
}

Options are the options for the pizza show command including user defined configurations

type SelectMsg

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

SelectMsg: message to signal the main model that we want to go to the contributor model when 'enter' is pressed

type SuccessMsg

type SuccessMsg struct{}

SuccessMsg: message to represent success when fetching

Jump to

Keyboard shortcuts

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