2022-08-06 05:45:08 +03:00
|
|
|
package main
|
|
|
|
|
2023-03-08 16:39:50 +03:00
|
|
|
import (
|
2023-10-23 14:57:57 +03:00
|
|
|
"github.com/reklesio/mtool"
|
2023-06-09 18:01:53 +03:00
|
|
|
|
2023-10-23 14:57:57 +03:00
|
|
|
"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"
|
2022-08-06 05:45:08 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-03-08 16:39:50 +03:00
|
|
|
tools := mtool.Tools{
|
2023-03-24 16:54:51 +03:00
|
|
|
"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", ""},
|
2023-03-24 19:47:31 +03:00
|
|
|
"which": mtool.Tool{useprog.Run, "print the name or the path of the first existing program in arg list", ""},
|
2023-03-08 16:39:50 +03:00
|
|
|
"paths": mtool.Tool{
|
2023-02-16 14:57:39 +03:00
|
|
|
paths.Run,
|
|
|
|
"convert UNIX slash separated paths into the OS compatible ones",
|
2023-03-24 16:54:51 +03:00
|
|
|
"",
|
2023-02-16 14:57:39 +03:00
|
|
|
},
|
2023-02-26 13:12:40 +03:00
|
|
|
"whoami": mtool.Tool{
|
|
|
|
whoami.Run,
|
|
|
|
"print current user name",
|
2023-03-24 16:54:51 +03:00
|
|
|
"",
|
2023-02-26 13:12:40 +03:00
|
|
|
},
|
2023-03-08 16:39:50 +03:00
|
|
|
"ln": mtool.Tool{
|
|
|
|
ln.Run,
|
|
|
|
"link files",
|
2023-03-24 16:54:51 +03:00
|
|
|
"",
|
2023-03-08 16:39:50 +03:00
|
|
|
},
|
2022-08-06 05:45:08 +03:00
|
|
|
}
|
|
|
|
|
2023-10-23 14:57:57 +03:00
|
|
|
mtool.Main("tk", tools)
|
2022-08-06 05:45:08 +03:00
|
|
|
}
|