applescript

package
v0.0.0-...-f688354 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package applescript handles extracting notes and folders from Apple Notes via AppleScript executed through osascript.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAppleScriptDate

func ParseAppleScriptDate(s string) (time.Time, error)

ParseAppleScriptDate attempts to parse a date string from AppleScript output. AppleScript's date format depends on the user's macOS locale, so multiple formats are attempted.

func ParseFoldersOutput

func ParseFoldersOutput(raw string) ([]model.Folder, error)

ParseFoldersOutput parses the raw osascript output into Folder structs. The output is expected to use fieldDelimiter between fields and folderDelimiter between records.

func ParseNotesOutput

func ParseNotesOutput(raw string) ([]model.Note, error)

ParseNotesOutput parses the raw osascript output into Note structs. The output is expected to use fieldDelimiter between fields and noteDelimiter between records.

Types

type AppleScriptExtractor

type AppleScriptExtractor struct {
	// contains filtered or unexported fields
}

AppleScriptExtractor extracts notes from Apple Notes by executing AppleScript via the osascript command.

func NewAppleScriptExtractor

func NewAppleScriptExtractor(executor shell.CommandExecutor, logger *zap.Logger) *AppleScriptExtractor

NewAppleScriptExtractor creates a new extractor that uses the given CommandExecutor to invoke osascript.

func (*AppleScriptExtractor) GetAllNotes

func (e *AppleScriptExtractor) GetAllNotes(ctx context.Context, accounts []string, folders []string) ([]model.Note, error)

GetAllNotes returns all notes from Apple Notes, optionally filtered by account names and folder paths.

func (*AppleScriptExtractor) GetFolders

func (e *AppleScriptExtractor) GetFolders(ctx context.Context) ([]model.Folder, error)

GetFolders returns the complete folder hierarchy from Apple Notes.

type NoteExtractor

type NoteExtractor interface {
	// GetFolders returns the complete folder hierarchy across all accounts.
	GetFolders(ctx context.Context) ([]model.Folder, error)

	// GetAllNotes returns every note, optionally filtered by accounts and folders.
	// If accounts is nil, all accounts are included.
	// If folders is nil, all folders are included.
	GetAllNotes(ctx context.Context, accounts []string, folders []string) ([]model.Note, error)
}

NoteExtractor fetches notes and folders from Apple Notes via AppleScript.

Jump to

Keyboard shortcuts

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