file

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenInVim

func OpenInVim(o Openable) error

OpenInVim opens a template in Vim Recommended to use Go >= v.1.15.7 due to call to exec.Command() See: https://blog.golang.org/path-security

Types

type Openable

type Openable interface {
	GetFilePath() string
	GetFileCursorLine() int
}

Openable is the interface for which a file is opened

type ReadWriteable

type ReadWriteable interface {
	Load(io.Reader) error
	Write(io.Writer) error
	GetFilePath() string
}

ReadWriteable is the interface on which file operations are executed

type ReadWriter

type ReadWriter struct{}

ReadWriter executes file operations

func NewReadWriter

func NewReadWriter() *ReadWriter

NewReadWriter constructs a new ReadWriter

func (*ReadWriter) Exists

func (rw *ReadWriter) Exists(rwable ReadWriteable) bool

Exists evaluates if a file exists

func (*ReadWriter) Overwrite

func (rw *ReadWriter) Overwrite(rwable ReadWriteable) error

Overwrite writes a template to a file, overwriting existing file contents if any

func (*ReadWriter) Read

func (rw *ReadWriter) Read(rwable ReadWriteable) error

Read reads from file

Jump to

Keyboard shortcuts

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