From 779c6cf5abddb56163d3568aad53ad894428aa97 Mon Sep 17 00:00:00 2001 From: surdeus Date: Sat, 11 Nov 2023 12:51:15 +0300 Subject: [PATCH] Rebranding. Yes, another one. --- go.mod | 4 +- go.sum | 10 +-- main.go | 169 +++++++++++++++++++++++++----------------- media/gopher.png | Bin 73143 -> 73140 bytes readme.md | 2 +- tool/cat/cat.go | 2 +- tool/date/date.go | 2 +- tool/ec/run.go | 2 +- tool/echo/echo.go | 2 +- tool/ftest/main.go | 2 +- tool/gfalse/false.go | 2 +- tool/grange/main.go | 2 +- tool/gtrue/true.go | 2 +- tool/in/main.go | 2 +- tool/ln/main.go | 2 +- tool/ls/ls.go | 2 +- tool/mergelbl/main.go | 2 +- tool/mkdir/mkdir.go | 2 +- tool/noext/noext.go | 2 +- tool/paths/main.go | 4 +- tool/quote/quote.go | 2 +- tool/read/main.go | 2 +- tool/sort/sort.go | 4 +- tool/tac/tac.go | 2 +- tool/uniq/uniq.go | 2 +- tool/urlprs/urlprs.go | 2 +- tool/useprog/main.go | 2 +- tool/wc/main.go | 2 +- tool/whoami/main.go | 2 +- tool/yes/yes.go | 4 +- 30 files changed, 135 insertions(+), 106 deletions(-) diff --git a/go.mod b/go.mod index 14bd2f6..e12014e 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ -module github.com/reklesio/tk +module github.com/omnipunk/tk go 1.18 -require github.com/reklesio/mtool v0.0.0-20231023113051-bbe64fae523e // indirect +require github.com/omnipunk/cli v0.0.0-20231110091353-f877427ca833 diff --git a/go.sum b/go.sum index 31c8b98..4e2ce58 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,2 @@ -github.com/mojosa-software/goscript v0.0.0-20230626091305-86a004b7769c h1:y7RQZz/zJDARRJkn4szD8N2rK6K9NU1vUNPwahtW5zw= -github.com/mojosa-software/goscript v0.0.0-20230626091305-86a004b7769c/go.mod h1:LtBn7lQTgA/TMEL8Y+dGkD6XWHV2gxRPZXiqCZt3HRc= -github.com/reklesio v0.0.0-20230626085847-176486ff01a2 h1:xbw1/w6ZB8xRmaTS0mQvfTETF8M2/tSBfHJIR+cJyNE= -github.com/reklesio v0.0.0-20230626085847-176486ff01a2/go.mod h1:cJ6/4rcQ/s22RTLuLtypFh7gubwG4OLSph3NHX3haAw= -github.com/reklesio v0.0.0-20230628111258-73d5a2f1940f h1:lsvXiy5XeOGCiOvkzuX0jA11jJf3j998Xes0/gmk50A= -github.com/reklesio v0.0.0-20230628111258-73d5a2f1940f/go.mod h1:cJ6/4rcQ/s22RTLuLtypFh7gubwG4OLSph3NHX3haAw= -github.com/reklesio/mtool v0.0.0-20231023113051-bbe64fae523e h1:2ntFru8B2HDixWKy5EBU4QOcJGyHR4GhB8tWua4Leos= -github.com/reklesio/mtool v0.0.0-20231023113051-bbe64fae523e/go.mod h1:G6WEew5BI+7sorvUztT8wh7mr2jp2Vh5IFjkqWGVM34= +github.com/omnipunk/cli v0.0.0-20231110091353-f877427ca833 h1:sNNDuH0hbT+3Mqh200JM54ZAQPt0g9LsOeUzMMadg+4= +github.com/omnipunk/cli v0.0.0-20231110091353-f877427ca833/go.mod h1:j1oX8nchf3eIbEvGLIDe+glTXT/Mkz6w4UO1/3EQ8tc= diff --git a/main.go b/main.go index e39ac76..2608f67 100644 --- a/main.go +++ b/main.go @@ -1,75 +1,110 @@ package main import ( - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" - "github.com/reklesio/tk/tool/cat" - "github.com/reklesio/tk/tool/date" - "github.com/reklesio/tk/tool/ec" - "github.com/reklesio/tk/tool/echo" - "github.com/reklesio/tk/tool/ftest" - "github.com/reklesio/tk/tool/gfalse" - "github.com/reklesio/tk/tool/grange" - "github.com/reklesio/tk/tool/gtrue" - "github.com/reklesio/tk/tool/in" - "github.com/reklesio/tk/tool/ln" - "github.com/reklesio/tk/tool/ls" - "github.com/reklesio/tk/tool/mergelbl" - "github.com/reklesio/tk/tool/mkdir" - "github.com/reklesio/tk/tool/noext" - "github.com/reklesio/tk/tool/paths" - "github.com/reklesio/tk/tool/quote" - "github.com/reklesio/tk/tool/read" - "github.com/reklesio/tk/tool/sort" - "github.com/reklesio/tk/tool/tac" - "github.com/reklesio/tk/tool/uniq" - "github.com/reklesio/tk/tool/urlprs" - "github.com/reklesio/tk/tool/useprog" - "github.com/reklesio/tk/tool/wc" - "github.com/reklesio/tk/tool/whoami" - "github.com/reklesio/tk/tool/yes" + "github.com/omnipunk/tk/tool/cat" + "github.com/omnipunk/tk/tool/date" + "github.com/omnipunk/tk/tool/ec" + "github.com/omnipunk/tk/tool/echo" + "github.com/omnipunk/tk/tool/ftest" + "github.com/omnipunk/tk/tool/grange" + "github.com/omnipunk/tk/tool/in" + "github.com/omnipunk/tk/tool/ln" + "github.com/omnipunk/tk/tool/ls" + "github.com/omnipunk/tk/tool/mergelbl" + "github.com/omnipunk/tk/tool/mkdir" + "github.com/omnipunk/tk/tool/paths" + "github.com/omnipunk/tk/tool/quote" + "github.com/omnipunk/tk/tool/read" + "github.com/omnipunk/tk/tool/sort" + "github.com/omnipunk/tk/tool/tac" + "github.com/omnipunk/tk/tool/uniq" + "github.com/omnipunk/tk/tool/urlprs" + "github.com/omnipunk/tk/tool/useprog" + "github.com/omnipunk/tk/tool/wc" + "github.com/omnipunk/tk/tool/whoami" + "github.com/omnipunk/tk/tool/yes" + "os" +) + +var root = mtool.T("tk").Subs( + mtool.T("cat").Func(cat.Run).Desc( + "concatenate files", + ), + mtool.T("mkdir").Func(mkdir.Run).Desc( + "make new directories", + ), + mtool.T("echo").Func(echo.Run).Desc( + "print strings", + ), + mtool.T("true").Func(func(flags *mtool.Flags){ + os.Exit(0) + }).Desc("exit successfuly"), + mtool.T("false").Func(func(flags *mtool.Flags){ + os.Exit(1) + }).Desc("exit with failure"), + mtool.T("sort").Func(sort.Run).Desc( + "sort strings", + ), + mtool.T("tac").Func(tac.Run).Desc( + "reversed cat", + ), + mtool.T("ls").Func(ls.Run).Desc( + "list files", + ), + mtool.T("yes").Func(yes.Run).Desc( + "repeat string", + ), + mtool.T("date").Func(date.Run).Desc( + "print date", + ), + mtool.T("uniq").Func(uniq.Run).Desc( + "filter repeated strings", + ), + mtool.T("quote").Func(quote.Run).Desc( + "quote strings with spaces", + ), + mtool.T("urlprs").Func(urlprs.Run).Desc( + "parse URL", + ), + mtool.T("read").Func(read.Run).Desc( + "read lines", + ), + mtool.T("ec").Func(ec.Run).Desc( + "render escape characters", + ), + mtool.T("lbl").Func(mergelbl.Run).Desc( + "merge files line by line", + ), + mtool.T("ftest").Func(ftest.Run).Desc( + "filter files", + ), + mtool.T("wc").Func(wc.Run).Desc( + "word, rune, byte counts", + ), + mtool.T("range").Func(grange.Run).Desc( + "print num range", + ), + mtool.T("in").Func(in.Run).Desc( + "print only strings that are in arguments", + ), + mtool.T("which").Func(useprog.Run).Desc( + "print path to executable", + ), + mtool.T("whoami").Func(whoami.Run).Desc( + "print your username", + ), + mtool.T("ln").Func(ln.Run).Desc( + "link files", + ), + mtool.T("paths").Func(paths.Run).Desc( + "print different parts of paths", + ), +).Desc( + "ToolKit, BusyBox-like not POSIX-compatible utilities", ) func main() { - tools := mtool.Tools{ - "cat": mtool.Tool{cat.Run, "print file data to the standard output", ""}, - "mkdir": mtool.Tool{mkdir.Run, "make new directory", ""}, - "echo": mtool.Tool{echo.Run, "print strings to the standard output", ""}, - "true": mtool.Tool{gtrue.Run, "exit with true status", ""}, - "false": mtool.Tool{gfalse.Run, "exit with false status", ""}, - "sort": mtool.Tool{sort.Run, "sort strings inputed from standard input", ""}, - "tac": mtool.Tool{tac.Run, "print strings from standard input in reversed order", ""}, - "ls": mtool.Tool{ls.Run, "list directory content", ""}, - "yes": mtool.Tool{yes.Run, "print string infinite/exact amount times", ""}, - "date": mtool.Tool{date.Run, "print current date", ""}, - "uniq": mtool.Tool{uniq.Run, "filter repeated strings", ""}, - "quote": mtool.Tool{quote.Run, "quote words containing space characters", ""}, - "urlprs": mtool.Tool{urlprs.Run, "parse URLs", ""}, - "noext": mtool.Tool{noext.Run, "print file path without extension", ""}, - "mergelbl": mtool.Tool{mergelbl.Run, "merge line by line", ""}, - "ec": mtool.Tool{ec.Run, "render escape sequences", ""}, - "read": mtool.Tool{read.Run, "read lines and exit", ""}, - "wc": mtool.Tool{wc.Run, "count words, bytes, runes etc", ""}, - "ftest": mtool.Tool{ftest.Run, "filter files by specified features", ""}, - "range": mtool.Tool{grange.Run, "too lazy", ""}, - "in": mtool.Tool{in.Run, "filter strings from stdin that aren not in arguments", ""}, - "which": mtool.Tool{useprog.Run, "print the name or the path of the first existing program in arg list", ""}, - "paths": mtool.Tool{ - paths.Run, - "convert UNIX slash separated paths into the OS compatible ones", - "", - }, - "whoami": mtool.Tool{ - whoami.Run, - "print current user name", - "", - }, - "ln": mtool.Tool{ - ln.Run, - "link files", - "", - }, - } - - mtool.Main("tk", tools) + root.Run(os.Args[1:]) } diff --git a/media/gopher.png b/media/gopher.png index 4eff3e713e5f2af605140c7ac31ef7c0c6a32dc6..cd155979ba8e398e6136997b54e7df1b6d0d99b5 100644 GIT binary patch delta 25 hcmdnKn`O&x7M9KcKlhESHiny>4C6yKFKQK?0RVyB3Euz! delta 30 mcmdn8n`QfM7S_%HKX=}ZEH;LWyqg^i<3kvEH_vYsodE!$#tH)f diff --git a/readme.md b/readme.md index 2fde357..a680a6e 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # tk -![Insert here a gopher, please](https://raw.githubusercontent.com/reklesio/tk//master/media/gopher.png) +![Insert here a gopher, please](https://raw.githubusercontent.com/omnipunk/tk//master/media/gopher.png) Gopher ToolKit. Not POSIX compatible BusyBox-like set of programs diff --git a/tool/cat/cat.go b/tool/cat/cat.go index e5455a1..177d235 100644 --- a/tool/cat/cat.go +++ b/tool/cat/cat.go @@ -4,7 +4,7 @@ import( "os" "io" "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/date/date.go b/tool/date/date.go index ec3f114..c56f2ae 100644 --- a/tool/date/date.go +++ b/tool/date/date.go @@ -3,7 +3,7 @@ package date import( "fmt" "time" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/ec/run.go b/tool/ec/run.go index f8a354d..5edb4e8 100644 --- a/tool/ec/run.go +++ b/tool/ec/run.go @@ -6,7 +6,7 @@ import( "os" "bufio" "log" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) const( diff --git a/tool/echo/echo.go b/tool/echo/echo.go index 86a654b..c20d75d 100644 --- a/tool/echo/echo.go +++ b/tool/echo/echo.go @@ -3,7 +3,7 @@ package echo import ( "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/ftest/main.go b/tool/ftest/main.go index 7cd3952..ac53985 100644 --- a/tool/ftest/main.go +++ b/tool/ftest/main.go @@ -5,7 +5,7 @@ import ( "io" "bufio" "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" "path/filepath" ) diff --git a/tool/gfalse/false.go b/tool/gfalse/false.go index 70454ef..22bf173 100644 --- a/tool/gfalse/false.go +++ b/tool/gfalse/false.go @@ -2,7 +2,7 @@ package gfalse import( "os" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flags *mtool.Flags) { diff --git a/tool/grange/main.go b/tool/grange/main.go index d547f3c..41c71cf 100644 --- a/tool/grange/main.go +++ b/tool/grange/main.go @@ -3,7 +3,7 @@ package grange import( "fmt" "strconv" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/gtrue/true.go b/tool/gtrue/true.go index 8aef9ee..6c45ace 100644 --- a/tool/gtrue/true.go +++ b/tool/gtrue/true.go @@ -1,5 +1,5 @@ package gtrue -import "github.com/reklesio/mtool" +import "github.com/omnipunk/cli/mtool" func Run(flags *mtool.Flags) {} diff --git a/tool/in/main.go b/tool/in/main.go index 87aebc3..b904e6f 100644 --- a/tool/in/main.go +++ b/tool/in/main.go @@ -5,7 +5,7 @@ import ( "io" "bufio" "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/ln/main.go b/tool/ln/main.go index a9c09d1..ae4ecf9 100644 --- a/tool/ln/main.go +++ b/tool/ln/main.go @@ -3,7 +3,7 @@ package ln import ( "fmt" "os" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" "path/filepath" ) diff --git a/tool/ls/ls.go b/tool/ls/ls.go index 0715936..7ff27c2 100644 --- a/tool/ls/ls.go +++ b/tool/ls/ls.go @@ -5,7 +5,7 @@ import( "strings" "regexp" "path" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/mergelbl/main.go b/tool/mergelbl/main.go index 1be15cf..a2812d3 100644 --- a/tool/mergelbl/main.go +++ b/tool/mergelbl/main.go @@ -5,7 +5,7 @@ import( "fmt" "bufio" "log" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/mkdir/mkdir.go b/tool/mkdir/mkdir.go index 9e38f20..ad66c50 100644 --- a/tool/mkdir/mkdir.go +++ b/tool/mkdir/mkdir.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/noext/noext.go b/tool/noext/noext.go index bf5c8a7..61c5fdd 100644 --- a/tool/noext/noext.go +++ b/tool/noext/noext.go @@ -3,7 +3,7 @@ package noext import( "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/paths/main.go b/tool/paths/main.go index 5045c3f..8101a03 100644 --- a/tool/paths/main.go +++ b/tool/paths/main.go @@ -9,9 +9,9 @@ import ( "path" "strings" - //"github.com/reklesio/tk/pathx" + //"github.com/omnipunk/tk/pathx" "path/filepath" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var ( diff --git a/tool/quote/quote.go b/tool/quote/quote.go index ed6217c..657909e 100644 --- a/tool/quote/quote.go +++ b/tool/quote/quote.go @@ -7,7 +7,7 @@ import( "fmt" "unicode" "bufio" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func HasWhiteSpace(s string) bool { diff --git a/tool/read/main.go b/tool/read/main.go index 04d0668..cf70bd3 100644 --- a/tool/read/main.go +++ b/tool/read/main.go @@ -4,7 +4,7 @@ import( "os" "bufio" "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var( diff --git a/tool/sort/sort.go b/tool/sort/sort.go index ed03952..b5207bf 100644 --- a/tool/sort/sort.go +++ b/tool/sort/sort.go @@ -4,8 +4,8 @@ import ( "fmt" "os" "sort" - "github.com/reklesio/tk/input" - "github.com/reklesio/mtool" + "github.com/omnipunk/tk/input" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/tac/tac.go b/tool/tac/tac.go index ff54c39..f5c4a1c 100644 --- a/tool/tac/tac.go +++ b/tool/tac/tac.go @@ -5,7 +5,7 @@ import( "io" "fmt" "bufio" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func reverse(a []string) chan string { diff --git a/tool/uniq/uniq.go b/tool/uniq/uniq.go index 95fffe6..5485434 100644 --- a/tool/uniq/uniq.go +++ b/tool/uniq/uniq.go @@ -6,7 +6,7 @@ import( "fmt" "bufio" "io" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/urlprs/urlprs.go b/tool/urlprs/urlprs.go index fbee535..9e5850a 100644 --- a/tool/urlprs/urlprs.go +++ b/tool/urlprs/urlprs.go @@ -5,7 +5,7 @@ import ( "fmt" "net" "net/url" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var nilStr = "_" diff --git a/tool/useprog/main.go b/tool/useprog/main.go index fe61d6f..3b5b4d4 100644 --- a/tool/useprog/main.go +++ b/tool/useprog/main.go @@ -4,7 +4,7 @@ import ( "os" "os/exec" "fmt" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" "path/filepath" ) diff --git a/tool/wc/main.go b/tool/wc/main.go index 7a6529f..8f7c716 100644 --- a/tool/wc/main.go +++ b/tool/wc/main.go @@ -7,7 +7,7 @@ import ( "fmt" "unicode" "strconv" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) var ( diff --git a/tool/whoami/main.go b/tool/whoami/main.go index 21b23a1..0330176 100644 --- a/tool/whoami/main.go +++ b/tool/whoami/main.go @@ -5,7 +5,7 @@ import( "os/user" "fmt" "log" - "github.com/reklesio/mtool" + "github.com/omnipunk/cli/mtool" ) func Run(flagSet *mtool.Flags) { diff --git a/tool/yes/yes.go b/tool/yes/yes.go index f61d671..6d304ef 100644 --- a/tool/yes/yes.go +++ b/tool/yes/yes.go @@ -5,8 +5,8 @@ import( "os" "fmt" "strings" - "github.com/reklesio/tk/input" - "github.com/reklesio/mtool" + "github.com/omnipunk/tk/input" + "github.com/omnipunk/cli/mtool" ) var( nArg int