Documentation ¶
Index ¶
- func CheckDirectoryOrCreate(ctx context.Context, dir string) (bool, error)
- func CheckEmptyDirectory(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 CreateFile(ctx context.Context, path string) error
- func DefaultTo(s string, defaultValue string) string
- func DeleteFile(ctx context.Context, file string) error
- func DirectoryExists(ctx context.Context, dir string) (bool, error)
- func EmptyDir(ctx context.Context, dir string) error
- func Exists(ctx context.Context, p string) (bool, error)
- func FileExists(ctx context.Context, file string) (bool, error)
- func GenerateTree(p, indent string) (string, error)
- func Must[T any](t T, err error) T
- func MustSolvePath(p string) string
- func Pointer[T any](t T) *T
- func PointerEqual[T comparable](t *T, target T) bool
- func ProtoType(m proto.Message) string
- func RenameDir(ctx context.Context, from string, to string) error
- func ShortLowerUUID() (string, error)
- 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 ErrorResourceNotFound
- type FSReader
- type FileSystem
- type IgnoreNoneHandler
- type IgnorePatterns
- type Override
- type OverrideAllHandler
- type OverrideExceptionHandler
- type PathSelect
- type Replacement
- type S
- type SelectPatterns
- type SignalWriter
- type SkipAllHandler
- type SliceWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirectoryOrCreate ¶
CheckDirectoryOrCreate checks if a directory exists or create it if it doesn't bool: created err: only for unexpected behavior
func CheckEmptyDirectory ¶ added in v0.1.84
CheckEmptyDirectory checks if a directory exists and is empty
func CheckEmptyDirectoryOrCreate ¶
CheckEmptyDirectoryOrCreate checks if a directory exists and is empty bool if created err only for unexpected behavior or if exists
func CreateFile ¶ added in v0.1.103
Create is equivalent of "touch"
func DirectoryExists ¶ added in v0.0.13
DirectoryExists checks for existence of folder err only for unexpected behavior
func Exists ¶ added in v0.1.89
Exists checks for existence of file/folder err only for unexpected behavior
func FileExists ¶
FileExists checks for existence of folder err only for unexpected behavior
func GenerateTree ¶
GenerateTree recursively generates a string representation of the directory tree
func MustSolvePath ¶ added in v0.1.84
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 ShortLowerUUID ¶ added in v0.1.53
ShortLowerUUID returns a UUID of 10 characters in base26 (lowercase letters only)
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 ErrorResourceNotFound ¶ added in v0.1.89
type ErrorResourceNotFound struct {
// contains filtered or unexported fields
}
func NewErrorResourceNotFound ¶ added in v0.1.89
func NewErrorResourceNotFound(resourceType string, resource string) *ErrorResourceNotFound
func (ErrorResourceNotFound) Error ¶ added in v0.1.89
func (e ErrorResourceNotFound) Error() string
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 SignalWriter ¶ added in v0.1.84
func NewSignalWriter ¶ added in v0.1.84
func NewSignalWriter(writer io.Writer) *SignalWriter
func (*SignalWriter) Signal ¶ added in v0.1.84
func (sw *SignalWriter) Signal() <-chan struct{}
type SkipAllHandler ¶ added in v0.1.18
type SkipAllHandler struct{}
func (*SkipAllHandler) Replace ¶ added in v0.1.18
func (*SkipAllHandler) Replace(string) bool
type SliceWriter ¶ added in v0.1.84
type SliceWriter struct { Data []string // contains filtered or unexported fields }
func NewSliceWriter ¶ added in v0.1.84
func NewSliceWriter() *SliceWriter
func (*SliceWriter) Close ¶ added in v0.1.84
func (sw *SliceWriter) Close() error