Documentation
¶
Overview ¶
Package ops — path utilities shared across file operations.
Index ¶
- func StartJob(job *Job, srcProv, dstProv provider.Provider) tea.Cmd
- func TickProgress(job *Job) tea.Cmd
- func UniquePath(dir, name string) string
- func UniquePathWith(dir, name string, exists func(string) bool) string
- type CloseQueueMsg
- type DeleteConfirmedMsg
- type Job
- type JobDoneMsg
- type JobKind
- type JobStatus
- type ProgressMsg
- type Queue
- type QueueModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartJob ¶
StartJob returns a tea.Cmd that runs the job in a goroutine and sends a final JobDoneMsg when done. Progress is polled separately via TickProgress.
func TickProgress ¶
TickProgress returns a Cmd that snapshots progress for the given job and sends a ProgressMsg. The app calls this on a ticker.
func UniquePath ¶
UniquePath returns a path in dir that doesn't collide with any existing entry. Given "dir" and "base.txt", if dir/base.txt already exists it returns dir/base copy.txt, dir/base copy 2.txt, … up to 999.
Extension is preserved, which keeps macOS and GUI file-managers happy. "base" alone (no extension) becomes "base copy", "base copy 2", etc.
Only the local filesystem is checked; callers using non-local providers should pass a Stat wrapper or substitute their own existence check via UniquePathWith.
Types ¶
type CloseQueueMsg ¶
type CloseQueueMsg struct{}
CloseQueueMsg is sent when the user dismisses the job queue overlay.
type DeleteConfirmedMsg ¶
DeleteConfirmedMsg is sent by the pane when the user confirms deletion.
type Job ¶
type Job struct {
ID int
Kind JobKind
Src string
Dst string // empty for delete
Status JobStatus
Progress float64 // 0.0–1.0
BytesDone int64
BytesTotal int64
Speed float64 // bytes/sec, rolling average
ETA time.Duration
Err error
StartTime time.Time
// contains filtered or unexported fields
}
Job represents a single background file operation.
type JobDoneMsg ¶
JobDoneMsg is sent when a job completes (success or error).
type ProgressMsg ¶
ProgressMsg is sent periodically by a running job.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue manages a list of background file-operation jobs.
func (*Queue) ClearDone ¶
func (q *Queue) ClearDone()
ClearDone removes all jobs with StatusDone or StatusError from the queue.
func (*Queue) PauseJob ¶
PauseJob marks the job as paused so its goroutine will sleep between chunks.
type QueueModel ¶
type QueueModel struct {
Width int
Height int
Theme *theme.Theme
Queue *Queue
// contains filtered or unexported fields
}
QueueModel is the Bubbletea overlay model for the job queue.
func NewQueueModel ¶
func NewQueueModel(q *Queue, t *theme.Theme) *QueueModel
NewQueueModel creates a new QueueModel.
func (*QueueModel) Update ¶
func (m *QueueModel) Update(msg tea.Msg) (*QueueModel, tea.Cmd)
Update handles key events for the queue overlay.