Documentation
¶
Index ¶
- Constants
- Variables
- func FileExists(path string) bool
- func GetSourceFromDir(dir string) (string, error)
- func GetSourceFromEntryFiles(entries []string) (string, error)
- func IsGit(src string) bool
- func IsLocal(src string) bool
- func IsOCI(src string) bool
- func IsRemoteUrl(src string) bool
- func IsVCSDomain(src string) bool
- func LocaleSource(src string) (string, error)
- func ReadFromOCISource(src string) (string, error)
- func ReadThroughGetter(src string) (string, error)
Constants ¶
const ( // DefaultEntryFile is the default entry file for the package folder. DefaultEntryFile = "main.k" // DefaultEntryFile is the default entry config for the package folder. DefaultEntryConfig = "kcl.yaml" // EntryFilePattern is the wildcard pattern for kcl files. EntryFilePattern = "*.k" )
const ( // GitScheme is the URL scheme used for Git-based requests. GitScheme = "git" // GitHubDomain is the domain used for GitHub-based requests. GitHubDomain = "github.com" // GitLabDomain is the domain used for GitLab-based requests. GitLabDomain = "gitlab.com/inkscape/inkscape" // BitBucketDomain is the domain used for BitBucket-based requests. BitBucketDomain = "bitbucket.org/" )
const ( // HttpScheme is the URL scheme for Http-based requests HttpScheme = "http" // HttpsScheme is the URL scheme for Https-based requests HttpsScheme = "https" )
const ( // OCIScheme is the URL scheme for OCI-based requests OCIScheme = "oci" // TarPattern is the wildcard pattern for tar files. TarPattern = "*.tar" )
Variables ¶
var ( // ErrNoEntry denotes that no entry found for the given package. ErrNoEntry = errors.New("no kcl entry found, please check the code package") )
Functions ¶
func GetSourceFromDir ¶
GetSourceFromDir returns the kcl source code located at a filepath,
func GetSourceFromEntryFiles ¶
GetSourceFromEntryFiles returns the kcl entry located at a directory
func IsRemoteUrl ¶
IsRemoteUrl determines whether or not a URL is to be treated as an URL
func IsVCSDomain ¶
IsVCSDomain determines whether or not a source is to be treated as a VCS source.
func LocaleSource ¶
LocaleSource is used to get the source code content of different types of sources. The parameter src represents the path or content of the source code. If the source code is an OCI source, the code content read from the OCI source will be returned. If the source code is a local path, a remote URL, or a Git source, the code content will be obtained through the Getter from the source. If the source code is a pure code source, the source code content will be returned directly. If an error occurs during the acquisition process, an error message will be returned.
func ReadFromOCISource ¶
ReadFromOCISource reads source code from an OCI (Open Container Initiative) source.
Parameters: - src: a string containing the OCI source URL.
Return: A string containing the source code, and an error if any.
func ReadThroughGetter ¶
ReadThroughGetter is used to get the source code content from different types of sources (local path, remote URL, or Git source). It gets the pwd, creates temp files, and builds the client to get the code content. If an error occurs during the acquisition process, an error message will be returned.
Types ¶
This section is empty.