Documentation ¶
Overview ¶
Package secretpath implements utility functions for manipulating paths compatible with SecretHub (e.g. namespaces, repositories, directories, secrets and versions).
Index ¶
- func AddVersion(path string, version int) string
- func Base(path string) string
- func Clean(path string) string
- func Count(path string) int
- func HasVersion(path string) bool
- func Join(elements ...string) string
- func Namespace(path string) string
- func Parent(path string) string
- func Repo(path string) string
- func Version(path string) int
- type NaturalSort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddVersion ¶
AddVersion adds a version suffix to a given path, removing trailing separators if necessary. If the path already contains a version suffix, it is replaced by the given version number. Negative version numbers are converted to ":latest".
func Base ¶
Base returns the last element of a path. Trailing separators and version numbers are removed.
func Clean ¶
Clean returns the shortest path name equivalent to the given path by lexical processing. It removes trailing and multiple separator elements. Version suffixes are not removed.
func HasVersion ¶
HasVersion returns true when a version suffix is specified in the path. Note that even if the specified version suffix is invalid, this function still returns true.
func Join ¶
Join joins any number of elements into a path, adding a separator if necessary. Empty string elements are ignored.
func Parent ¶
Parent returns all but the last element of a path, removing trailing separators. If a path contains only one element, it returns an empty string.
Types ¶
type NaturalSort ¶
type NaturalSort []string
NaturalSort implements the sort.Interface by natural sorting.
func (NaturalSort) Len ¶
func (s NaturalSort) Len() int
func (NaturalSort) Less ¶
func (s NaturalSort) Less(i, j int) bool
func (NaturalSort) Swap ¶
func (s NaturalSort) Swap(i, j int)