Documentation
¶
Overview ¶
Package replace provides a text replacement Worker concept for iteratively and selectively working with searching and replacing content.
Index ¶
- Variables
- func FindAllIncluded(targets []string, includeHidden, noLimit, binAsText bool, ...) (found []string)
- func FindAllMatcher(targets []string, includeHidden, noLimit, binAsText bool, ...) (files, matches []string, err error)
- func FindAllMatchingRegexp(search *regexp.Regexp, targets []string, ...) (files, matches []string, err error)
- func FindAllMatchingString(search string, targets []string, includeHidden, noLimit, binAsText bool, ...) (files, matches []string, err error)
- func FindAllMatchingStringInsensitive(search string, targets []string, includeHidden, noLimit, binAsText bool, ...) (files, matches []string, err error)
- func IsIncluded(include, exclude globs.Globs, input string) (included bool)
- func MakeRegexp(search string, multiLine, dotMatchNl, ignoreCase bool) (rx *regexp.Regexp, err error)
- type FindAllMatcherFn
- type FindAllMatchingFn
- type Iterator
- func (i *Iterator) ApplyAll() (count int, unified, backup string, err error)
- func (i *Iterator) ApplySpecific(delta *diff.Diff) (count int, unified, backup string, err error)
- func (i *Iterator) Name() (path string)
- func (i *Iterator) Next()
- func (i *Iterator) Pos() (pos int)
- func (i *Iterator) Replace() (original, modified string, count int, delta *diff.Diff, err error)
- func (i *Iterator) Valid() (valid bool)
- type Worker
- func (w *Worker) FileWriterErr() (fwe filewriter.FileWriter)
- func (w *Worker) FileWriterOut() (fwo filewriter.FileWriter)
- func (w *Worker) FindMatching(fn FindAllMatchingFn) (err error)
- func (w *Worker) Init() (err error)
- func (w *Worker) InitTargets(fn FindAllMatchingFn) (err error)
- func (w *Worker) StartIterating() (iter *Iterator)
- func (w *Worker) String() (s string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultBackupExtension = "~" DefaultBackupSeparator = "~" )
View Source
var ( TempErrPattern = fmt.Sprintf("rpl-%d.*.err", os.Getpid()) TempOutPattern = fmt.Sprintf("rpl-%d.*.out", os.Getpid()) )
View Source
var ( ErrNotFound = errors.New("not found") ErrLargeFile = errors.New("large file") ErrBinaryFile = errors.New("binary file") ErrTooManyFiles = fmt.Errorf("too many files, try batches of %d or less", MaxFileCount) )
View Source
var ( MaxFileSize int64 = int64(math.Round(1024.0 * 1024.0 * 5.0)) MaxFileSizeLabel = humanize.Bytes(uint64(MaxFileSize)) MaxFileCount = 100000 )
Functions ¶
func FindAllIncluded ¶
func FindAllMatcher ¶
func FindAllMatcher(targets []string, includeHidden, noLimit, binAsText bool, include, exclude globs.Globs, fn FindAllMatchingFn, matcher FindAllMatcherFn) (files, matches []string, err error)
func FindAllMatchingRegexp ¶
func FindAllMatchingString ¶
Types ¶
type FindAllMatcherFn ¶
type FindAllMatchingFn ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) ApplySpecific ¶ added in v0.9.0
type Worker ¶
type Worker struct {
Regex bool
MultiLine bool
DotMatchNl bool
Recurse bool
Nop bool
All bool
IgnoreCase bool
PreserveCase bool
BinAsText bool
RelativePath string
Backup bool
BackupExtension string
NoLimits bool
ShowDiff bool
Interactive bool
Pause bool
Quiet bool
Verbose bool
Argv []string
Argc int
Search string
Pattern *regexp.Regexp
Replace string
Stdin bool
Null bool
AddFile []string
Include globs.Globs
IncludeArgs []string
Exclude globs.Globs
ExcludeArgs []string
Paths []string
Targets []string
Files []string
Matched []string
Notifier notify.Notifier
// contains filtered or unexported fields
}
func (*Worker) FileWriterErr ¶
func (w *Worker) FileWriterErr() (fwe filewriter.FileWriter)
func (*Worker) FileWriterOut ¶
func (w *Worker) FileWriterOut() (fwo filewriter.FileWriter)
func (*Worker) FindMatching ¶ added in v0.9.0
func (w *Worker) FindMatching(fn FindAllMatchingFn) (err error)
func (*Worker) InitTargets ¶ added in v0.9.0
func (w *Worker) InitTargets(fn FindAllMatchingFn) (err error)
func (*Worker) StartIterating ¶ added in v0.9.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.