internal

package
v0.0.0-...-7e4e5a8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDestDir

func GetDestDir(relpath string) (string, error)

GetDestDir computes absolute path to destination directory.

func GetSourceDir

func GetSourceDir(relpath string) (string, error)

GetSourceDir computes absolute path to source directory.

func Prompt

func Prompt(q string, suggest string) (string, error)

Prompt prompts a question to user.

func WalkFunc

func WalkFunc(op FileOp) fs.WalkDirFunc

WalkFunc wraps fs.WalkDirFunc with a specific FileOp.

Types

type Change

type Change struct {
	Replace string `yaml:"replace"`
	With    string `yaml:"with"`
	Default string `yaml:"default"`
}

Change represents a single change to make to copied files

type Changer

type Changer struct {
	Changes []*Change
}

Changer changes files after copying

func (*Changer) Operate

func (c *Changer) Operate(path string, isDir bool) error

Operate changes files based on config

type Config

type Config struct {
	Message         string             `yaml:"message"`
	Path            string             `yaml:"path"`
	Changes         map[string]*Change `yaml:"changes"`
	ModifyFilenames bool               `yaml:"modifyfilenames"`
}

Config represents configuration to copy and modify files

func GetConfig

func GetConfig(path string) (*Config, error)

GetConfig reads configuration file.

type Copier

type Copier struct {
	Source string
	Dest   string
}

Copier operated to copy files recursively

func (*Copier) Operate

func (c *Copier) Operate(sourcePath string, isDir bool) error

Operate copies files

type FileOp

type FileOp interface {
	Operate(path string, isDir bool) error
}

FileOp wraps a file operation type

Jump to

Keyboard shortcuts

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