Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
b5d6c67685 | |||
bdf1fd0ceb | |||
5acf5ebb55 | |||
11fde8986c | |||
a88986a89e | |||
cd6a9131c0 | |||
d286351445 | |||
702e8e05af | |||
fb5a0257db | |||
1522cce6e1 |
32 changed files with 89 additions and 67 deletions
.gitignorego.modgo.summain.goreadme.mdxgo_test.xgo
tool
cat
date
ec
echo
finfo
ftest
gfalse
grange
gtrue
in
ln
ls
mergelbl
mkdir
noext
paths
quote
read
sort
tac
uniq
urlprs
useprog
wc
whoami
yes
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
exe/
|
exe/
|
||||||
*.exe
|
*.exe
|
||||||
*.swp
|
*.swp
|
||||||
|
/bb
|
||||||
|
|
6
go.mod
6
go.mod
|
@ -1,5 +1,5 @@
|
||||||
module github.com/di4f/bb
|
module surdeus.su/util/bb
|
||||||
|
|
||||||
go 1.18
|
go 1.22.3
|
||||||
|
|
||||||
require github.com/di4f/cli v0.0.0-20231214183522-32f786133a58
|
require surdeus.su/core/cli v0.5.0
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -1,2 +1,6 @@
|
||||||
github.com/di4f/cli v0.0.0-20231214183522-32f786133a58 h1:b3bk2zD7YqLJDYoNAGawVbJovkNzJPDULYuF6+ar09w=
|
surdeus.su/core/cli v0.1.2 h1:qPzjawqPyZsO4Z5SaA1u141recVE65yioA83Qs7Jecs=
|
||||||
github.com/di4f/cli v0.0.0-20231214183522-32f786133a58/go.mod h1:a2hUcQVjIEYR0VW3gf640cgbxCvUwA9vwKvkSkw1SUU=
|
surdeus.su/core/cli v0.1.2/go.mod h1:r9JtQz3aEJzpYzMaNUNQHJoYkoWKNPi047qhd5uGlmA=
|
||||||
|
surdeus.su/core/cli v0.3.0 h1:/2UfObbesg3/2FPn/9Ys/w/H2XOxOv72ehidwctAGdM=
|
||||||
|
surdeus.su/core/cli v0.3.0/go.mod h1:r9JtQz3aEJzpYzMaNUNQHJoYkoWKNPi047qhd5uGlmA=
|
||||||
|
surdeus.su/core/cli v0.5.0 h1:jYvE0JVDikFT9FhWGV3wIAcMgByziAVxTwsVUwWkeHs=
|
||||||
|
surdeus.su/core/cli v0.5.0/go.mod h1:r9JtQz3aEJzpYzMaNUNQHJoYkoWKNPi047qhd5uGlmA=
|
||||||
|
|
51
main.go
51
main.go
|
@ -2,30 +2,30 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
|
|
||||||
"github.com/di4f/bb/tool/cat"
|
"surdeus.su/util/bb/tool/cat"
|
||||||
"github.com/di4f/bb/tool/date"
|
"surdeus.su/util/bb/tool/date"
|
||||||
"github.com/di4f/bb/tool/ec"
|
"surdeus.su/util/bb/tool/ec"
|
||||||
"github.com/di4f/bb/tool/echo"
|
"surdeus.su/util/bb/tool/echo"
|
||||||
"github.com/di4f/bb/tool/ftest"
|
"surdeus.su/util/bb/tool/ftest"
|
||||||
"github.com/di4f/bb/tool/grange"
|
"surdeus.su/util/bb/tool/grange"
|
||||||
"github.com/di4f/bb/tool/in"
|
"surdeus.su/util/bb/tool/in"
|
||||||
"github.com/di4f/bb/tool/ln"
|
"surdeus.su/util/bb/tool/ln"
|
||||||
"github.com/di4f/bb/tool/ls"
|
"surdeus.su/util/bb/tool/ls"
|
||||||
"github.com/di4f/bb/tool/mergelbl"
|
"surdeus.su/util/bb/tool/mergelbl"
|
||||||
"github.com/di4f/bb/tool/mkdir"
|
"surdeus.su/util/bb/tool/mkdir"
|
||||||
"github.com/di4f/bb/tool/paths"
|
"surdeus.su/util/bb/tool/paths"
|
||||||
"github.com/di4f/bb/tool/quote"
|
"surdeus.su/util/bb/tool/quote"
|
||||||
"github.com/di4f/bb/tool/read"
|
"surdeus.su/util/bb/tool/read"
|
||||||
"github.com/di4f/bb/tool/sort"
|
"surdeus.su/util/bb/tool/sort"
|
||||||
"github.com/di4f/bb/tool/tac"
|
"surdeus.su/util/bb/tool/tac"
|
||||||
"github.com/di4f/bb/tool/uniq"
|
"surdeus.su/util/bb/tool/uniq"
|
||||||
"github.com/di4f/bb/tool/urlprs"
|
"surdeus.su/util/bb/tool/urlprs"
|
||||||
"github.com/di4f/bb/tool/useprog"
|
"surdeus.su/util/bb/tool/useprog"
|
||||||
"github.com/di4f/bb/tool/wc"
|
"surdeus.su/util/bb/tool/wc"
|
||||||
"github.com/di4f/bb/tool/whoami"
|
"surdeus.su/util/bb/tool/whoami"
|
||||||
"github.com/di4f/bb/tool/yes"
|
"surdeus.su/util/bb/tool/yes"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -121,7 +121,10 @@ var root = mtool.T("bb").Subs(
|
||||||
),
|
),
|
||||||
).Desc(
|
).Desc(
|
||||||
"not POSIX compatible BusyBox utilities",
|
"not POSIX compatible BusyBox utilities",
|
||||||
)
|
).Ldesc(`
|
||||||
|
The program is not supposed to be a "BusyBox killer.".
|
||||||
|
In fact it just has better options for Surdeus's scripts.
|
||||||
|
`)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
root.Run(os.Args[1:])
|
root.Run(os.Args[1:])
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# tk
|
# tk
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Gopher ToolKit. Not POSIX compatible BusyBox-like set of programs
|
Gopher ToolKit. Not POSIX compatible BusyBox-like set of programs
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package cat
|
package cat
|
||||||
|
|
||||||
/* Concatenate files in "stdout". */
|
/* Concatenate files in "stdout". */
|
||||||
import(
|
import (
|
||||||
"os"
|
|
||||||
"io"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var (
|
||||||
blockSize int
|
blockSize int
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package date
|
||||||
import(
|
import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import(
|
||||||
"os"
|
"os"
|
||||||
"bufio"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
const(
|
const(
|
||||||
|
|
|
@ -3,7 +3,7 @@ package echo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var(
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package gfalse
|
||||||
|
|
||||||
import(
|
import(
|
||||||
"os"
|
"os"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flags *mtool.Flags) {
|
func Run(flags *mtool.Flags) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package grange
|
||||||
import(
|
import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package gtrue
|
package gtrue
|
||||||
|
|
||||||
import "github.com/di4f/cli/mtool"
|
import "surdeus.su/core/cli/mtool"
|
||||||
|
|
||||||
func Run(flags *mtool.Flags) {}
|
func Run(flags *mtool.Flags) {}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ln
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import(
|
||||||
"strings"
|
"strings"
|
||||||
"regexp"
|
"regexp"
|
||||||
"path"
|
"path"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var(
|
||||||
|
@ -126,17 +126,24 @@ ls(p string, fold int) error {
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
var foldLvl int
|
var foldLvl int
|
||||||
flagSet.IntVar(&foldLvl, "r", 1, "List recursively with choosing deepness, can't be negative or zero.")
|
var rFlag bool
|
||||||
flagSet.BoolVar(&listHidden, "a", false, "List hidden files.")
|
flagSet.BoolVar(&rFlag, "R", false, "set the '-r' flags value to the max depth (overrides the '-r')")
|
||||||
|
flagSet.IntVar(&foldLvl, "r", 1, "list recursively with choosing deepness, can't be negative or zero.")
|
||||||
|
flagSet.BoolVar(&listHidden, "a", false, "list hidden files.")
|
||||||
flagSet.Parse()
|
flagSet.Parse()
|
||||||
args = flagSet.Args()
|
args = flagSet.Args()
|
||||||
|
|
||||||
|
if rFlag {
|
||||||
|
foldLvl = 9999999
|
||||||
|
}
|
||||||
if foldLvl<0 {
|
if foldLvl<0 {
|
||||||
flagSet.Usage()
|
flagSet.Usage()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if foldLvl==0 && len(args)==0 {
|
if foldLvl==0 && len(args)==0 {
|
||||||
flagSet.Usage()
|
flagSet.Usage()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"bufio"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package noext
|
||||||
|
|
||||||
import(
|
import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var(
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
//"github.com/di4f/tk/pathx"
|
//"surdeus.su/core/tk/pathx"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"unicode"
|
"unicode"
|
||||||
"bufio"
|
"bufio"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HasWhiteSpace(s string) bool {
|
func HasWhiteSpace(s string) bool {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import(
|
||||||
"os"
|
"os"
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var(
|
var(
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"github.com/di4f/bb/input"
|
"surdeus.su/util/bb/input"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import(
|
||||||
"io"
|
"io"
|
||||||
"fmt"
|
"fmt"
|
||||||
"bufio"
|
"bufio"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func reverse(a []string) chan string {
|
func reverse(a []string) chan string {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import(
|
||||||
"fmt"
|
"fmt"
|
||||||
"bufio"
|
"bufio"
|
||||||
"io"
|
"io"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var nilStr = "_"
|
var nilStr = "_"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"unicode"
|
"unicode"
|
||||||
"strconv"
|
"strconv"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import(
|
||||||
"os/user"
|
"os/user"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"github.com/di4f/bb/input"
|
"surdeus.su/util/bb/input"
|
||||||
"github.com/di4f/cli/mtool"
|
"surdeus.su/core/cli/mtool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
6
xgo_test.xgo
Normal file
6
xgo_test.xgo
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
fmt := import("fmt")
|
||||||
|
fmt.println("Hello, World!")
|
||||||
|
|
||||||
|
for _, i in [15, 573, 53] {
|
||||||
|
fmt.println(i)
|
||||||
|
}
|
Loading…
Reference in a new issue