Skip to content

Commit 320475b

Browse files
committed
Adds --ignore-path option
1 parent 798f727 commit 320475b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import (
1313
func main() {
1414
var appendMode bool
1515
flag.BoolVar(&appendMode, "a", false, "Append the value instead of replacing it")
16+
17+
var ignorePath bool
18+
flag.BoolVar(&ignorePath, "ignore-path", false, "Ignore the path when considering what constitutes a duplicate")
1619
flag.Parse()
1720

1821
seen := make(map[string]bool)
@@ -37,6 +40,9 @@ func main() {
3740
sort.Strings(pp)
3841

3942
key := fmt.Sprintf("%s%s?%s", u.Hostname(), u.EscapedPath(), strings.Join(pp, "&"))
43+
if ignorePath {
44+
key = fmt.Sprintf("%s?%s", u.Hostname(), strings.Join(pp, "&"))
45+
}
4046

4147
// Only output each host + path + params combination once
4248
if _, exists := seen[key]; exists {

0 commit comments

Comments
 (0)