spegling av
https://github.com/quitesimpleorg/hs9001.git
synced 2024-11-28 21:02:36 +01:00
Fix bug in cwd search and fix go-staticcheck regexp complaint
This commit is contained in:
förälder
16752411e1
incheckning
b9e3a3629b
13
main.go
13
main.go
@ -282,7 +282,7 @@ func main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
historycmd := args[0]
|
historycmd := args[0]
|
||||||
var rgx = regexp.MustCompile("\\s+\\d+\\s+(.*)")
|
var rgx = regexp.MustCompile(`\s+\d+\s+(.*)`)
|
||||||
rs := rgx.FindStringSubmatch(historycmd)
|
rs := rgx.FindStringSubmatch(historycmd)
|
||||||
if len(rs) == 2 {
|
if len(rs) == 2 {
|
||||||
add(conn, NewHistoryEntry(rs[1], ret))
|
add(conn, NewHistoryEntry(rs[1], ret))
|
||||||
@ -316,11 +316,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
q := strings.Join(args, " ")
|
q := strings.Join(args, " ")
|
||||||
cwdPath, err := filepath.Abs(workDir)
|
if workDir != "%" {
|
||||||
if err != nil {
|
workDir, err = filepath.Abs(workDir)
|
||||||
fmt.Fprintf(os.Stderr, "Failed parse working directory path: %s\n", err.Error())
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Failed parse working directory path: %s\n", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
results := search(conn, "%"+q+"%", cwdPath, beginTimestamp, endTimeStamp, retVal)
|
|
||||||
|
results := search(conn, "%"+q+"%", workDir, beginTimestamp, endTimeStamp, retVal)
|
||||||
|
|
||||||
previousCmd := ""
|
previousCmd := ""
|
||||||
for e := results.Front(); e != nil; e = e.Next() {
|
for e := results.Front(); e != nil; e = e.Next() {
|
||||||
|
Laddar…
Referens i nytt ärende
Block a user