Documentation
¶
Index ¶
- type Change
- type ChangeType
- type Sandbox
- func (s *Sandbox) Apply() error
- func (s *Sandbox) ApplyFile(path string) error
- func (s *Sandbox) Changes() []*Change
- func (s *Sandbox) Diff() string
- func (s *Sandbox) DiffFile(path string) string
- func (s *Sandbox) Discard()
- func (s *Sandbox) DiscardFile(path string)
- func (s *Sandbox) HasChanges() bool
- func (s *Sandbox) ProposeCreate(path string, content string) *Change
- func (s *Sandbox) ProposeDelete(path string) *Change
- func (s *Sandbox) ProposeModify(path string, newContent string) (*Change, error)
- func (s *Sandbox) SortedPaths() []string
- func (s *Sandbox) Stats() SandboxStats
- func (s *Sandbox) Summary() string
- type SandboxStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
ID string
Path string // relative file path
Type ChangeType
Content string // new content (for Create/Modify)
Original string // original content (for Modify, used for diff)
Timestamp time.Time
}
Change represents a single proposed file modification.
type ChangeType ¶
type ChangeType int
ChangeType identifies the kind of file modification.
const ( // ChangeCreate represents creating a new file. ChangeCreate ChangeType = iota // ChangeModify represents modifying an existing file. ChangeModify // ChangeDelete represents deleting a file. ChangeDelete )
func (ChangeType) String ¶
func (ct ChangeType) String() string
String returns a human-readable name for the change type.
type Sandbox ¶
type Sandbox struct {
// contains filtered or unexported fields
}
Sandbox accumulates proposed changes without modifying the filesystem.
func (*Sandbox) Apply ¶
Apply writes all pending changes to the actual filesystem. Each file write is atomic: content is written to a temp file then renamed.
func (*Sandbox) Discard ¶
func (s *Sandbox) Discard()
Discard removes all pending changes without applying.
func (*Sandbox) DiscardFile ¶
DiscardFile removes a single file's pending changes.
func (*Sandbox) HasChanges ¶
HasChanges returns true if there are any pending changes.
func (*Sandbox) ProposeCreate ¶
ProposeCreate stages a new file creation.
func (*Sandbox) ProposeDelete ¶
ProposeDelete stages a file deletion.
func (*Sandbox) ProposeModify ¶
ProposeModify stages a file modification. Reads the original content from disk.
func (*Sandbox) SortedPaths ¶
SortedPaths returns all pending paths in sorted order.