Documentation ¶
Index ¶
- func CheckDirectory(ctx context.Context, dir string) (bool, error)
- func CheckDirectoryOrCreate(ctx context.Context, dir string) (bool, error)
- func CheckEmptyDirectoryOrCreate(ctx context.Context, dir string) (bool, error)
- func CopyFile(_ context.Context, from string, to string) error
- func DefaultTo(s string, defaultValue string) string
- func DeleteFile(ctx context.Context, file string) error
- func DirectoryExists(p string) bool
- func EmptyDir(dir string) error
- func FileExists(file string) bool
- func GenerateTree(p, indent string) (string, error)
- func Must[T any](t T, err error) T
- func Pointer[T any](t T) *T
- func PointerEqual[T comparable](t *T, target T) bool
- func ProtoType(m proto.Message) string
- func SolvePath(p string) (string, error)
- func ToCamelCase(s string) string
- func ToDNSCase(s string) string
- func ToDotSeparatedCase(s string) string
- func ToKebabCase(str string) string
- func ToLowerCase(s string) string
- func ToSnakeCase(s string) string
- func ToTitle(s string) string
- func TypeOf[T any]() string
- func WithOverride(ctx context.Context, override Override) context.Context
- type Case
- type ContextOverrideKey
- type ContextPathSelectKey
- type CopyInstruction
- type DirReader
- type FSReader
- type FileSystem
- type IgnoreNoneHandler
- type IgnorePatterns
- type Override
- type OverrideAllHandler
- type OverrideExceptionHandler
- type PathSelect
- type Replacement
- type S
- type SelectPatterns
- type SkipAllHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirectory ¶
CheckDirectory is a safer version of DirectoryExists return bool, err err only for unexpected behavior
func CheckDirectoryOrCreate ¶
CheckDirectoryOrCreate checks if a directory exists or create it if it doesn't bool: created err: only for unexpected behavior
func CheckEmptyDirectoryOrCreate ¶
CheckEmptyDirectoryOrCreate checks if a directory exists and is empty bool if created err only for unexpected behavior or if exists
func DirectoryExists ¶ added in v0.0.13
func FileExists ¶
func GenerateTree ¶
GenerateTree recursively generates a string representation of the directory tree
func PointerEqual ¶ added in v0.0.51
func PointerEqual[T comparable](t *T, target T) bool
PointerEqual returns true if pointer is not nil and value is equal
func ToCamelCase ¶ added in v0.0.51
ToCamelCase converts a string to camelCase
func ToDotSeparatedCase ¶ added in v0.1.31
func ToKebabCase ¶ added in v0.0.51
ToKebabCase converts a string to kebab-case
func ToLowerCase ¶ added in v0.0.51
func ToSnakeCase ¶ added in v0.0.51
ToSnakeCase converts a string to snake_case
Types ¶
type Case ¶ added in v0.0.51
type ContextOverrideKey ¶ added in v0.0.51
type ContextOverrideKey string
const (
OverrideKey ContextOverrideKey = "override"
)
type ContextPathSelectKey ¶ added in v0.1.20
type ContextPathSelectKey string
const (
PathSelectKey ContextPathSelectKey = "path-select"
)
type CopyInstruction ¶
type DirReader ¶ added in v0.0.13
type DirReader struct {
// contains filtered or unexported fields
}
func NewDirReader ¶ added in v0.0.13
func NewDirReader() *DirReader
type FSReader ¶ added in v0.0.13
type FileSystem ¶ added in v0.0.13
type IgnoreNoneHandler ¶ added in v0.0.51
type IgnoreNoneHandler struct{}
func (*IgnoreNoneHandler) Keep ¶ added in v0.1.20
func (i *IgnoreNoneHandler) Keep(string) bool
type IgnorePatterns ¶ added in v0.0.51
type IgnorePatterns struct {
// contains filtered or unexported fields
}
func NewIgnore ¶ added in v0.0.51
func NewIgnore(patterns ...string) *IgnorePatterns
func (*IgnorePatterns) Keep ¶ added in v0.1.20
func (ign *IgnorePatterns) Keep(file string) bool
type Override ¶ added in v0.0.13
func GetOverride ¶ added in v0.0.51
type OverrideAllHandler ¶ added in v0.1.18
type OverrideAllHandler struct{}
func (*OverrideAllHandler) Replace ¶ added in v0.1.18
func (*OverrideAllHandler) Replace(string) bool
type OverrideExceptionHandler ¶ added in v0.1.18
type OverrideExceptionHandler struct {
PathSelect
}
OverrideExceptionHandler replaces all paths EXCEPT the ones selected
func OverrideException ¶ added in v0.1.18
func OverrideException(sel PathSelect) *OverrideExceptionHandler
func (*OverrideExceptionHandler) Replace ¶ added in v0.1.18
func (handler *OverrideExceptionHandler) Replace(p string) bool
type PathSelect ¶ added in v0.1.20
func GetPathSelect ¶ added in v0.1.20
func GetPathSelect(ctx context.Context) PathSelect
func IgnoreNone ¶ added in v0.0.51
func IgnoreNone() PathSelect
type Replacement ¶
type SelectPatterns ¶ added in v0.1.4
type SelectPatterns struct {
// contains filtered or unexported fields
}
func NewSelect ¶ added in v0.1.4
func NewSelect(patterns ...string) *SelectPatterns
func (*SelectPatterns) Keep ¶ added in v0.1.14
func (ign *SelectPatterns) Keep(file string) bool
type SkipAllHandler ¶ added in v0.1.18
type SkipAllHandler struct{}
func (*SkipAllHandler) Replace ¶ added in v0.1.18
func (*SkipAllHandler) Replace(string) bool