Documentation
¶
Overview ¶
Package transform holds functions for path name transformations
Index ¶
- func AppyTimeGlobs(s string, t time.Time) string
- func Help() string
- func ParseGlobs(s string) (hasGlobs bool, substring string)
- func Path(ctx context.Context, s string, isDir bool) string
- func SetOptions(ctx context.Context, s ...string) (err error)
- func SuffixKeepExtension(remote string, suffix string) string
- func TimeFormat(timeFormat string) string
- func Transforming(ctx context.Context) bool
- func TrimBrackets(s string) string
- type Algo
- type CharmapChoices
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppyTimeGlobs ¶
AppyTimeGlobs converts "myfile-{DateOnly}.txt" to "myfile-2006-01-02.txt"
func Help ¶ added in v1.70.1
func Help() string
Help returns the help string cleaned up to simplify appending
func ParseGlobs ¶
ParseGlobs determines whether a string contains {brackets} and returns the substring (including both brackets) for replacing substring is first opening bracket to last closing bracket -- good for {{this}} but not {this}{this}
func Path ¶
Path transforms a path s according to the --name-transform options in use
If no transforms are in use, s is returned unchanged
func SetOptions ¶
SetOptions sets the options in ctx from flags passed in. Any existing flags will be overwritten. s should be in the same format as cmd line flags, i.e. "all,prefix=XXX"
func SuffixKeepExtension ¶
SuffixKeepExtension adds a suffix while keeping extension
i.e. file.txt becomes file_somesuffix.txt not file.txt_somesuffix
func TimeFormat ¶
TimeFormat converts a user-supplied string to a Go time constant, if possible
func Transforming ¶
Transforming returns true when transforms are in use
Types ¶
type Algo ¶ added in v1.70.1
Algo describes conversion setting
const ( ConvNone Algo = iota ConvToNFC ConvToNFD ConvToNFKC ConvToNFKD ConvFindReplace ConvPrefix ConvSuffix ConvSuffixKeepExtension ConvTrimPrefix ConvTrimSuffix ConvIndex ConvDate ConvTruncate ConvBase64Encode ConvBase64Decode ConvEncoder ConvDecoder ConvISO8859_1 ConvWindows1252 ConvMacintosh ConvCharmap ConvLowercase ConvUppercase ConvTitlecase ConvASCII ConvURL ConvRegex ConvCommand )
Supported transform options
type CharmapChoices ¶ added in v1.70.1
CharmapChoices is an enum of the character map choices.