Documentation
¶
Overview ¶
Example (NoTrailingNewline) ¶
Output: | Hello | | World |
Example (TrailingNewline) ¶
Output: | Hello | | World | ||
Index ¶
- func EscapePluginName(in string) string
- func EscapeQualifiedNameForDisk(in string) string
- func JoinQualifiedName(namespace, name string) string
- func ShortenString(str string, n int) string
- func SplitQualifiedName(str string) (string, string)
- func UnescapePluginName(in string) string
- func UnescapeQualifiedNameForDisk(in string) string
- type LineDelimiter
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapePluginName ¶
func EscapePluginName(in string) string
EscapePluginName converts a plugin name in the format vendor/pluginname into a proper ondisk vendor~pluginname plugin directory format.
func EscapeQualifiedNameForDisk ¶
func EscapeQualifiedNameForDisk(in string) string
EscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a string that is safe to use on-disk. This assumes that the input has already been validates as a qualified name. we use "~" rather than ":" here in case we ever use a filesystem that doesn't allow ":".
func JoinQualifiedName ¶
func JoinQualifiedName(namespace, name string) string
Joins 'namespace' and 'name' and returns a fully qualified name Assumes that the input is valid.
func ShortenString ¶
func ShortenString(str string, n int) string
Returns the first N slice of a string.
func SplitQualifiedName ¶
func SplitQualifiedName(str string) (string, string)
Splits a fully qualified name and returns its namespace and name. Assumes that the input 'str' has been validated.
func UnescapePluginName ¶
func UnescapePluginName(in string) string
UnescapePluginName converts a plugin directory name in the format vendor~pluginname into a proper vendor/pluginname.
func UnescapeQualifiedNameForDisk ¶
func UnescapeQualifiedNameForDisk(in string) string
UnescapeQualifiedNameForDisk converts an escaped plugin name (as per EscapeQualifiedNameForDisk) back to its normal form. This assumes that the input has already been validates as a qualified name.
Types ¶
type LineDelimiter ¶ added in v1.4.0
type LineDelimiter struct {
// contains filtered or unexported fields
}
LineDelimiter is a filter that will split input on lines and bracket each line with the delimiter string.
func NewLineDelimiter ¶ added in v1.4.0
func NewLineDelimiter(output io.Writer, delimiter string) *LineDelimiter
NewLineDelimiter allocates a new io.Writer that will split input on lines and bracket each line with the delimiter string. This can be useful in output tests where it is difficult to see and test trailing whitespace.