util

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HtmlHyperlinkEncode added in v0.0.6

func HtmlHyperlinkEncode(display string, uri string) string

HtmlHyperlinkEncode takes a string, and a uri and returns an html representation of a hyperlink using the normal anchor tags.

func NamedArgsTemplate added in v0.0.10

func NamedArgsTemplate(format string, replacements map[string]interface{}) string

NamedArgsTemplate takes a format string that contains named args wrapped in curly brackets, and templates them in. For example, "hello {name}!" will turn into "hello world!" if you pass a map with "name" => "world" into it.

func ShellHyperlinkEncode

func ShellHyperlinkEncode(display string, uri string) string

ShellHyperlinkEncode takes a string, and a uri and returns a shell encoded representation of a hyperlink using the modern shell escaping sequence. Idea from: https://purpleidea.com/blog/2018/06/29/hyperlinks-in-gnome-terminal/

func SmartURI

func SmartURI(uid string) string

SmartURI returns a "smart" URI given an internal UID that we have. The UID is the special string that's the unique identifier that's returned from each backend. We convert this into a "better" URI if we can. If we can't, we just return the uid unchanged. TODO: the different helper functions that are called within could be provided by each backend, instead of us writing them here and assuming how they work.

func StrInList added in v0.0.6

func StrInList(needle string, haystack []string) bool

StrInList returns true if a string exists inside a list, otherwise false.

Types

This section is empty.

Directories

Path Synopsis
Package errwrap contains some error helpers.
Package errwrap contains some error helpers.
Package licenses provides some structures for handling and representing software licenses.
Package licenses provides some structures for handling and representing software licenses.
Package safepath implements some types and methods for dealing with POSIX file paths safely.
Package safepath implements some types and methods for dealing with POSIX file paths safely.

Jump to

Keyboard shortcuts

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