X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=main.go;h=1262c57f53c2451a7459384d1f001b0528503ca1;hb=6266daf3965402077cb14e8997b20695657394db;hp=ed87a54efa8b84e3706e1436b5f5e59e2c613d62;hpb=49e60b03d933ffef8592e38ab8bd3f3a0f253cdb;p=goredo.git diff --git a/main.go b/main.go index ed87a54..1262c57 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ /* goredo -- redo implementation on pure Go -Copyright (C) 2020 Sergey Matveev +Copyright (C) 2020-2021 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,6 @@ import ( "strings" "go.cypherpunks.ru/recfile" - "golang.org/x/sys/unix" ) var ( @@ -60,7 +59,7 @@ func mustParseFd(v, name string) *os.File { func main() { version := flag.Bool("version", false, "print version") warranty := flag.Bool("warranty", false, "print warranty information") - symlinks := flag.Bool("symlinks", false, "create necessary symlinks in current direcotyr") + symlinks := flag.Bool("symlinks", false, "create necessary symlinks in current directory") flag.Usage = usage flag.Parse() @@ -96,7 +95,7 @@ func main() { log.SetFlags(0) var err error - Cwd, err = unix.Getwd() + Cwd, err = os.Getwd() if err != nil { panic(err) } @@ -120,6 +119,9 @@ func main() { if *flagStderrSilent { mustSetenv(EnvStderrSilent, "1") } + if *flagNoProgress { + mustSetenv(EnvNoProgress, "1") + } if *flagDebug { mustSetenv(EnvDebug, "1") } @@ -137,6 +139,7 @@ func main() { } StderrKeep = os.Getenv(EnvStderrKeep) == "1" StderrSilent = os.Getenv(EnvStderrSilent) == "1" + NoProgress = os.Getenv(EnvNoProgress) == "1" Debug = os.Getenv(EnvDebug) == "1" LogWait = os.Getenv(EnvLogWait) == "1" LogLock = os.Getenv(EnvLogLock) == "1" @@ -261,6 +264,7 @@ CmdSwitch: } os.Remove(fdTmp.Name()) cwd, tgt := cwdAndTgt(tgts[0]) + cwdRel := cwdMustRel(cwd) doFile, upLevels, err := findDo(fdTmp, cwd, tgt) if err != nil { break @@ -283,7 +287,7 @@ CmdSwitch: if doFile == "" { ok = false } else { - fmt.Println(path.Join(strings.Repeat("..", upLevels), doFile)) + fmt.Println(path.Join(cwdRel, strings.Repeat("..", upLevels), doFile)) } default: log.Fatalln("unknown command", cmdName)