Documentation
¶
Index ¶
- func CopyFile(src, dst string) error
- func CopyFileToDestination(srcPath, destPath string) error
- func GetBrowserDownloadDir() string
- func GetDefaultDownloadDirs() []string
- func IsArchive(filename string) bool
- func ParseDuration(s string) (time.Duration, error)
- func ParseRecentArgument(arg string) (count int, maxAge time.Duration, err error)
- type ArchiveInfo
- type FileInfo
- func CopyMostRecentDownload(maxAge time.Duration) (*FileInfo, error)
- func CopyRecentDownloads(maxAge time.Duration, maxCount int) ([]FileInfo, error)
- func FindMostRecentFile(opts FindOptions) (*FileInfo, error)
- func FindRecentFiles(opts FindOptions) ([]FileInfo, error)
- func GetRecentDownloads(config PickerConfig, maxCount int) ([]FileInfo, error)
- func PasteMostRecentDownload(destination string, maxAge time.Duration) (*FileInfo, error)
- func PasteRecentDownloads(destination string, maxAge time.Duration, maxCount int) ([]FileInfo, error)
- func PickMultipleRecentDownloads(config PickerConfig) ([]*FileInfo, error)
- func PickRecentDownload(maxAge time.Duration) (*FileInfo, error)
- func PickRecentDownloadWithConfig(config PickerConfig) (*FileInfo, error)
- type FindOptions
- type PickerConfig
- type PickerResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶ added in v1.2.0
copyFile copies a single file CopyFile copies a file from src to dst, preserving permissions and creating directories as needed
func CopyFileToDestination ¶ added in v0.7.2
CopyFileToDestination copies a file or directory to the specified destination
func GetBrowserDownloadDir ¶
func GetBrowserDownloadDir() string
GetBrowserDownloadDir attempts to detect browser-specific download directories
func GetDefaultDownloadDirs ¶
func GetDefaultDownloadDirs() []string
GetDefaultDownloadDirs returns common download directories on macOS
func ParseDuration ¶
ParseDuration parses duration strings like "5m", "1h", "30s", "7d", "2 weeks ago"
func ParseRecentArgument ¶ added in v1.2.0
ParseRecentArgument parses the argument to -r or -i flags Returns count (number of files) and maxAge (time duration) Examples:
- "" or " " -> count=1, maxAge=0 (default)
- "3" -> count=3, maxAge=0
- "5m" -> count=0, maxAge=5 minutes (0 means all files in period)
Types ¶
type ArchiveInfo ¶
type ArchiveInfo struct {
OriginalName string // e.g. "project.zip"
FolderPath string // e.g. "/Users/neil/Downloads/project/"
Contents []FileInfo
}
ArchiveInfo represents information about an auto-unarchived download
type FileInfo ¶
type FileInfo struct {
Path string
Name string
Size int64
Modified time.Time
IsDir bool
MimeType string // MIME type of the file (empty for directories)
}
FileInfo represents a file with its metadata
func CopyMostRecentDownload ¶
CopyMostRecentDownload finds the most recent download and copies it to clipboard This is the primary use case: "I just downloaded something, copy it to clipboard"
func CopyRecentDownloads ¶
CopyRecentDownloads finds multiple recent downloads and copies them to clipboard This handles the case where multiple files were downloaded as a batch
func FindMostRecentFile ¶
func FindMostRecentFile(opts FindOptions) (*FileInfo, error)
FindMostRecentFile finds the single most recent file
func FindRecentFiles ¶
func FindRecentFiles(opts FindOptions) ([]FileInfo, error)
FindRecentFiles finds files matching the given criteria
func GetRecentDownloads ¶ added in v0.8.0
func GetRecentDownloads(config PickerConfig, maxCount int) ([]FileInfo, error)
GetRecentDownloads returns recent files for picker display
func PasteMostRecentDownload ¶
PasteMostRecentDownload finds and copies the most recent download to destination This is the primary use case: "I just downloaded something, paste it here"
func PasteRecentDownloads ¶
func PasteRecentDownloads(destination string, maxAge time.Duration, maxCount int) ([]FileInfo, error)
PasteRecentDownloads finds and copies multiple recent downloads to destination This handles batch downloads like "I downloaded 5 photos, paste them all"
func PickMultipleRecentDownloads ¶ added in v0.8.0
func PickMultipleRecentDownloads(config PickerConfig) ([]*FileInfo, error)
PickMultipleRecentDownloads is deprecated - use GetRecentDownloads instead
func PickRecentDownloadWithConfig ¶ added in v0.8.0
func PickRecentDownloadWithConfig(config PickerConfig) (*FileInfo, error)
type FindOptions ¶
type FindOptions struct {
MaxAge time.Duration
MaxCount int
Directories []string
Extensions []string
ExcludeTemp bool
SmartUnarchive bool // Look inside auto-unarchived folders
}
FindOptions controls how recent files are discovered
func DefaultFindOptions ¶
func DefaultFindOptions() FindOptions
DefaultFindOptions returns sensible defaults for finding recent files
type PickerConfig ¶ added in v0.8.0
PickRecentDownload returns a single recent download This handles the case where you want to select from multiple recent files
type PickerResult ¶ added in v0.8.0
type PickerResult struct {
Files []*FileInfo
PasteMode bool // true if user pressed 'p' to copy & paste
}
PickerResult represents the result of an interactive file picker
func PickRecentDownloadsWithResult ¶ added in v0.8.0
func PickRecentDownloadsWithResult(config PickerConfig) (*PickerResult, error)
PickRecentDownloadsWithResult is deprecated - use GetRecentDownloads instead