Documentation
¶
Index ¶
- func Cleanup(s *store.Store, days int) error
- func Copy(s *store.Store, all bool, global bool, project string, indexStr string) error
- func Create(s *store.Store, project string, content []byte) error
- func CreateWithTitle(s *store.Store, project string, content []byte, providedTitle string) error
- func CreateWithTitleAndContent(s *store.Store, project string, title string, initialContent []byte) error
- func Delete(s *store.Store, all bool, global bool, project string, indexStr string) error
- func Export(s *store.Store, all, global bool, project string, ids []string, format string) error
- func GetScratchByIndex(s *store.Store, all, global bool, project string, indexStr string) (*store.Scratch, error)
- func Ls(s *store.Store, all, global bool, project string) []store.Scratch
- func Open(s *store.Store, all bool, global bool, project string, indexStr string) error
- func OpenLazy(s *store.Store, all bool, global bool, project string, indexStr string) error
- func Peek(s *store.Store, all, global bool, project string, indexStr string, lines int) (string, error)
- func Pin(s *store.Store, all, global bool, project string, id string) error
- func ReadContentFromPipe() []byte
- func ReadContentFromPipeWithReader(reader io.Reader) []byte
- func ResolveScratchID(s *store.Store, all, global bool, project string, id string) (*store.Scratch, error)
- func Search(s *store.Store, all, global bool, project, term string) ([]store.Scratch, error)
- func Unpin(s *store.Store, all, global bool, project string, id string) error
- func View(s *store.Store, all, global bool, project string, indexStr string) (string, error)
- type MissingFile
- type NukeResult
- type OrphanedFile
- type PathResult
- type RecoveredFile
- type RecoveryError
- type RecoveryOptions
- type RecoveryResult
- type RecoverySummary
- type ScratchWithIndex
- type ShowDataFileResult
- type TestSetup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶ added in v1.7.0
Copy retrieves a scratch by index and copies its content to the clipboard
func CreateWithTitle ¶ added in v1.3.0
CreateWithTitle creates a scratch with an optional pre-defined title
func CreateWithTitleAndContent ¶ added in v1.5.2
func CreateWithTitleAndContent(s *store.Store, project string, title string, initialContent []byte) error
CreateWithTitleAndContent creates a scratch with a title and optional initial content
func GetScratchByIndex ¶ added in v1.2.0
func OpenLazy ¶ added in v1.5.3
OpenLazy opens a scratch in the editor and exits immediately (non-blocking)
func ReadContentFromPipe ¶
func ReadContentFromPipe() []byte
ReadContentFromPipe checks if stdin is a pipe and reads its content
func ReadContentFromPipeWithReader ¶ added in v1.0.0
ReadContentFromPipeWithReader reads content from a pipe using the provided reader This function is exported to allow for easier testing with mock readers
func ResolveScratchID ¶ added in v1.8.0
func ResolveScratchID(s *store.Store, all, global bool, project string, id string) (*store.Scratch, error)
ResolveScratchID resolves various ID formats (index, pinned index, hash) to a scratch
Types ¶
type MissingFile ¶ added in v1.5.0
type MissingFile struct {
ID string `json:"id"`
Project string `json:"project"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
}
MissingFile represents a metadata entry without a corresponding file
type NukeResult ¶ added in v1.2.0
NukeResult contains the result of a nuke operation
type OrphanedFile ¶ added in v1.5.0
type OrphanedFile struct {
ID string `json:"id"`
Path string `json:"path"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
Title string `json:"title"` // Extracted from content
Preview string `json:"preview"` // First few lines
}
OrphanedFile represents a file found on disk without metadata
type PathResult ¶ added in v1.1.0
type PathResult struct {
Path string `json:"path"`
}
PathResult contains the path information for a scratch
type RecoveredFile ¶ added in v1.5.0
type RecoveredFile struct {
ID string `json:"id"`
Project string `json:"project"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
Source string `json:"source"` // "orphaned" or "reconstructed"
}
RecoveredFile represents a successfully recovered file
type RecoveryError ¶ added in v1.5.0
type RecoveryError struct {
Type string `json:"type"`
Message string `json:"message"`
FileID string `json:"file_id,omitempty"`
}
RecoveryError represents an error during recovery
type RecoveryOptions ¶ added in v1.5.0
type RecoveryOptions struct {
DryRun bool // Don't make changes, just report
RecoverOrphans bool // Recover orphaned files
CleanMissing bool // Remove metadata entries without files
DefaultProject string // Project to use for orphaned files (default: "recovered")
}
RecoveryOptions configures the recovery behavior
type RecoveryResult ¶ added in v1.5.0
type RecoveryResult struct {
// Orphaned files found (files without metadata entries)
OrphanedFiles []OrphanedFile `json:"orphaned_files"`
// Metadata entries without files
MissingFiles []MissingFile `json:"missing_files"`
// Successfully recovered files
RecoveredFiles []RecoveredFile `json:"recovered_files"`
// Errors encountered during recovery
Errors []RecoveryError `json:"errors"`
// Summary statistics
Summary RecoverySummary `json:"summary"`
}
RecoveryResult contains the results of a recovery operation
func Recover ¶ added in v1.5.0
func Recover(s *store.Store, options RecoveryOptions) (*RecoveryResult, error)
Recover performs a recovery operation on the scratch store
type RecoverySummary ¶ added in v1.5.0
type RecoverySummary struct {
TotalOrphaned int `json:"total_orphaned"`
TotalMissing int `json:"total_missing"`
TotalRecovered int `json:"total_recovered"`
TotalErrors int `json:"total_errors"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration string `json:"duration"`
}
RecoverySummary contains summary statistics
type ScratchWithIndex ¶ added in v1.2.0
ScratchWithIndex wraps a Scratch with its positional index
func SearchWithIndices ¶ added in v1.2.0
func SearchWithIndices(s *store.Store, all, global bool, project, term string) ([]ScratchWithIndex, error)
SearchWithIndices performs a search and returns results with their correct positional indices
type ShowDataFileResult ¶ added in v1.8.5
type ShowDataFileResult struct {
Path string `json:"path"`
}
ShowDataFileResult contains the data file path information
func ShowDataFile ¶ added in v1.8.5
func ShowDataFile(s *store.Store) (*ShowDataFileResult, error)
ShowDataFile returns the path to the data file used by padz
type TestSetup ¶ added in v1.2.0
TestSetup contains everything needed for testing commands
func SetupCommandTest ¶ added in v1.2.0
SetupCommandTest prepares a test environment for command tests
func (*TestSetup) ReadScratchFile ¶ added in v1.2.0
ReadScratchFile reads a scratch file from the test filesystem