Documentation ¶
Overview ¶
Package files handles logic for interacting with files.
Index ¶
- func GetVersionFilesInDirectory(dir string) ([]string, error)
- func GetVersionFromFile(dir string, inputFile string) (string, error)
- func GetVersionFromString(fileName string, input string) (string, error)
- func IsGitDir(dir string) (bool, error)
- func WriteVersionToFile(dir string, inputFile string, newVersion string) error
- type Error
- type VersionFileFinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetVersionFilesInDirectory ¶
GetVersionFilesInDirectory checks the provided directory for supported version files and returns a list of ones found.
func GetVersionFromFile ¶
GetVersionFromFile reads the version file and returns the semantic version contained.
func GetVersionFromString ¶
GetVersionFromString handles extracting the version from an file that has already been read and is passed as a string such as when getting the contents of a file from a git branch.
Types ¶
type Error ¶
type Error uint
Error is the error type.
const ( // ErrNoVersionFilesInDir is the error when no version files are found. ErrNoVersionFilesInDir Error = iota // ErrMultipleVersionFiles is the error when there are multiple valid version // file types found in a directory. ErrMultipleVersionFiles // ErrGettingVersionFromCMakeLists is the error when the version can't be // found inside a CMakeLists.txt file. ErrGettingVersionFromCMakeLists // ErrGettingVersionFromBuildGradle is the error when the a version key can't // be found inside a build.gradle or build.gradle.kts file. ErrGettingVersionFromBuildGradle // ErrGettingVersionFromPackageJSON is the error when a version key can't be // found inside a package.json file. ErrGettingVersionFromPackageJSON // ErrGettingVersionFromSetupPy is the error when a version key can't be found // inside a setup.py file. ErrGettingVersionFromSetupPy // ErrGettingVersionFromTOML is the error when a version key can't be found // inside a toml file. ErrGettingVersionFromTOML // ErrGettingVersionFromVERSION is the error when the VERSION file is empty. ErrGettingVersionFromVERSION )
type VersionFileFinder ¶
type VersionFileFinder struct { ErrorOnNoFilesFound bool FileFlag string Logger logger.Basic SearchDir string }
VersionFileFinder looks for the relevant version file based on the options specified.
func (VersionFileFinder) Find ¶
func (v VersionFileFinder) Find() (string, error)
Find returns the version file based on the config provided.
Click to show internal directories.
Click to hide internal directories.