package filetypes

import "cuelang.org/go/internal/filetypes"

Index

Functions

func DefaultTagsForInterpretation

func DefaultTagsForInterpretation(interp build.Interpretation, mode Mode) map[string]bool

DefaultTagsForInterpretation returns any tags that would be set by default in the given interpretation in the given mode.

func IsPackage

func IsPackage(s string) bool

IsPackage reports whether a command-line argument is a package based on its lexical representation alone.

func ParseArgs

func ParseArgs(args []string) (files []*build.File, err error)

ParseArgs converts a sequence of command line arguments representing files into a sequence of build file specifications.

The arguments are of the form

file* (spec: file+)*

where file is a filename and spec is itself of the form

tag[=value]('+'tag[=value])*

A file type spec applies to all its following files and until a next spec is found.

Examples:

json: foo.data bar.data json+schema: bar.schema

func ParseFile

func ParseFile(s string, mode Mode) (*build.File, error)

ParseFile parses a single-argument file specifier, such as when a file is passed to a command line argument.

Example:

cue eval -o yaml:foo.data

func ParseFileAndType

func ParseFileAndType(file, scope string, mode Mode) (*build.File, error)

ParseFileAndType parses a file and type combo.

Types

type FileInfo

type FileInfo = internal.FileInfo

func FromFile

func FromFile(b *build.File, mode Mode) (*FileInfo, error)

FromFile returns detailed file info for a given build file. It ignores b.Tags and b.BoolTags, instead assuming that any tag handling has already been processed by ParseArgs or similar. The b.Encoding field must be non-empty.

type Mode

type Mode int

Mode indicate the base mode of operation and indicates a different set of defaults.

const (
	Input Mode = iota // The default
	Export
	Def
	Eval
	NumModes
)

func (Mode) String

func (m Mode) String() string

type TagType

type TagType int
const (
	TagUnknown TagType = iota
	TagTopLevel
	TagSubsidiaryBool
	TagSubsidiaryString
)

func (TagType) String

func (i TagType) String() string

Source Files

filetypes.go tagtype_string.go tofile.go types.go types_gen.go util.go

Directories

PathSynopsis
internal/filetypes/internalPackage internal holds some internal parts of the filetypes package that need to be shared between the code generator and the package proper.
internal/filetypes/internal/genfunc
internal/filetypes/internal/genstructPackage genstruct provides support for simple compact struct representations.
internal/filetypes/internal/opt
Version
v0.13.0 (latest)
Published
May 22, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
23 hours ago

Tools for package owners.