From 5c09835df8efdb3505ff7e4cada069972cb39bda Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:19:44 +0800 Subject: [PATCH 01/13] Go to first column of current row before printing. --- const.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/const.go b/const.go index d6eea22..ddb125e 100644 --- a/const.go +++ b/const.go @@ -20,7 +20,7 @@ const cSTDERR = " ┌─ stderr" const cSTDDBG = " ┌─ debug" const cFOOTER = " └─" -const cANSI = "\x1b[0036m%s\x1b[0000m" +const cANSI = "\x1b[1G\x1b[0036m%s\x1b[0000m %s" const cTARC = "--no-same-owner --no-same-permissions" const cTARX = "--no-same-owner --no-same-permissions --no-overwrite-dir --no-acls --no-selinux --no-xattrs --touch" From ed03dcc11a5ef624585105b1e291469d83380375 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:20:28 +0800 Subject: [PATCH 02/13] Improve interleaved output by doing consolidated print call. --- main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.go b/main.go index 3333593..ca661a5 100644 --- a/main.go +++ b/main.go @@ -87,8 +87,7 @@ func getPassword(prompt string) (string, error) { } func (writer logWriter) Write(bytes []byte) (int, error) { - fmt.Printf(cANSI, time.Now().Format(time.RFC822Z)) - return fmt.Print(" " + string(bytes)) + return fmt.Printf(cANSI, time.Now().Format(time.RFC822Z), string(bytes)) } func soOutput(h string, m int) func(string) { From 067093ef7de218ea2fbbb22b41a98cca1790b41b Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:20:52 +0800 Subject: [PATCH 03/13] Now called taarr. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index ca661a5..4fa8519 100644 --- a/main.go +++ b/main.go @@ -552,7 +552,7 @@ rrl = report` if isatty.IsTerminal(os.Stdout.Fd()) { opt.mode = oTerm log.SetOutput(new(logWriter)) - log.Printf("rr %s “%s”", cVERSION, cCODE) + log.Printf("taarr %s “%s”", cVERSION, cCODE) } else { serrLog = slog.New(slog.NewJSONHandler(os.Stderr, nil)) } From 846ee37f7e5bb8471603d9706f649f2dee62e5b8 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:21:37 +0800 Subject: [PATCH 04/13] Try printing readme in $CWD if no arguments. --- main.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/main.go b/main.go index 4fa8519..b83db30 100644 --- a/main.go +++ b/main.go @@ -562,6 +562,34 @@ rrl = report` var id string = generateHashId() opt.id = id // used for the random suffix in the temp filename if len(os.Args) < 2 { + isReadme := func() (bool, string) { + match, _ := lib.FileGlob("README*") + for _, m := range match { + if lib.IsFile(m) { + return true, m + } + } + return false, "" + } + printReadme := func(s string) { + switch opt.mode { + case oTerm: + for _, each := range lib.FileLines(s) { + fmt.Printf(" \033[38;2;85;85;85m⋮\033[0m %s\n", each) + } + fmt.Printf("\n") + case oPlain: + fmt.Print(lib.FileRead(s)) + case oJson: + serrLog.Error("README output disabled in this mode.") + os.Exit(2) + } + } + if found1, readme1 := isReadme(); found1 && readme1 != "" { + log.Printf("Showing %s…", readme1) + printReadme(readme1) + os.Exit(0) + } switch opt.mode { case oJson: serrLog.Error(eUNSPECIFIED) From da2d7c540a0787b4eb0c11f9a73b22712f3936e1 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:22:07 +0800 Subject: [PATCH 05/13] Also add .lib includes in dump mode. --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index b83db30..eaeb399 100644 --- a/main.go +++ b/main.go @@ -679,6 +679,7 @@ rrl = report` var namespace string var script string var nsScript string + var dumpLib string var code string var interp string var opLog string @@ -771,6 +772,7 @@ rrl = report` os.Exit(255) } } + dumpLib = sh.String() if opt.sudo { if !opt.nopasswd { str, err := getPassword("sudo password: ") @@ -811,6 +813,7 @@ rrl = report` // rrd mode if mDump { + fmt.Print(dumpLib) fmt.Print(code) os.Exit(0) } From 6d1a5af520f512968bffea6bab91030649b78390 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:22:21 +0800 Subject: [PATCH 06/13] Unreached or dead code. --- main.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/main.go b/main.go index eaeb399..02ea468 100644 --- a/main.go +++ b/main.go @@ -694,16 +694,6 @@ rrl = report` if len(s) < 2 { s = strings.Split(os.Args[offset], ":") } - if len(s) < 2 { - switch opt.mode { - case oTerm, oPlain: - _, _ = fmt.Fprintln(os.Stderr, eUNSPECIFIED) - os.Exit(2) - case oJson: - serrLog.Error("namespace:script not specified") - os.Exit(2) - } - } namespace, script = s[0], s[1] if !lib.IsDir(namespace) { switch opt.mode { From 45dbc4641e9f86405f1e414899f0177f1cb36994 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:23:04 +0800 Subject: [PATCH 07/13] Should have a file so it is kept by version control. --- test/files/remote-nopasswd/.files/root/__rr_AAA/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/files/remote-nopasswd/.files/root/__rr_AAA/.keep diff --git a/test/files/remote-nopasswd/.files/root/__rr_AAA/.keep b/test/files/remote-nopasswd/.files/root/__rr_AAA/.keep new file mode 100644 index 0000000..e69de29 From d5c36c294edc536743f83bc5bdc0cc81cb3d1e0f Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:23:14 +0800 Subject: [PATCH 08/13] Called taarr now. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af6e4d5..e0d87f4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rr +# taarr Check out the documentation at [taarr.com](https://taarr.com) From bf98c748469bbdba8dabb31c0da32873ab63b997 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:24:25 +0800 Subject: [PATCH 09/13] For next release. --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b7c38..ec59a27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +#### 2.2.1 + +Unsafe Cupcake + +* Fix output during parallel runs +* Print README* file when no `namespace:script` specified +* Include `.lib` includes in `rrd` (dump) mode + #### 2.2.0 Craving Detonator From 440d534ec61cc55c46420101fe56d5f6196f9ef3 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:24:33 +0800 Subject: [PATCH 10/13] Better location. --- CHANGELOG.md => README.d/CHANGELOG.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CHANGELOG.md => README.d/CHANGELOG.md (100%) diff --git a/CHANGELOG.md b/README.d/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to README.d/CHANGELOG.md From 39d77fa40dcf873b8abc27544826ff4c61c8e482 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:24:57 +0800 Subject: [PATCH 11/13] For next release. --- const.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/const.go b/const.go index ddb125e..ba9aa8e 100644 --- a/const.go +++ b/const.go @@ -1,7 +1,7 @@ package main -const cVERSION = "2.2.0" -const cCODE = "Craving Detonator" +const cVERSION = "2.2.1" +const cCODE = "Unsafe Cupcake" const cOP = "LOG" const cINC = "VARS" From 8482a77ac1e9d4a5e327df30ed31746fbe78c328 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:25:29 +0800 Subject: [PATCH 12/13] Also include patch. --- make/update/script | 1 + 1 file changed, 1 insertion(+) diff --git a/make/update/script b/make/update/script index a21454d..608ae59 100644 --- a/make/update/script +++ b/make/update/script @@ -1,3 +1,4 @@ go get -u +go get -u=patch go mod tidy go mod verify From f876d885d54e6dde5e56ae026ca1d9a47e104317 Mon Sep 17 00:00:00 2001 From: Eduardo Tongson Date: Thu, 4 Jul 2024 20:33:09 +0800 Subject: [PATCH 13/13] Sounds better. --- README.d/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.d/CHANGELOG.md b/README.d/CHANGELOG.md index ec59a27..0a41d42 100644 --- a/README.d/CHANGELOG.md +++ b/README.d/CHANGELOG.md @@ -4,7 +4,7 @@ Unsafe Cupcake * Fix output during parallel runs * Print README* file when no `namespace:script` specified -* Include `.lib` includes in `rrd` (dump) mode +* Include `.lib` in `rrd` (dump) mode #### 2.2.0