visren

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

Package visren implements visual batch renaming for F4.

Its mask language and user-facing behaviour are based on FarPlugins/VisRen 3.2.0 (BSD-3-Clause), commit a31e48d7dd154c4fde86aef593810343a1289356.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitName

func SplitName(name string) (string, string)

func ValidateFilename

func ValidateFilename(name string) error

Types

type Dialog

type Dialog struct {
	*vtui.Window
	// contains filtered or unexported fields
}

func (*Dialog) ProcessKey

func (d *Dialog) ProcessKey(e *vtinput.InputEvent) bool

func (*Dialog) ProcessMouse

func (d *Dialog) ProcessMouse(e *vtinput.InputEvent) bool

func (*Dialog) ResizeConsole

func (d *Dialog) ResizeConsole(w, h int)

func (*Dialog) Show

func (d *Dialog) Show(scr *vtui.ScreenBuf)

type EditorRequest

type EditorRequest struct {
	Title      string
	Content    []byte
	CursorLine int
	CursorCol  int
	OnClose    func([]byte, error)
}

type Engine

type Engine struct {
	Items []*Item
}

func (*Engine) Build

func (e *Engine) Build(opts Options) ([]Preview, error)

type ErrorAction

type ErrorAction int
const (
	Retry ErrorAction = iota
	Skip
	SkipAll
	Cancel
)

type ErrorHandler

type ErrorHandler func(source, destination string, err error) ErrorAction

type Item

type Item struct {
	Source string
	MTime  time.Time
	IsDir  bool
	Random int
	// contains filtered or unexported fields
}

func NewItem

func NewItem(path, name string, mtime time.Time, isDir bool) *Item

func (*Item) Metadata

func (i *Item) Metadata() (Metadata, error)

type Metadata

type Metadata struct {
	Track, Title, Artist, Album, Year, Genre string
	CameraMake, CameraModel                  string
	ImageDate                                string
	Width, Height                            int
	Version                                  string
}

type Options

type Options struct {
	NameMask      string
	ExtMask       string
	Search        string
	Replace       string
	CaseSensitive bool
	Regex         bool
	WordDiv       string
}

type PanelHost

type PanelHost interface {
	vfs.App
	GetMarkedNames() []string
	ReplaceMarkedNames([]string)
	OpenVisRenEditor(EditorRequest) error
}

type Plugin

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

func (*Plugin) Close

func (p *Plugin) Close() error

func (*Plugin) GetName

func (p *Plugin) GetName() string

func (*Plugin) Init

func (p *Plugin) Init(api vfs.HostAPI) error

type Preview

type Preview struct {
	Item               *Item
	Destination        string
	Err                error
	Matches            []TextRange
	ReplacementMatches []TextRange
}

type RenamePair

type RenamePair struct {
	Old string
	New string
}

type RenameResult

type RenameResult struct {
	Succeeded []RenamePair
	Pending   []string
	Canceled  bool
}

func ExecuteRenames

func ExecuteRenames(ctx context.Context, fs *vfs.OSVFS, dir string, rows []Preview, onError ErrorHandler) RenameResult

func ExecuteUndo

func ExecuteUndo(ctx context.Context, fs *vfs.OSVFS, dir string, log []RenamePair, onError ErrorHandler) RenameResult

type TextRange

type TextRange struct {
	Start int
	End   int
}

TextRange is a half-open range of Unicode code points in a displayed name.

Jump to

Keyboard shortcuts

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