find

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 6 Imported by: 0

README

find

Utility functions for pattern matching, for use in text editing tools.

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: This makes use of 'git grep' so only files that are added to git can be matched.

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 then the string return is not to be used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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