filesystem

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// ReadFile reads the content of a file
	ReadFile(path string) ([]byte, error)
	// WriteFile writes content to a file
	WriteFile(path string, content []byte) error
	// EditFile opens a file in the user's editor and returns the edited content
	EditFile(path string) ([]byte, error)
	// EditTempFile creates a temporary file with content, opens it in editor, and returns edited content
	EditTempFile(content string, extension string) (string, error)
	// ViewWithPager displays content using a pager
	ViewWithPager(content string) error
}

Adapter defines the interface for filesystem operations

type RealAdapter

type RealAdapter struct{}

RealAdapter provides a real implementation of the filesystem adapter

func NewRealAdapter

func NewRealAdapter() *RealAdapter

NewRealAdapter creates a new real filesystem adapter

func (*RealAdapter) EditFile

func (a *RealAdapter) EditFile(path string) ([]byte, error)

EditFile implements the Adapter interface

func (*RealAdapter) EditTempFile

func (a *RealAdapter) EditTempFile(content string, extension string) (string, error)

EditTempFile implements the Adapter interface

func (*RealAdapter) ReadFile

func (a *RealAdapter) ReadFile(path string) ([]byte, error)

ReadFile implements the Adapter interface

func (*RealAdapter) ViewWithPager

func (a *RealAdapter) ViewWithPager(content string) error

ViewWithPager implements the Adapter interface

func (*RealAdapter) WriteFile

func (a *RealAdapter) WriteFile(path string, content []byte) error

WriteFile implements the Adapter interface

Jump to

Keyboard shortcuts

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