Documentation ¶
Index ¶
- Constants
- func AbsTarPath(tarPath string) (string, error)
- func CheckPackageSum(checkedSum, localPath string) bool
- func CreateFileIfNotExist(filePath string, storeFunc func() error) error
- func CreateSubdirInUserHome(subdir string) (string, error)
- func CreateSymlink(oldName, newName string) error
- func DirExists(path string) bool
- func Exists(path string) (bool, error)
- func ExtractTarball(tarPath, destDir string) error
- func FindKFiles(path string) ([]string, error)
- func GetUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStdinOpt bool) (string, string, error)
- func HashDir(dir string) (string, error)
- func IsGitRepoUrl(str string) bool
- func IsKfile(str string) bool
- func IsModRelativePath(s string) bool
- func IsRef(str string) bool
- func IsSymlinkValidAndExists(symlinkPath string) (bool, bool, error)
- func IsTar(str string) bool
- func IsURL(str string) bool
- func JoinPath(base, elem string) string
- func MoveFile(src, dest string) error
- func ParseRepoNameFromGitUrl(gitUrl string) string
- func RmNewline(s string) string
- func StoreToFile(filePath string, dataStr string) error
- func TarDir(srcDir string, tarPath string, include []string, exclude []string) error
- func UnTarDir(tarPath string, destDir string) error
Constants ¶
const ModRelativePathPattern = `\$\{([a-zA-Z0-9_-]+:)?KCL_MOD\}/`
Variables ¶
This section is empty.
Functions ¶
func AbsTarPath ¶ added in v0.3.7
AbsTarPath checks whether path 'tarPath' exists and whether path 'tarPath' ends with '.tar' And after checking, absTarPath return the abs path for 'tarPath'.
func CheckPackageSum ¶ added in v0.3.7
CheckPackageSum will check whether the 'checkedSum' is equal to the hash of the package under 'localPath'.
func CreateFileIfNotExist ¶
CreateFileIfNotExist will check whether the file under a certain path 'filePath/fileName' exists, and return an error if it exists, and call the method 'storeFunc' to save the file if it does not exist.
func CreateSubdirInUserHome ¶
DefaultKpmHome create the '.kpm' in the user home and return the path of ".kpm".
func CreateSymlink ¶
CreateSymlink will create symbolic link named 'newName' for 'oldName', and if the symbolic link already exists, it will be deleted and recreated. Note: CreateSymlink is only useful on unix-like systems.
func ExtractTarball ¶ added in v0.8.3
ExtractTarball support extracting tarball with '.tgz' format.
func FindKFiles ¶
FindKFiles will find all the '.k' files in the 'path' directory.
func GetUsernamePassword ¶
func GetUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStdinOpt bool) (string, string, error)
Copied/Adapted from https://github.com/helm/helm
func HashDir ¶
HashDir computes the checksum of a directory by concatenating all files and hashing them by sha256.
func IsGitRepoUrl ¶ added in v0.8.0
IsGitRepoUrl will check whether the string 'str' is a git repo url
func IsModRelativePath ¶ added in v0.9.1
If the path preffix is `${KCL_MOD}` or `${KCL_MOD:xxx}`
func IsSymlinkValidAndExists ¶ added in v0.8.5
IsSymlinkValidAndExists will check whether the symlink exists and points to a valid target return three values: whether the symlink exists, whether it points to a valid target, and any error encountered Note: IsSymlinkValidAndExists is only useful on unix-like systems.
func MoveFile ¶ added in v0.9.0
MoveFile will move the file from 'src' to 'dest'. On windows, it will copy the file from 'src' to 'dest', and then delete the file under 'src'. On unix-like systems, it will rename the file from 'src' to 'dest'.
func ParseRepoNameFromGitUrl ¶
ParseRepoNameFromGitUrl get the repo name from git url, the repo name in 'https://github.com/xxx/kcl1.git' is 'kcl1'.
func StoreToFile ¶
StoreToFile will store 'data' into toml file under 'filePath'.
Types ¶
This section is empty.