config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureGlaspDir

func EnsureGlaspDir(projectRoot string) error

EnsureGlaspDir creates the .glasp/ directory under projectRoot if it does not already exist. When the directory is newly created it also ensures that .claspignore contains a ".glasp/" entry so that clasp will not push glasp's internal files.

func FindProjectRoot

func FindProjectRoot() (string, error)

FindProjectRoot locates the nearest directory containing a .clasp.json. When no project root is found, it returns an empty string and a nil error.

func SaveClaspConfig

func SaveClaspConfig(dir string, cfg *ClaspConfig) error

SaveClaspConfig saves the ClaspConfig to a .clasp.json file in the specified directory.

func SaveGlaspConfig

func SaveGlaspConfig(projectRoot string, cfg *GlaspConfig) error

SaveGlaspConfig saves .glasp/config.json in the given project root.

Types

type ArchiveConfig

type ArchiveConfig struct {
	Pull bool `json:"pull"`
	Push bool `json:"push"`
}

ArchiveConfig controls archive settings.

type ClaspConfig

type ClaspConfig struct {
	ScriptID  string                     `json:"scriptId"`
	RootDir   string                     `json:"rootDir,omitempty"`
	ProjectID string                     `json:"projectId,omitempty"`
	ParentID  string                     `json:"parentId,omitempty"`
	Extra     map[string]json.RawMessage `json:"-"`
}

ClaspConfig represents the structure of .clasp.json

func LoadClaspConfig

func LoadClaspConfig(dir string) (*ClaspConfig, error)

LoadClaspConfig loads the .clasp.json file from the specified directory.

type ClaspIgnore

type ClaspIgnore struct {
	// contains filtered or unexported fields
}

ClaspIgnore represents the .claspignore patterns. It is a wrapper around gitignore.GitIgnore.

func NewClaspIgnore

func NewClaspIgnore(dir string) (*ClaspIgnore, error)

NewClaspIgnore parses the .claspignore file from the specified directory.

func (*ClaspIgnore) Matches

func (ci *ClaspIgnore) Matches(path string) bool

Matches returns true if the given path matches any of the ignore patterns.

type GlaspConfig

type GlaspConfig struct {
	Archive ArchiveConfig `json:"archive"`
}

GlaspConfig represents the structure of .glasp/config.json.

func LoadGlaspConfig

func LoadGlaspConfig(projectRoot string) (*GlaspConfig, error)

LoadGlaspConfig loads .glasp/config.json. If the file does not exist, it returns a default config.

Jump to

Keyboard shortcuts

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