config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Mode specifies the file update mode (upsert, exists, match).
	Mode Mode
	// RepoPath is the destination file path inside the repo, relative to repo root.
	RepoPath string
	// NewFile is the path to the new file content to write.
	NewFile string
	// Repo is the repository directory (default: .).
	Repo string
	// Branch is the name of the branch to create (optional, auto-generated if empty).
	Branch string
	// CommitMessage is the commit message (default: "chore: update {repo-path}").
	CommitMessage string
	// PRTitle is the PR title (default: "Update {repo-path}").
	PRTitle string
	// PRBody is the PR body content.
	PRBody string
	// Draft indicates whether to create the PR as a draft.
	Draft bool
	// DryRun indicates whether to run in dry-run mode (no changes made).
	DryRun bool
	// Remote is the git remote name (default: origin).
	Remote string
	// ExpectSHA256 is the expected SHA-256 hash for match mode.
	ExpectSHA256 string
}

Config holds all configuration options for the apply command.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with default values.

func (*Config) GetCommitMessage

func (c *Config) GetCommitMessage() string

GetCommitMessage returns the commit message, substituting defaults if necessary.

func (*Config) GetExpectedHashes added in v0.2.0

func (c *Config) GetExpectedHashes() []string

GetExpectedHashes returns the expected SHA-256 hashes as a slice. It splits the comma-separated hash string into individual hashes.

func (*Config) GetPRBody

func (c *Config) GetPRBody() string

GetPRBody returns the PR body, substituting defaults if necessary.

func (*Config) GetPRTitle

func (c *Config) GetPRTitle() string

GetPRTitle returns the PR title, substituting defaults if necessary.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the configuration is valid.

type Mode

type Mode string

Mode represents the file update mode for the apply command.

const (
	// ModeUpsert always writes the new file (create if missing, update if exists).
	ModeUpsert Mode = "upsert"
	// ModeExists only updates if the file already exists.
	ModeExists Mode = "exists"
	// ModeMatch only updates if the file exists and matches the expected SHA-256 hash.
	ModeMatch Mode = "match"
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode converts a string to a Mode, returning an error if invalid.

Jump to

Keyboard shortcuts

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