opt

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseOciPkgNameAndVersion added in v0.9.0

func ParseOciPkgNameAndVersion(s string) (string, string, error)

parseOciPkgNameAndVersion will parse package name and version from string "<pkg_name>:<pkg_version>".

Types

type AddOptions

type AddOptions struct {
	LocalPath    string
	NewPkgName   string
	RegistryOpts RegistryOptions
	NoSumCheck   bool
}

func (*AddOptions) Validate

func (opts *AddOptions) Validate() error

type CompileOptions added in v0.3.4

type CompileOptions struct {
	*kcl.Option
	// contains filtered or unexported fields
}

CompileOptions is the input options of 'kpm run'.

func DefaultCompileOptions added in v0.3.4

func DefaultCompileOptions() *CompileOptions

DefaultCompileOptions returns a default CompileOptions.

func (*CompileOptions) AddEntry added in v0.3.4

func (opts *CompileOptions) AddEntry(entry string)

AddEntry will add a compile entry file to the compiler.

func (*CompileOptions) Entries added in v0.3.4

func (opts *CompileOptions) Entries() []string

Entrirs will return the entries of the compiler.

func (*CompileOptions) ExtendEntries added in v0.3.4

func (opts *CompileOptions) ExtendEntries(entries []string)

ExtendEntries will extend the entries of the compiler.

func (*CompileOptions) HasSettingsYaml added in v0.3.4

func (opts *CompileOptions) HasSettingsYaml() bool

HasSettingsYaml will return the 'hasSettingsYaml' flag.

func (*CompileOptions) IsVendor added in v0.3.4

func (opts *CompileOptions) IsVendor() bool

IsVendor will return the 'isVendor' flag.

func (*CompileOptions) LogWriter added in v0.3.7

func (opts *CompileOptions) LogWriter() io.Writer

LogWriter will return the log writer of the compiler.

func (*CompileOptions) NoSumCheck added in v0.4.4

func (opts *CompileOptions) NoSumCheck() bool

NoSumCheck will return the 'no_sum_check' flag.

func (*CompileOptions) PkgPath added in v0.3.4

func (opts *CompileOptions) PkgPath() string

PkgPath will return the home path for a kcl package during compilation

func (*CompileOptions) SetEntries added in v0.4.0

func (opts *CompileOptions) SetEntries(entries []string)

SetEntries will set the entries of the compiler.

func (*CompileOptions) SetHasSettingsYaml added in v0.3.4

func (opts *CompileOptions) SetHasSettingsYaml(hasSettingsYaml bool)

SetHasSettingsYaml will set the 'hasSettingsYaml' flag.

func (*CompileOptions) SetLogWriter added in v0.3.7

func (opts *CompileOptions) SetLogWriter(writer io.Writer)

SetLogWriter will set the log writer of the compiler.

func (*CompileOptions) SetNoSumCheck added in v0.4.4

func (opts *CompileOptions) SetNoSumCheck(noSumCheck bool)

SetNoSumCheck will set the 'no_sum_check' flag.

func (*CompileOptions) SetPkgPath added in v0.3.4

func (opts *CompileOptions) SetPkgPath(pkgPath string)

SetPkgPath will set the home path for a kcl package during compilation

func (*CompileOptions) SetVendor added in v0.3.4

func (opts *CompileOptions) SetVendor(isVendor bool)

SetVendor will set the 'isVendor' flag.

type GitOptions

type GitOptions struct {
	Url    string
	Branch string
	Commit string
	Tag    string
}

func NewGitOptionsFromUrl added in v0.9.0

func NewGitOptionsFromUrl(parsedUrl *url.URL) *GitOptions

NewGitOptionsFromUrl will parse the git options from the git url. https, http, git and ssh are supported.

func (*GitOptions) Validate

func (opts *GitOptions) Validate() error

type InitOptions

type InitOptions struct {
	Name     string
	InitPath string
	Version  string
}

Input options of 'kpm init'.

func (*InitOptions) Validate

func (opts *InitOptions) Validate() error

type LocalOptions added in v0.3.3

type LocalOptions struct {
	Path string
}

LocalOptions for local packages. kpm will find packages from local path.

func NewLocalOptionsFromUrl added in v0.9.0

func NewLocalOptionsFromUrl(parsedUrl *url.URL) (*LocalOptions, error)

NewLocalOptionsFromUrl will parse the local options from the local path. scheme 'file' and only path is supported.

func ParseLocalPathOptions added in v0.9.0

func ParseLocalPathOptions(localPath string) (*LocalOptions, *reporter.KpmEvent)

ParseLocalPathOptions will parse the local path information from user cli inputs.

func (*LocalOptions) Validate added in v0.3.3

func (opts *LocalOptions) Validate() error

type OciFetchOptions added in v0.3.7

type OciFetchOptions struct {
	oras.FetchBytesOptions
	OciOptions
}

OciFetchOptions is the input options of the api to fetch oci manifest.

type OciManifestOptions added in v0.3.7

type OciManifestOptions struct {
	Annotations map[string]string
}

type OciOptions

type OciOptions struct {
	Reg         string
	Repo        string
	Tag         string
	PkgName     string
	Annotations map[string]string
}

OciOptions for download oci packages. kpm will download packages from oci registry by '{Reg}/{Repo}/{PkgName}:{Tag}'.

func NewOciOptionsFromRef added in v0.9.0

func NewOciOptionsFromRef(refStr string, settings *settings.Settings) (*OciOptions, error)

NewOciOptionsFromRef will parse the oci options from the oci ref. The ref should be in the format of 'repoName:repoTag'.

func NewOciOptionsFromUrl added in v0.9.0

func NewOciOptionsFromUrl(parsedUrl *url.URL) *OciOptions

NewOciOptionsFromUrl will parse the oci options from the oci url. https, http, oci is supported.

func ParseOciOptionFromOciUrl

func ParseOciOptionFromOciUrl(url, tag string) (*OciOptions, *reporter.KpmEvent)

ParseOciOptionFromOciUrl will parse oci url into an 'OciOptions'. If the 'tag' is empty, ParseOciOptionFromOciUrl will take 'latest' as the default tag.

func ParseOciUrl

func ParseOciUrl(ociUrl string) (*OciOptions, *reporter.KpmEvent)

ParseOciUrl will parse 'oci://hostName/repoName:repoTag' into OciOptions without tag.

func (*OciOptions) AddStoragePathSuffix

func (oci *OciOptions) AddStoragePathSuffix(pathPrefix string) string

AddStoragePathSuffix will take 'Registry/Repo/Tag' as a path suffix. e.g. Take '/usr/test' as input, and oci options is

OciOptions {
  Reg: 'docker.io',
  Repo: 'test/testRepo',
  Tag: 'v0.0.1'
}

You will get a path '/usr/test/docker.io/test/testRepo/v0.0.1'. Deprecated: This function will be deprecated, use 'SanitizePathWithSuffix' instead.

func (*OciOptions) SanitizePathWithSuffix added in v0.8.2

func (oci *OciOptions) SanitizePathWithSuffix(pathPrefix string) string

SanitizePathSuffix will take 'Registry/Repo/Tag' as a path suffix and sanitize it.

func (*OciOptions) Validate

func (opts *OciOptions) Validate() error

type Option added in v0.7.0

type Option func(*CompileOptions)

func WithEntries added in v0.4.5

func WithEntries(entries []string) Option

WithEntries will add entries to the compiler.

func WithKclOption added in v0.4.5

func WithKclOption(opt kcl.Option) Option

WithKclOption will add a kcl option to the compiler.

func WithLogWriter added in v0.7.0

func WithLogWriter(writer io.Writer) Option

WithLogWriter will set the log writer of the compiler.

func WithNoSumCheck added in v0.4.5

func WithNoSumCheck(is bool) Option

WithNoSumCheck will set the 'no_sum_check' flag.

func WithVendor added in v0.4.5

func WithVendor(isVendor bool) Option

WithEntry will add an entry to the compiler.

type RegistryOptions

type RegistryOptions struct {
	Git      *GitOptions
	Oci      *OciOptions
	Local    *LocalOptions
	Registry *OciOptions
}

func NewRegistryOptionsFrom added in v0.9.0

func NewRegistryOptionsFrom(rawUrlorOciRef string, settings *settings.Settings) (*RegistryOptions, error)

NewRegistryOptionsFrom will parse the registry options from oci url, oci ref and git url. If you do not know the url of the package is git or oci, you can use this function to parse the options. By default: 'git://', "https://", "http://" will be parsed as git options. 'oci://', will be parsed as oci options. 'file://' or a file path will be parsed as local options.

If you know the url is git or oci, you can use 'NewGitOptionsFromUrl' or 'NewOciOptionsFromUrl' to parse the options. 'oci' and 'http', 'https' are supported for 'NewOciOptionsFromUrl'. 'git', 'http', 'https', 'ssh' are supported for 'NewGitOptionsFromUrl'.

Jump to

Keyboard shortcuts

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