Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

More configurable path #70

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Bug fix
  • Loading branch information
user202729 committed Mar 2, 2020
commit 803f44167df3b2bb0dcf61ad32debf6ec4bd8c32
29 changes: 15 additions & 14 deletions cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func min(a, b int) int {

func parsePath(path string) (output map[string]string) {
//path = filepath.ToSlash(path) + "/"
components := filepath.SplitList(path)
components := strings.Split(path, string(filepath.Separator))

// output := make(map[string]string)
cfg := config.Instance
Expand All @@ -282,23 +282,24 @@ func parsePath(path string) (output map[string]string) {
reg := regexp.MustCompile("^" + strings.Join(specifier[:length], "/") + "$")
names := reg.SubexpNames()
output = make(map[string]string)
for i, val := range reg.FindStringSubmatch(
strings.Join(components[len(components)-length:], "/")) {
if names[i] != "" && val != "" {
// (how can val be empty anyway?)
// it's possible to use noncapturing group to avoid having to check this
if existing, ok := output[names[i]]; ok {
if existing != val {
continue outer
match := reg.FindStringSubmatch(strings.Join(components[len(components)-length:], "/"))
if match != nil {
for i, val := range match {
if names[i] != "" && val != "" {
// (how can val be empty anyway?)
// it's possible to use noncapturing group to avoid having to check this
if existing, ok := output[names[i]]; ok {
if existing != val {
continue outer
}
} else {
output[names[i]] = val
}
} else {
output[names[i]] = val
}
}
output["problemType"] = problemType
return
}
// Full match.
output["problemType"] = problemType
return nil
/*
for index, component := range components[len(components) - length] {
specifier[index]
Expand Down