Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Docker = &Dependency{ name: "Docker", command: "docker", assist: func() error { return fmt.Errorf("docker is required to run this command. For installation instructions see: https://docs.docker.com/engine/install/") }, }
View Source
var KeyMap = DefaultKeyMap{ Enter: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "submit input"), ), Quit: key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "exit"), ), Up: key.NewBinding( key.WithKeys("up"), key.WithHelp("↑", "up"), ), Down: key.NewBinding( key.WithKeys("down"), key.WithHelp("↓", "down"), ), }
KeyMap contains our standard keybinding for CLI input
View Source
var Pulumi = &Dependency{ name: "Pulumi", command: "pulumi", assist: func() error { var resp bool _ = survey.AskOne(&survey.Confirm{ Message: fmt.Sprintf("Pulumi is required by %s but is not installed, would you like to install it?", "command"), Default: false, }, &resp) if !resp { return fmt.Errorf("pulumi is required to run this command. For installation instructions see: https://www.pulumi.com/docs/get-started/install/") } var installErr error platform := runtime.GOOS switch platform { case "darwin", "linux": cmd := exec.Command("sh", "-c", "curl -fsSL https://get.pulumi.com | sh") cmd.Stdout = os.Stdout installErr = cmd.Run() case "windows": cmd := exec.Command("powershell", "-NoProfile", "-InputFormat", "None", "-ExecutionPolicy", "Bypass", "-Command", "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://get.pulumi.com/install.ps1'))") cmd.Stdout = os.Stdout installErr = cmd.Run() if installErr == nil { cmd := exec.Command("powershell", "SET", "PATH='%PATH%;%USERPROFILE%\\.pulumi\\bin'") cmd.Stdout = os.Stdout installErr = cmd.Run() } default: installErr = fmt.Errorf("platform %s not supported", platform) } return installErr }, }
Functions ¶
func AddDependencyCheck ¶
func AddDependencyCheck(cmd *cobra.Command, deps ...*Dependency) *cobra.Command
AddDependencyCheck - Wraps a cobra command with a pre-run that will check for dependencies
func DebugColors ¶
func DebugColors() string
DebugColors returns the entire color palette as a string
Use for testing various terminals to confirm output
func IsTerminal ¶
func IsTerminal() bool
IsTerminal returns true if the current process is running in an interactive terminal
Types ¶
type ColorPalette ¶
type ColorPalette struct { White lipgloss.CompleteColor Gray lipgloss.CompleteColor Black lipgloss.CompleteColor Red lipgloss.CompleteColor Orange lipgloss.CompleteColor Yellow lipgloss.CompleteColor Green lipgloss.CompleteColor Teal lipgloss.CompleteColor Blue lipgloss.CompleteColor Purple lipgloss.CompleteColor }
ColorPalette of standard CLI UI colors
var Colors *ColorPalette = &ColorPalette{ White: lipgloss.CompleteColor{TrueColor: "#FFFFFF", ANSI256: "255", ANSI: "15"}, Gray: lipgloss.CompleteColor{TrueColor: "#696969", ANSI256: "250", ANSI: "7"}, Black: lipgloss.CompleteColor{TrueColor: "#000000", ANSI256: "16", ANSI: "0"}, Red: lipgloss.CompleteColor{TrueColor: "#E91E63", ANSI256: "197", ANSI: "1"}, Orange: lipgloss.CompleteColor{TrueColor: "#F97316", ANSI256: "208", ANSI: "3"}, Yellow: lipgloss.CompleteColor{TrueColor: "#FDE047", ANSI256: "220", ANSI: "11"}, Green: lipgloss.CompleteColor{TrueColor: "#22C55E", ANSI256: "47", ANSI: "10"}, Teal: lipgloss.CompleteColor{TrueColor: "#32D0D1", ANSI256: "51", ANSI: "14"}, Blue: lipgloss.CompleteColor{TrueColor: "#2563EB", ANSI256: "21", ANSI: "4"}, Purple: lipgloss.CompleteColor{TrueColor: "#C27AFA", ANSI256: "99", ANSI: "13"}, }
Colors contains our standard UI colors for CLI output
type DefaultKeyMap ¶
type Dependency ¶
type Dependency struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.