remapper

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package remapper provides functionality for renaming files in a directory based on a given extension map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseExtensionMap

func ParseExtensionMap(mapStr string) (map[string]string, error)

ParseExtensionMap parses a comma-separated string of old:new pairs into a map of extensions to be remapped.

func RemapExtensions

func RemapExtensions(dir string, extMap map[string]string, fsys FileSystem) error

RemapExtensions walks a directory and renames files based on the provided extension map.

Types

type FileSystem

type FileSystem interface {
	WalkDir(root string, fn fs.WalkDirFunc) error
	Rename(oldpath, newpath string) error
}

FileSystem defines an interface for file system operations needed by the remapper. This allows for a mock implementation in unit tests.

type LiveFS

type LiveFS struct{}

LiveFS is a concrete implementation of the FileSystem interface that uses the standard library's os and filepath packages.

func (*LiveFS) Rename

func (fs *LiveFS) Rename(oldpath, newpath string) error

Rename renames (moves) oldpath to newpath.

func (*LiveFS) WalkDir

func (fs *LiveFS) WalkDir(root string, fn fs.WalkDirFunc) error

WalkDir walks the file tree rooted at root, calling fn for each file or directory in the tree, including root.

Jump to

Keyboard shortcuts

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