Update package name in import
This commit is contained in:
16
cmd/main.go
16
cmd/main.go
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
||||
"gitea.twomorecents.org/Rockingcool/kg/greg"
|
||||
reg "gitea.twomorecents.org/Rockingcool/kg/regex"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Flags for the regex Compile function
|
||||
flagsToCompile := make([]greg.ReFlag, 0)
|
||||
flagsToCompile := make([]reg.ReFlag, 0)
|
||||
|
||||
invertFlag := flag.Bool("v", false, "Invert match.")
|
||||
// This flag has two 'modes':
|
||||
@@ -31,10 +31,10 @@ func main() {
|
||||
|
||||
// These flags have to be passed to the Compile function
|
||||
if *multiLineFlag {
|
||||
flagsToCompile = append(flagsToCompile, greg.RE_MULTILINE, greg.RE_SINGLE_LINE)
|
||||
flagsToCompile = append(flagsToCompile, reg.RE_MULTILINE, reg.RE_SINGLE_LINE)
|
||||
}
|
||||
if *caseInsensitiveFlag {
|
||||
flagsToCompile = append(flagsToCompile, greg.RE_CASE_INSENSITIVE)
|
||||
flagsToCompile = append(flagsToCompile, reg.RE_CASE_INSENSITIVE)
|
||||
}
|
||||
|
||||
// -l and -o are mutually exclusive: -o overrides -l
|
||||
@@ -78,7 +78,7 @@ func main() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
out := bufio.NewWriter(os.Stdout)
|
||||
|
||||
regComp, err := greg.Compile(re, flagsToCompile...)
|
||||
regComp, err := reg.Compile(re, flagsToCompile...)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
@@ -119,14 +119,14 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
matchIndices := make([]greg.Match, 0)
|
||||
matchIndices := make([]reg.Match, 0)
|
||||
if matchNumFlagEnabled {
|
||||
tmp, err := greg.FindNthMatch(regComp, test_str, *matchNum)
|
||||
tmp, err := reg.FindNthMatch(regComp, test_str, *matchNum)
|
||||
if err == nil {
|
||||
matchIndices = append(matchIndices, tmp)
|
||||
}
|
||||
} else {
|
||||
matchIndices = greg.FindAllMatches(regComp, test_str)
|
||||
matchIndices = reg.FindAllMatches(regComp, test_str)
|
||||
}
|
||||
|
||||
if *printMatchesFlag {
|
||||
|
Reference in New Issue
Block a user