files

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidManifest = errors.New("not a valid typst manifest")
View Source
var ErrLoadingTypstToml = errors.New("could not load typst.toml")

Functions

func ConfigurableUpdateToml

func ConfigurableUpdateToml(w io.Writer, p PackageInfo, data []byte, unmarshal Unmarshaler, indent bool) error

Write the Packageinfo (name, version and entrypoint) to io.Writer

The Unmarshal Function can be configured (e.g. for testing Purposes)

func CopyFile

func CopyFile(src, dst string) error

Copy a file from src to dst

func Exists

func Exists(path string) bool

Check if a file or directory exists

func UpdateTOML

func UpdateTOML(w io.Writer, p PackageInfo, data []byte, indent bool) error

Update the Packageinfo (name, version and entrypoint)

Types

type Manifest

type Manifest struct {
	Package PackageInfo `toml:"package"`
}

type PackageInfo

type PackageInfo struct {
	// The Name of the Package
	Name string `toml:"name"`
	// The Version of the Package
	Version string `toml:"version"`
	// The Entrypoint of the Package
	Entrypoint string `toml:"entrypoint"`
}

Structure with the required Typst TOML fields

func ConfigureableUnmarshalToPackage

func ConfigureableUnmarshalToPackage(data []byte, unmarshal Unmarshaler) (PackageInfo, error)

Unmarshal a byte slice into a PackageInfo Struct

The Unmarshal Function can be configured (e.g. for testing Purposes)

func LoadPackageFromDirectory

func LoadPackageFromDirectory(directory string) (PackageInfo, error)

Load a typst Package from a directory. Returns an error if not existing.

func UnmarshalToPackage

func UnmarshalToPackage(data []byte) (PackageInfo, error)

Unmarshal a byte slice into a PackageInfo Struct

func (*PackageInfo) ValidateVersion

func (p *PackageInfo) ValidateVersion() bool

type Unmarshaler

type Unmarshaler func([]byte, any) error

Jump to

Keyboard shortcuts

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