From cc18c735b51ace648dedb7a425a0b2e41e724af6 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 10 Dec 2020 19:45:03 +0300 Subject: [PATCH] Move tai64nlocal to tai64n module --- README | 10 +++++----- go.mod | 2 +- go.sum | 4 ++-- main.go | 6 ------ tai64n.go | 58 ------------------------------------------------------- usage.go | 2 +- 6 files changed, 9 insertions(+), 73 deletions(-) delete mode 100644 tai64n.go diff --git a/README b/README index bfd862e..222c94a 100644 --- a/README +++ b/README @@ -25,12 +25,12 @@ problems with the authenticity on your side, then build it manually: > $ git clone git://git.cypherpunks.ru/goredo.git $ cd goredo - $ git tag -v v0.4.0 + $ git tag -v v0.4.1 $ git clone git://git.cypherpunks.ru/gorecfile.git $ ( cd gorecfile ; git tag -v v0.3.0 ) $ echo "replace go.cypherpunks.ru/recfile => `pwd`/gorecfile" >> go.mod $ git clone git://git.cypherpunks.ru/gotai64n.git - $ ( cd gotai64n ; git tag -v v0.1.0 ) + $ ( cd gotai64n ; git tag -v v0.2.0 ) $ echo "replace go.cypherpunks.ru/tai64n => `pwd`/gotai64n" >> go.mod $ go build $ ./goredo -symlinks @@ -68,9 +68,9 @@ FEATURES *goredo-features* * optional statusline with currently running/waiting/done jobs * target's stderr can be stored on the disk with TAI64N timestamp prefixes for each line. To convert them to localtime you can use either - tai64nlocal utility from daemontools (http://cr.yp.to/daemontools.html) - or make a symlink, to use built-in slower decoder: > - $ ln -s goredo tai64nlocal + tai64nlocal utility from daemontools (http://cr.yp.to/daemontools.html), + or similar one: > + $ go get go.cypherpunks.ru/tai64n/cmd/tai64nlocal COMMANDS *goredo-commands* diff --git a/go.mod b/go.mod index f731fc5..7d665e7 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.14 require ( go.cypherpunks.ru/recfile v0.3.0 - go.cypherpunks.ru/tai64n v0.1.0 + go.cypherpunks.ru/tai64n v0.2.0 golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 diff --git a/go.sum b/go.sum index 1a103d7..c9c5695 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ go.cypherpunks.ru/recfile v0.3.0 h1:aZRMMst8hoNOIhGjCA/VxjTN5VBSEN4W4zyhWF/7xSU= go.cypherpunks.ru/recfile v0.3.0/go.mod h1:p1ZUMeyQQbQg+ICtKH3+Zt59QLI0tCZYZj/75Vp1buk= -go.cypherpunks.ru/tai64n v0.1.0 h1:XT1ys6lbo4/bjDQpMA8Xu5TCx6Y6aAYYYn5G0quE8sk= -go.cypherpunks.ru/tai64n v0.1.0/go.mod h1:mjuUq/ZQAOEKvzAAl25RIrN6JExWA4fRkOs7o7OVvYE= +go.cypherpunks.ru/tai64n v0.2.0 h1:ox04T0m9wVngTb5tDwrPyifukr01c6iJXHHJldlMQu8= +go.cypherpunks.ru/tai64n v0.2.0/go.mod h1:mjuUq/ZQAOEKvzAAl25RIrN6JExWA4fRkOs7o7OVvYE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= diff --git a/main.go b/main.go index 2e0778b..818b8da 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,6 @@ along with this program. If not, see . package main import ( - "bufio" "crypto/rand" "flag" "fmt" @@ -91,7 +90,6 @@ func main() { log.Println(err) } } - fmt.Println("not creating optional:", os.Args[0], "<- tai64nlocal") os.Exit(rc) } log.SetFlags(0) @@ -272,10 +270,6 @@ CmdSwitch: fmt.Println(cwdMustRel(cwd, m["Target"])) } ok = doFile != "" - case "tai64nlocal": - bw := bufio.NewWriter(os.Stdout) - err = tai64nLocal(bw, os.Stdin) - bw.Flush() default: log.Fatalln("unknown command", cmdName) } diff --git a/tai64n.go b/tai64n.go deleted file mode 100644 index c427835..0000000 --- a/tai64n.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -goredo -- redo implementation on pure Go -Copyright (C) 2020 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 -the Free Software Foundation, version 3 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -package main - -import ( - "bufio" - "io" - "strings" - "time" - - "go.cypherpunks.ru/tai64n" -) - -func tai64nLocal(dst io.StringWriter, src io.Reader) error { - scanner := bufio.NewScanner(src) - var err error - var s string - var sep int - var t time.Time - for { - if !scanner.Scan() { - if err = scanner.Err(); err != nil { - return err - } - break - } - s = scanner.Text() - - if s[0] != '@' { - dst.WriteString(s + "\n") - } - sep = strings.IndexByte(s, byte(' ')) - if sep == -1 { - dst.WriteString(s + "\n") - } - t, err = tai64n.Decode(s[1:sep]) - if err != nil { - return err - } - dst.WriteString(t.Format(tai64n.LocalFmt) + s[sep:] + "\n") - } - return nil -} diff --git a/usage.go b/usage.go index 7670f76..2113491 100644 --- a/usage.go +++ b/usage.go @@ -26,7 +26,7 @@ import ( ) const ( - Version = "0.4.0" + Version = "0.4.1" Warranty = `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 the Free Software Foundation, version 3 of the License. -- 2.44.0