find

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 8 Imported by: 0

README

Go Reference

find

Utility functions for pattern matching. For use in tools that do text editing or command-line automation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Files

func Files(filter string, pathPatterns []string) []string

Files searches for files matching the path patterns, where '**' is any number of folders and '*' is any substring. A file only has to match one of the patterns. If no patterns are given then all files under the current folder that contain the filter substring are taken.

Note: filter matching uses 'git grep' so only files that are added to git can be found by that method.

func LongestFixedPart

func LongestFixedPart(pattern string) string

LongestFixedPart gives the longest substring not containing any wildcards.

func Replace

func Replace(line, oldPattern, newPattern string) (string, bool)

Replace searches for oldPattern in line and replaces it with newPattern. '*' counts as wildcards in the patterns.

If the line was modified then it will be returned along with true, otherwise false will be returned and the string will be empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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