From 601f58169f450ccfeba72394eac549c4f412ab82 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 14 Dec 2020 19:40:11 +0300 Subject: [PATCH] Print found .do Previously only non-existent ones were printed out. --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 6cda53e..afed8e0 100644 --- a/main.go +++ b/main.go @@ -28,6 +28,7 @@ import ( "path" "path/filepath" "strconv" + "strings" "go.cypherpunks.ru/recfile" "golang.org/x/sys/unix" @@ -250,9 +251,8 @@ CmdSwitch: break } os.Remove(fdTmp.Name()) - var doFile string cwd, tgt := cwdAndTgt(tgts[0]) - doFile, _, err = findDo(fdTmp, cwd, tgt) + doFile, upLevels, err := findDo(fdTmp, cwd, tgt) if err != nil { break } @@ -271,7 +271,11 @@ CmdSwitch: } fmt.Println(cwdMustRel(cwd, m["Target"])) } - ok = doFile != "" + if doFile == "" { + ok = false + } else { + fmt.Println(path.Join(strings.Repeat("..", upLevels), doFile)) + } default: log.Fatalln("unknown command", cmdName) } -- 2.44.0