From c480519fca2b635f0949f87510b3c39204ebdcd4 Mon Sep 17 00:00:00 2001 From: lawl Date: Sat, 5 Jun 2021 14:28:02 +0200 Subject: [PATCH] Resolve CWD arguments as absolute path Previously when calling e.g 'hs9001 search -cwd .' we would search for a litteral '.' in the database. Now we resolve that argument relative to the CWD. --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 7bfa2e4..8248977 100644 --- a/main.go +++ b/main.go @@ -314,7 +314,11 @@ func main() { } q := strings.Join(args, " ") - results := search(conn, "%"+q+"%", workDir, beginTimestamp, endTimeStamp, retVal) + cwdPath, err := filepath.Abs(workDir) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed parse working directory path: %s\n", err.Error()) + } + results := search(conn, "%"+q+"%", cwdPath, beginTimestamp, endTimeStamp, retVal) previousCmd := "" for e := results.Front(); e != nil; e = e.Next() {