X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=main.go;h=b5618e649916efac50dc6ca0d6668a330422f80a;hb=0151c27b27d1ff53cdf92488c412ae5cb01c3054;hp=6cda53efec6821a59a0b3d7562bd390ea3928d40;hpb=e4a620f5080f07a87bde6416f84160d11b7e5325;p=goredo.git diff --git a/main.go b/main.go index 6cda53e..b5618e6 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" @@ -144,6 +145,9 @@ func main() { MyPid = os.Getpid() } var traced bool + if *flagTraceAll { + mustSetenv(EnvTrace, "1") + } if *flagTrace { traced = true } else { @@ -250,9 +254,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 +274,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) }