Documentation
¶
Index ¶
- func CommonElementsInStringSlice(s1 []string, s2 []string) []string
- func DisplayURL(urlStr string) string
- func FmtDuration(d time.Duration) string
- func FormatDueDate(date *gitlab.ISOTime) string
- func Humanize(s string) string
- func Indent(s, indent string) string
- func IsEnvVarEnabled(key string) (bool, bool)
- func IsValidURL(toTest string) bool
- func Map[T1, T2 any](elems []T1, fn func(T1) T2) []T2
- func OpenInBrowser(url, browserType string) error
- func ParseEditorCommand(editorCmd string) []string
- func Pluralize(num int, thing string) string
- func PresentInInt64Slice(hay []int64, needle int64) bool
- func PresentInIntSlice(hay []int, needle int) bool
- func PresentInStringSlice(hay []string, needle string) bool
- func PrettyTimeAgo(ago time.Duration) string
- func PrintDeprecationWarning(key string)
- func RenderMarkdown(text, glamourStyle string) (string, error)
- func RenderMarkdownWithoutIndentations(text, glamourStyle string) (string, error)
- func ReplaceNonAlphaNumericChars(words, replaceWith string) string
- func SanitizePathName(path string) string
- func StringToInt(str string) int
- func TimeToPrettyTimeAgo(d time.Time) string
- type ListTitleOptions
- type MarkdownRenderOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonElementsInStringSlice ¶
CommonElementsInStringSlice takes 2 Slices of Strings and returns a Third Slice that is the common elements between the first 2 Slices.
func DisplayURL ¶
func FmtDuration ¶
func FormatDueDate ¶ added in v1.77.0
FormatDueDate returns an empty string if date is nil
func IsEnvVarEnabled ¶ added in v1.68.0
IsEnvVarEnabled checks if an environment variable is set and logs an error to stdout if it a boolean value cannot be parsed
func IsValidURL ¶
IsValidUrl tests a string to determine if it is a well-structured url or not.
func Map ¶
func Map[T1, T2 any](elems []T1, fn func(T1) T2) []T2
Map transfers the elements of its first argument using the result of the second fn(e)
func OpenInBrowser ¶
OpenInBrowser opens the url in a web browser based on OS and $BROWSER environment variable
func ParseEditorCommand ¶ added in v1.88.0
ParseEditorCommand parses an editor command string into separate command and arguments. This is useful when passing editor commands to libraries like huh that expect separate command and argument parameters.
For example:
- Input: "emacsclient -t -a \"emacs -nw\""
- Output: []string{"emacsclient", "-t", "-a", "emacs -nw"}
If parsing fails, it returns a slice containing just the original string.
func PresentInInt64Slice ¶ added in v1.79.0
PresentInInt64Slice take a Hay (Slice of Int64s) and a Needle (int64) and returns true based on whether or not the Needle is present in the hay.
func PresentInIntSlice ¶
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 ¶
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 PrintDeprecationWarning ¶ added in v1.73.0
func PrintDeprecationWarning(key string)
PrintDeprecationWarning prints a deprecation warning to use the `GLAB_` prefix with environment variables
func RenderMarkdown ¶
func ReplaceNonAlphaNumericChars ¶
ReplaceNonAlphaNumericChars: Replaces non alpha-numeric values with provided char/string
func SanitizePathName ¶
func StringToInt ¶
func TimeToPrettyTimeAgo ¶
Types ¶
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
type MarkdownRenderOpts ¶
type MarkdownRenderOpts []glamour.TermRendererOption