source

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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/"
)
View Source
const (
	// HttpScheme is the URL scheme for Http-based requests
	HttpScheme = "http"
	// HttpsScheme is the URL scheme for Https-based requests
	HttpsScheme = "https"
)
View Source
const (
	// OCIScheme is the URL scheme for OCI-based requests
	OCIScheme = "oci"
	// TarPattern is the wildcard pattern for tar files.
	TarPattern = "*.tar"
)

Variables

View Source
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 FileExists

func FileExists(path string) bool

FileExists mark whether the path exists.

func GetSourceFromDir

func GetSourceFromDir(dir string) (string, error)

GetSourceFromDir returns the kcl source code located at a filepath,

func GetSourceFromEntryFiles

func GetSourceFromEntryFiles(entries []string) (string, error)

GetSourceFromEntryFiles returns the kcl entry located at a directory

func IsGit

func IsGit(src string) bool

IsGit determines whether or not a source is to be treated as a git source.

func IsLocal

func IsLocal(src string) bool

IsLocal determines whether or not a source is to be treated as a local path.

func IsOCI

func IsOCI(src string) bool

IsOCI determines whether or not a URL is to be treated as an OCI URL

func IsRemoteUrl

func IsRemoteUrl(src string) bool

IsRemoteUrl determines whether or not a URL is to be treated as an URL

func IsVCSDomain

func IsVCSDomain(src string) bool

IsVCSDomain determines whether or not a source is to be treated as a VCS source.

func LocaleSource

func LocaleSource(src string) (string, error)

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

func ReadFromOCISource(src string) (string, error)

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

func ReadThroughGetter(src string) (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL