Documentation
¶
Index ¶
- Variables
- func FindAllIncluded(exclude []*glob.Glob, targets []string) (found []string)
- func FindAllMatcher(targets []string, exclude []*glob.Glob, fn FindAllMatchingFn, ...) (files, matches []string)
- func FindAllMatchingRegexp(search *regexp.Regexp, targets []string, exclude []*glob.Glob, ...) (files, matches []string)
- func FindAllMatchingString(search string, targets []string, exclude []*glob.Glob, fn FindAllMatchingFn) (files, matches []string)
- func FindAllMatchingStringInsensitive(search string, targets []string, exclude []*glob.Glob, fn FindAllMatchingFn) (files, matches []string)
- func IsIncluded(exclude []*glob.Glob, input string) (included bool)
- func MakeRegexp(search string, o *Worker) (rx *regexp.Regexp, err error)
- func ProcessTargetRegex(search *regexp.Regexp, replace, target string) (original, modified string, delta *diff.Diff, err error)
- func ProcessTargetString(search, replace, target string) (original, modified string, delta *diff.Diff, err error)
- func ProcessTargetStringInsensitive(search, replace, target string) (original, modified string, delta *diff.Diff, err error)
- func RegexpReplace(search *regexp.Regexp, replace, contents string) (modified string)
- func StringReplace(search, replace, contents string) (modified string)
- func StringReplaceInsensitive(search, replace, contents string) string
- type FindAllMatcherFn
- type FindAllMatchingFn
- type Iterator
- func (i *Iterator) Apply() (count int, unified string, err error)
- func (i *Iterator) ApplyChanges(delta *diff.Diff) (count int, unified 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, delta *diff.Diff, err error)
- func (i *Iterator) Valid() (valid bool)
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CliFlags = []cli.Flag{ &cli.BoolFlag{ Category: "Configuration", Name: "nop", Usage: "report what would have otherwise been done", Aliases: []string{"n"}, }, &cli.BoolFlag{ Category: "Configuration", Name: "interactive", Usage: "selectively apply changes per file", Aliases: []string{"I"}, }, &cli.BoolFlag{ Category: "Configuration", Name: "backup", Usage: "make backups before replacing content", Aliases: []string{"b"}, }, &cli.StringFlag{ Category: "Configuration", Name: "bak", Usage: "specify the backup file suffix to use (implies -b)", Aliases: []string{"B"}, }, &cli.BoolFlag{ Category: "Configuration", Name: "show-diff", Usage: "include unified diffs of all changes in the output", Aliases: []string{"d"}, }, &cli.BoolFlag{ Category: "Configuration", Name: "ignore-case", Usage: "perform a case-insensitive search (literal or regex)", Aliases: []string{"i"}, }, &cli.BoolFlag{ Category: "File Selection", Name: "recurse", Usage: "recurse into sub-directories", Aliases: []string{"r"}, }, &cli.BoolFlag{ Category: "File Selection", Name: "all", Usage: `include files that start with a "."`, Aliases: []string{"a"}, }, &cli.StringSliceFlag{ Category: "File Selection", Name: "x", Usage: "exclude files matching glob patterns", }, &cli.BoolFlag{ Category: "Expressions", Name: "regex", Usage: "search and replace arguments are regular expressions", Aliases: []string{"p"}, }, &cli.BoolFlag{ Category: "Expressions", Name: "multi-line", Usage: "set the multi-line (?m) regexp flag (implies -P)", Aliases: []string{"m"}, }, &cli.BoolFlag{ Category: "Expressions", Name: "dot-match-nl", Usage: "set the dot-match-nl (?s) regexp flag (implies -P)", Aliases: []string{"s"}, }, &cli.BoolFlag{ Category: "General", Name: "quiet", Usage: "run silently, ignored if --nop is also used", Aliases: []string{"q"}, }, &cli.BoolFlag{ Category: "General", Name: "verbose", Usage: "run loudly, ignored if --quiet is also used", Aliases: []string{"v"}, }, } )
View Source
var (
DefaultBackupExtension = ".bak"
)
Functions ¶
func FindAllIncluded ¶
func FindAllMatcher ¶
func FindAllMatcher(targets []string, exclude []*glob.Glob, fn FindAllMatchingFn, matcher FindAllMatcherFn) (files, matches []string)
func FindAllMatchingRegexp ¶
func FindAllMatchingString ¶
func ProcessTargetRegex ¶
func ProcessTargetString ¶
func RegexpReplace ¶
func StringReplace ¶
Types ¶
type FindAllMatcherFn ¶
type FindAllMatchingFn ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) ApplyChanges ¶
type Worker ¶
type Worker struct { Regex bool MultiLine bool DotMatchNl bool Recurse bool DryRun bool All bool IgnoreCase bool Backup bool BackupExtension string ShowDiff bool Interactive bool Quiet bool Verbose bool Context *cli.Context Argv []string Argc int Search string Pattern *regexp.Regexp Replace string Exclude []*glob.Glob Targets []string Files []string Matched []string Notifier *notify.Notifier // contains filtered or unexported fields }
func MakeWorker ¶
func (*Worker) FileWriterErr ¶
func (w *Worker) FileWriterErr() (fwe filewriter.Writer)
func (*Worker) FileWriterOut ¶
func (w *Worker) FileWriterOut() (fwo filewriter.Writer)
func (*Worker) Init ¶
func (w *Worker) Init(fn FindAllMatchingFn)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.