Documentation ¶
Index ¶
- Variables
- func CommonElementsInStringSlice(s1 []string, s2 []string) (arr []string)
- func DisplayURL(urlStr string) string
- func Editor(opts EditorOptions) string
- func FailedIcon() string
- func GreenCheck() string
- func Humanize(s string) string
- func Indent(s, indent string) string
- func IsCygwinTerminal(f *os.File) bool
- func IsValidURL(toTest string) bool
- func NewColorable(out io.Writer) io.Writer
- func OpenInBrowser(url, browserType string) error
- func Pluralize(num int, thing string) string
- func PresentInIntSlice(hay []int, needle int) bool
- func PresentInStringSlice(hay []string, needle string) bool
- func PrettyTimeAgo(ago time.Duration) string
- func RedCheck() string
- func RenderMarkdown(text, glamourStyle string) (string, error)
- func ReplaceNonAlphaNumericChars(words, replaceWith string) string
- func StringToInt(str string) int
- func TerminalWidth(out io.Writer) int
- func TimeToPrettyTimeAgo(d time.Time) string
- func WarnIcon() string
- type EditorOptions
- type IOStreams
- func (s *IOStreams) ColorEnabled() bool
- func (s IOStreams) IsOutputTTY() bool
- func (s *IOStreams) PromptEnabled() bool
- func (s *IOStreams) SetPager(cmd string)
- func (s *IOStreams) SetPrompt(promptDisabled string)
- func (s *IOStreams) StartPager() error
- func (s *IOStreams) StopPager()
- func (s *IOStreams) TerminalWidth() int
- type ListTitleOptions
Constants ¶
This section is empty.
Variables ¶
var ( // Magenta outputs ANSI color if stdout is a tty Magenta = makeColorFunc("magenta") // Cyan outputs ANSI color if stdout is a tty Cyan = makeColorFunc("cyan") // Red outputs ANSI color if stdout is a tty Red = makeColorFunc("red") // Yellow outputs ANSI color if stdout is a tty Yellow = makeColorFunc("yellow") // Blue outputs ANSI color if stdout is a tty Blue = makeColorFunc("blue") // Green outputs ANSI color if stdout is a tty Green = makeColorFunc("green") // Gray outputs ANSI color if stdout is a tty Gray = makeColorFunc("black+h") // Bold outputs ANSI color if stdout is a tty Bold = makeColorFunc("default+b") )
var IsTerminal = func(f *os.File) bool { return isatty.IsTerminal(f.Fd()) || IsCygwinTerminal(f) }
IsTerminal reports whether the file descriptor is connected to a terminal
Functions ¶
func CommonElementsInStringSlice ¶ added in v1.14.0
CommonElementsInStringSlice takes 2 Slices of Strings and returns a Third Slice that is the common elements between the first 2 Slices.
func DisplayURL ¶
func Editor ¶
func Editor(opts EditorOptions) string
func FailedIcon ¶ added in v1.14.0
func FailedIcon() string
func GreenCheck ¶
func GreenCheck() string
func IsCygwinTerminal ¶ added in v1.12.0
func IsValidURL ¶ added in v1.14.0
isValidUrl tests a string to determine if it is a well-structured url or not.
func NewColorable ¶
NewColorable returns an output stream that handles ANSI color sequences on Windows
func OpenInBrowser ¶
OpenInBrowser opens the url in a web browser based on OS and $BROWSER environment variable
func PresentInIntSlice ¶ added in v1.14.0
PresentInIntSlice take a Hay (Slice of Ints) and a Needle (int) and returns true based on whether or not the Needle is present in the hay.
func PresentInStringSlice ¶ added in v1.14.0
PresentInStringSlice take a Hay (Slice of Strings) and a Needle (string) and returns true based on whether or not the Needle is present in the hay.
func PrettyTimeAgo ¶
func RenderMarkdown ¶
func ReplaceNonAlphaNumericChars ¶
ReplaceNonAlphaNumericChars : Replaces non alpha-numeric values with provided char/string
func StringToInt ¶
func TerminalWidth ¶ added in v1.12.0
func TimeToPrettyTimeAgo ¶
Types ¶
type EditorOptions ¶
type IOStreams ¶
type IOStreams struct { In io.ReadCloser StdOut io.Writer StdErr io.Writer IsaTTY bool //stdout is a tty IsErrTTY bool //stderr is a tty IsInTTY bool //stdin is a tty // contains filtered or unexported fields }
func InitIOStream ¶
func InitIOStream() *IOStreams
func (*IOStreams) ColorEnabled ¶ added in v1.12.0
func (IOStreams) IsOutputTTY ¶ added in v1.13.0
IsOutputTTY returns true if both stdout and stderr is TTY
func (*IOStreams) PromptEnabled ¶
func (*IOStreams) StartPager ¶
func (*IOStreams) TerminalWidth ¶ added in v1.12.0
type ListTitleOptions ¶
type ListTitleOptions struct { // Name of the List to be used in constructing Description and EmptyMessage if not provided. Name string // Page represents the page number of the current page Page int // CurrentPageTotal is the total number of items in current page CurrentPageTotal int // Total number of records. Default is the total number of rows. // Can be set to be greater than the total number of rows especially, if the list is paginated Total int // RepoName represents the name of the project or repository RepoName string // ListActionType should be either "search" or "list". Default is list ListActionType string // Optional. EmptyMessage to display when List is empty. If not provided, default one constructed from list Name. EmptyMessage string }
func NewListTitle ¶
func NewListTitle(listName string) ListTitleOptions
func (*ListTitleOptions) Describe ¶
func (opts *ListTitleOptions) Describe() string