cli

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 15 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserAborted = errors.New("user aborted")
View Source
var Latte = Theme{
	Rosewater: Hex("#dc8a78"),
	Flamingo:  Hex("#dd7878"),
	Pink:      Hex("#ea76cb"),
	Mauve:     Hex("#8839ef"),
	Red:       Hex("#d20f39"),
	Maroon:    Hex("#e64553"),
	Peach:     Hex("#fe640b"),
	Yellow:    Hex("#df8e1d"),
	Green:     Hex("#40a02b"),
	Teal:      Hex("#179299"),
	Sky:       Hex("#04a5e5"),
	Sapphire:  Hex("#209fb5"),
	Blue:      Hex("#1e66f5"),
	Lavender:  Hex("#7287fd"),
	Text:      Hex("#4c4f69"),
	Subtext1:  Hex("#5c5f77"),
	Subtext0:  Hex("#6c6f85"),
	Overlay2:  Hex("#7c7f93"),
	Overlay1:  Hex("#8c8fa1"),
	Overlay0:  Hex("#9ca0b0"),
	Surface2:  Hex("#acb0be"),
	Surface1:  Hex("#bcc0cc"),
	Surface0:  Hex("#ccd0da"),
	Base:      Hex("#eff1f5"),
	Mantle:    Hex("#e6e9ef"),
	Crust:     Hex("#dce0e8"),
}

Catppuccin Latte (light theme)

View Source
var Mocha = Theme{
	Rosewater: Hex("#f5e0dc"),
	Flamingo:  Hex("#f2cdcd"),
	Pink:      Hex("#f5c2e7"),
	Mauve:     Hex("#cba6f7"),
	Red:       Hex("#f38ba8"),
	Maroon:    Hex("#eba0ac"),
	Peach:     Hex("#fab387"),
	Yellow:    Hex("#f9e2af"),
	Green:     Hex("#a6e3a1"),
	Teal:      Hex("#94e2d5"),
	Sky:       Hex("#89dceb"),
	Sapphire:  Hex("#74c7ec"),
	Blue:      Hex("#89b4fa"),
	Lavender:  Hex("#b4befe"),
	Text:      Hex("#cdd6f4"),
	Subtext1:  Hex("#bac2de"),
	Subtext0:  Hex("#a6adc8"),
	Overlay2:  Hex("#9399b2"),
	Overlay1:  Hex("#7f849c"),
	Overlay0:  Hex("#6c7086"),
	Surface2:  Hex("#585b70"),
	Surface1:  Hex("#45475a"),
	Surface0:  Hex("#313244"),
	Base:      Hex("#1e1e2e"),
	Mantle:    Hex("#181825"),
	Crust:     Hex("#11111b"),
}

Catppuccin Mocha (dark theme)

Functions

func Confirm

func Confirm(label string, defaultValue bool) (bool, error)

func Debug added in v0.0.4

func Debug(v ...any)

func Debugf added in v0.0.4

func Debugf(format string, a ...interface{})

func Error

func Error(v ...any)

func Errorf

func Errorf(format string, a ...interface{})

func Fatal

func Fatal(v ...any)

func Fatalf

func Fatalf(format string, a ...interface{})

func File

func File(label string, types []string) (string, error)

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, a ...interface{})

func Input added in v0.0.3

func Input(label, placeholder string) (string, error)

func IsTerminal

func IsTerminal() bool

func MustConfirm

func MustConfirm(label string, defaultValue bool) bool

func MustFile

func MustFile(label string, types []string) string

func MustInput added in v0.0.3

func MustInput(label, placeholder string) string

func MustRun

func MustRun(title string, fn func() error) error

func MustSelect

func MustSelect(label string, items []string) (int, string)

func MustText added in v0.0.3

func MustText(label, placeholder string) string

func OpenFile

func OpenFile(name string) error

func OpenURL

func OpenURL(url string) error

func Run

func Run(title string, fn func() error) error

func Select

func Select(label string, items []string) (int, string, error)

func SetDarkTheme added in v0.0.11

func SetDarkTheme()

SetDarkTheme sets the theme to Catppuccin Mocha

func SetLightTheme added in v0.0.11

func SetLightTheme()

SetLightTheme sets the theme to Catppuccin Latte

func SetTheme added in v0.0.11

func SetTheme(theme Theme)

SetTheme sets the current color theme

func ShowAppHelp

func ShowAppHelp(cmd *Command) error

func ShowCommandHelp

func ShowCommandHelp(cmd *Command) error

func Table

func Table(headers []string, rows [][]string)

func Text added in v0.0.3

func Text(label, placeholder string) (string, error)

func Title

func Title(val string)

func Warn

func Warn(v ...any)

func Warnf

func Warnf(format string, a ...interface{})

Types

type Argument

type Argument = cli.Argument

type BoolFlag

type BoolFlag = cli.BoolFlag

type Command

type Command = cli.Command

type Flag

type Flag = cli.Flag

type FloatArg

type FloatArg = cli.FloatArg

type IntArg

type IntArg = cli.IntArg

type IntFlag

type IntFlag = cli.IntFlag

type IntSliceFlag

type IntSliceFlag = cli.IntSliceFlag

type RGB added in v0.0.11

type RGB struct {
	R, G, B uint8
}

RGB represents an RGB color

func Hex added in v0.0.11

func Hex(hex string) RGB

Hex creates an RGB from a hex string like "#1e1e2e"

func (RGB) Bg added in v0.0.11

func (c RGB) Bg(text string) string

Bg applies background color to text

func (RGB) Color added in v0.0.11

func (c RGB) Color(text string) string

Color applies foreground color to text

type StringArg

type StringArg = cli.StringArg

type StringFlag

type StringFlag = cli.StringFlag

type StringMapArgs added in v0.0.6

type StringMapArgs = cli.StringMapArgs

type StringSliceFlag

type StringSliceFlag = cli.StringSliceFlag

type Theme added in v0.0.11

type Theme struct {
	// Base colors
	Rosewater RGB
	Flamingo  RGB
	Pink      RGB
	Mauve     RGB
	Red       RGB
	Maroon    RGB
	Peach     RGB
	Yellow    RGB
	Green     RGB
	Teal      RGB
	Sky       RGB
	Sapphire  RGB
	Blue      RGB
	Lavender  RGB

	// Text colors
	Text     RGB
	Subtext1 RGB
	Subtext0 RGB

	// Overlay colors
	Overlay2 RGB
	Overlay1 RGB
	Overlay0 RGB

	// Surface colors
	Surface2 RGB
	Surface1 RGB
	Surface0 RGB

	// Background colors
	Base   RGB
	Mantle RGB
	Crust  RGB
}

Theme represents a color theme

func GetTheme added in v0.0.11

func GetTheme() Theme

GetTheme returns the current theme

type TimestampArg

type TimestampArg = cli.TimestampArg

type UintArg

type UintArg = cli.UintArg

Directories

Path Synopsis
cmd
demo command

Jump to

Keyboard shortcuts

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