Documentation ¶
Overview ¶
Package pathutil contains helpers to work with paths
Index ¶
- Variables
- func NewDirPathFlagWithDefault(defaultPath string) pflag.Value
- func NewFilePathFlagWithDefault(defaultPath string) pflag.Value
- func NewPathFlagWithDefault(defaultPath string) pflag.Value
- func WorkingTree(dotGitDirName string) (path string, err error)
- func WorkingTreeFromPath(p, dotGitDirName string) (path string, err error)
- type PathValue
- type PathValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrIsDirectory is an error returned when a path // points to a directory instead of a file ErrIsDirectory = errors.New("path is a directory") // ErrIsNotDirectory is an error returned when a path // is expected to points to a directory but isn't ErrIsNotDirectory = errors.New("path is not a directory") // ErrUnknownType is an error returned when an unknown PathValueType // is provided to a method ErrUnknownType = errors.New("type unknown") )
View Source
var ErrNoRepo = errors.New("not a git repository (or any of the parent directories)")
ErrNoRepo is an error returned when no repo are found
Functions ¶
func NewDirPathFlagWithDefault ¶
NewDirPathFlagWithDefault return a new Flag Value that should hold a valid path to a directory
func NewFilePathFlagWithDefault ¶
NewFilePathFlagWithDefault return a new Flag Value that should hold a valid path to a file
func NewPathFlagWithDefault ¶
NewPathFlagWithDefault return a new Flag Value that should hold a valid path to either a file or a directory
func WorkingTree ¶
WorkingTree returns the absolute path to the working tree
func WorkingTreeFromPath ¶
WorkingTreeFromPath returns the absolute path to the root of a repo containing the provided directory
Types ¶
type PathValue ¶
type PathValue struct {
// contains filtered or unexported fields
}
PathValue represents a Flag value to be parsed by spf13/pflag
type PathValueType ¶
type PathValueType int
PathValueType represents the type of a path
const ( // PathValueTypeFile represent file PathValueTypeFile PathValueType = iota // PathValueTypeDir represent a directory PathValueTypeDir // PathValueTypeAny represent a either a file or a directory PathValueTypeAny )
Click to show internal directories.
Click to hide internal directories.