ui

package
v0.0.0-...-0b5231c Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var ERROR_PREFIX = color.New(color.Bold, color.FgRed, color.ReverseVideo).Sprint(" ERROR ")
View Source
var InfoPrefix = color.New(color.Bold, color.FgWhite, color.ReverseVideo).Sprint(" INFO ")

InfoPrefix is a colored string for warning level log messages

View Source
var IsCI = !IsTTY || os.Getenv("CI") != "" || os.Getenv("BUILD_NUMBER") != "" || os.Getenv("TEAMCITY_VERSION") != ""

IsCI is true when we appear to be running in a non-interactive context.

View Source
var IsTTY = isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())

IsTTY is true when stdout appears to be a tty

View Source
var WARNING_PREFIX = color.New(color.Bold, color.FgYellow, color.ReverseVideo).Sprint(" WARNING ")

Functions

func Bold

func Bold(str string) string

func BuildColoredUi

func BuildColoredUi(colorMode ColorMode) *cli.ColoredUi

func Default

func Default() *cli.ColoredUi

Default returns the default colored ui

func Dim

func Dim(str string) string

Dim prints out dimmed text

func Rainbow

func Rainbow(text string) string

Rainbow function returns a formated colorized string ready to print it to the shell/terminal

Adapted from go-rainbow Copyright (c) 2017 Raphael Amorim Source: https://github.com/raphamorim/go-rainbow SPDX-License-Identifier: MIT

Types

type ColorMode

type ColorMode int
const (
	ColorModeUndefined ColorMode = iota + 1
	ColorModeSuppressed
	ColorModeForced
)

func GetColorModeFromEnv

func GetColorModeFromEnv() ColorMode

type Spinner

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

Spinner represents an indicator that an asynchronous operation is taking place.

For short operations, less than 4 seconds, display only the spinner with the Start and Stop methods. For longer operations, display intermediate progress events using the Events method.

func NewSpinner

func NewSpinner(w io.Writer) *Spinner

NewSpinner returns a spinner that outputs to w.

func (*Spinner) Start

func (s *Spinner) Start(label string)

Start starts the spinner suffixed with a label.

func (*Spinner) Stop

func (s *Spinner) Stop(label string)

Stop stops the spinner and replaces it with a label.

Directories

Path Synopsis
Package cursor provides functionality to interact with the terminal cursor.
Package cursor provides functionality to interact with the terminal cursor.

Jump to

Keyboard shortcuts

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