cli

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cli contains utility for the cli

Index

Constants

View Source
const (
	// DefaultBannerWidth is the default width for a banner
	DefaultBannerWidth = 100
)

Variables

View Source
var (
	// PrimaryColor is the primary color for the cli.
	PrimaryColor = lipgloss.Color("#00BBBE")
	// Secondary is the secondary color for the cli.
	SecondaryColor = lipgloss.Color("#59CFA8")
	// AccentColor is the accent color for the cli.
	AccentColor = lipgloss.Color("#3D34E0")
	// WhiteColor is the white color for the cli.
	WhiteColor = lipgloss.Color("#FFFFFF")
	// BlackColor is the black color for the cli.
	BlackColor = lipgloss.Color("#000000")
)

Color Palette

View Source
var (
	// Header is the style to use for headers
	Header = lipgloss.NewStyle().
			Bold(true).
			Foreground(PrimaryColor).
			PaddingTop(1).
			PaddingBottom(1).
			PaddingLeft(1).
			PaddingRight(1).
			MaxWidth(80)
	WarningBanner = lipgloss.NewStyle().
					Bold(true).
					Background(BlackColor).
					Foreground(WhiteColor).
					BorderForeground(AccentColor).
					PaddingTop(2).
					PaddingBottom(2).
					PaddingLeft(4).
					PaddingRight(4).
					Width(DefaultBannerWidth)
	// SuccessBanner is the style to use for a success banner
	SuccessBanner = lipgloss.NewStyle().
					Bold(true).
					Background(AccentColor).
					Foreground(WhiteColor).
					PaddingTop(1).
					PaddingBottom(1).
					PaddingLeft(4).
					PaddingRight(4).
					Width(DefaultBannerWidth)
	// Table is the style to use for tables
	Table = lipgloss.NewStyle().
			BorderStyle(lipgloss.NormalBorder()).
			BorderForeground(AccentColor)
	// TableStyles is the style to use for tables
	TableStyles = table.Styles{
		Selected: lipgloss.NewStyle().Bold(true).Foreground(SecondaryColor),
		Header:   lipgloss.NewStyle().Bold(true).Padding(0, 1).Foreground(PrimaryColor),
		Cell:     lipgloss.NewStyle().Padding(0, 1),
	}
	// TableHiddenSelectStyles is the style to use for tables. It hides the selection
	// indicator.
	TableHiddenSelectStyles = table.Styles{
		Header:   lipgloss.NewStyle().Bold(true).Padding(0, 1).Foreground(PrimaryColor),
		Cell:     lipgloss.NewStyle().Padding(0, 1),
		Selected: lipgloss.NewStyle(),
	}

	KeyValTableWidths = struct {
		Key   int
		Value int
	}{
		Key:   27,
		Value: 67,
	}
)

Styles

Functions

func Print

func Print(out io.Writer, msg string, args ...interface{})

Print prints a message using the given io.Writer

func PrintCmd

func PrintCmd(cmd *cobra.Command, msg string, args ...interface{})

PrintCmd prints a message using the output defined in the cobra Command

func PrintYesNoPrompt

func PrintYesNoPrompt(cmd *cobra.Command, promptMsg, fallbackMsg string) bool

PrintYesNoPrompt prints a yes/no prompt to the user and returns false if the user did not respond with yes or y

func TableRender

func TableRender(t table.Model) string

TableRender renders a table given a table model

Types

This section is empty.

Jump to

Keyboard shortcuts

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