Rebranding. Yes, another one.

This commit is contained in:
Andrey Parhomenko 2023-11-11 12:51:15 +03:00
parent d1b3d13464
commit 779c6cf5ab
30 changed files with 135 additions and 106 deletions

4
go.mod
View file

@ -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

10
go.sum
View file

@ -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=

169
main.go
View file

@ -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:])
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View file

@ -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

View file

@ -4,7 +4,7 @@ import(
"os"
"io"
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -3,7 +3,7 @@ package date
import(
"fmt"
"time"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -6,7 +6,7 @@ import(
"os"
"bufio"
"log"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
const(

View file

@ -3,7 +3,7 @@ package echo
import (
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -5,7 +5,7 @@ import (
"io"
"bufio"
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
"path/filepath"
)

View file

@ -2,7 +2,7 @@ package gfalse
import(
"os"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flags *mtool.Flags) {

View file

@ -3,7 +3,7 @@ package grange
import(
"fmt"
"strconv"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -1,5 +1,5 @@
package gtrue
import "github.com/reklesio/mtool"
import "github.com/omnipunk/cli/mtool"
func Run(flags *mtool.Flags) {}

View file

@ -5,7 +5,7 @@ import (
"io"
"bufio"
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -3,7 +3,7 @@ package ln
import (
"fmt"
"os"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
"path/filepath"
)

View file

@ -5,7 +5,7 @@ import(
"strings"
"regexp"
"path"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -5,7 +5,7 @@ import(
"fmt"
"bufio"
"log"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -3,7 +3,7 @@ package noext
import(
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -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 (

View file

@ -7,7 +7,7 @@ import(
"fmt"
"unicode"
"bufio"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func HasWhiteSpace(s string) bool {

View file

@ -4,7 +4,7 @@ import(
"os"
"bufio"
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var(

View file

@ -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) {

View file

@ -5,7 +5,7 @@ import(
"io"
"fmt"
"bufio"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func reverse(a []string) chan string {

View file

@ -6,7 +6,7 @@ import(
"fmt"
"bufio"
"io"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -5,7 +5,7 @@ import (
"fmt"
"net"
"net/url"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var nilStr = "_"

View file

@ -4,7 +4,7 @@ import (
"os"
"os/exec"
"fmt"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
"path/filepath"
)

View file

@ -7,7 +7,7 @@ import (
"fmt"
"unicode"
"strconv"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
var (

View file

@ -5,7 +5,7 @@ import(
"os/user"
"fmt"
"log"
"github.com/reklesio/mtool"
"github.com/omnipunk/cli/mtool"
)
func Run(flagSet *mtool.Flags) {

View file

@ -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