options

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Json is the JSON output format.
	Json string = "json"
	// Yaml is the YAML output format.
	Yaml string = "yaml"
	// Toml is the TOML output format.
	Toml            string = "toml"
	GoStruct        string = "gostruct"
	Auto            string = "auto"
	Crd             string = "crd"
	OpenAPI         string = "openapi"
	JsonSchema      string = "jsonschema"
	TerraformSchema string = "terraformschema"
)
View Source
const (
	DefaultSettingsFile = "kcl.yaml"
)

Variables

This section is empty.

Functions

func CompileOptionFromCli

func CompileOptionFromCli(o *RunOptions) *opt.CompileOptions

CompileOptionFromCli will parse the kcl options from the cli options.

func LoadDepsFrom added in v0.7.0

func LoadDepsFrom(path string, quiet bool) (*kcl.Option, error)

LoadDepsFrom parses the kcl external package option from a path. It will find `kcl.mod` recursively from the path, resolve deps in the `kcl.mod` and return the option. If not found, return the empty option.

Types

type ImportOptions

type ImportOptions struct {
	Mode           string
	Files          []string
	Output         string
	Force          bool
	SkipValidation bool
	ModelPackage   string
	Recursive      bool
}

func NewImportOptions

func NewImportOptions() *ImportOptions

NewImportOptions returns a new instance of ImportOptions with default values.

func (*ImportOptions) Run

func (o *ImportOptions) Run() error

Run runs the kcl import command with options.

type RunOptions

type RunOptions struct {
	// Entries is the list of the kcl code entry including filepath, folder, OCI package, etc.
	Entries []string
	// Output is the result output filepath. Default is os.Stdout.
	Output string
	// Settings is the list of kcl setting files including all of the CLI config.
	Settings []string
	// Arguments is the list of top level dynamic arguments for the kcl option function, e.g., env="prod"
	Arguments []string
	// Overrides is the list of override paths and values, e.g., app.image="v2"
	Overrides []string
	// PathSelectors is the list of path selectors to select output result, e.g., a.b.c
	PathSelectors []string
	// ExternalPackages denotes the list of external packages, e.g., k8s=./vendor/k8s
	ExternalPackages []string
	// NoStyle denotes disabling the output information style and color.
	NoStyle bool
	// Quiet denotes disabling all the output information.
	Quiet bool
	// InsecureSkipTLSverify denotes skipping the TLS verification.
	InsecureSkipTLSverify bool
	// Vendor denotes running kcl in the vendor mode.
	Vendor bool
	// SortKeys denotes sorting the output result keys, e.g., `{b = 1, a = 2} => {a = 2, b = 1}`.
	SortKeys bool
	// ShowHidden denotes output the hidden attribute in the result.
	ShowHidden bool
	// DisableNone denotes running kcl and disable dumping None values.
	DisableNone bool
	// Debug denotes running kcl in debug mode.
	Debug bool
	// StrictRangeCheck performs the 32-bit strict numeric range checks on numbers.
	StrictRangeCheck bool
	// Git Url is the package url of the Git artifact.
	Git string
	// Oci Url is the package url of the OCI artifact.
	Oci string
	// Tag is the package tag of the OCI or Git artifact.
	Tag string
	// Commit is the package commit of the Git artifact.
	Commit string
	// Branch is the package branch of the Git artifact.
	Branch string
	// CompileOnly is used to check a local package and all of its dependencies for errors.
	CompileOnly bool
	// Format is the output type, e.g., Json, Yaml, Toml etc. Default is Yaml.
	Format string
	// Writer is used to output the run result. Default is os.Stdout.
	Writer io.Writer
	// ModSpec is the module spec for the KCL module.
	ModSpec *downloader.ModSpec
	// Force is used to force push the package to the registry.
	Force bool
}

RunOptions is a struct that holds the options for the run command.

func NewRunOptions

func NewRunOptions() *RunOptions

NewRunOptions returns a new instance of RunOptions with default values.

func (*RunOptions) Complete

func (o *RunOptions) Complete(args []string) error

Complete completes the options based on the provided arguments.

func (*RunOptions) Run

func (o *RunOptions) Run() error

Run runs the kcl run command with options.

func (*RunOptions) Validate

func (o *RunOptions) Validate() error

Validate validates the options.

Jump to

Keyboard shortcuts

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