cp

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 1

README

cp is a library for selectively copying files between directories, using an allowlisting approach

Mainly used for building docker contexts with only the desired files included

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(c Config) error

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from source to destination, using hardlinks if it can ignores Include/Exclude patterns, as referencing a file copy directly is expected to be wanted based on https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang

func CopySymLink(source, dest string) error

func CreateIfNotExists

func CreateIfNotExists(dir string, perm os.FileMode) error

func Exists

func Exists(filePath string) bool

Types

type Config

type Config struct {
	// IncludePatterns are golang file globs for files to include in the copy
	IncludePatterns []string
	// ExcludePatterns are golang file globs for files to exclude that matched an include pattern
	ExcludePatterns []string
	// Source is the base directory to copy from
	Source string
	// Destination is the bast directory to copy to
	Destination string
}

Jump to

Keyboard shortcuts

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