This commit is contained in:
Andrey Parhomenko 2024-07-09 16:13:20 +05:00
commit f930152424
6 changed files with 59 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/exe/

3
build.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
go build -o ./exe/ ./cmd/gore

21
cmd/gore/main.go Normal file
View file

@ -0,0 +1,21 @@
package main
import "surdeus.su/core/cli/mtool"
import "surdeus.su/util/gore/enc"
import "encoding/hex"
import "os"
var root = mtool.T("gore").Subs(
mtool.T("encode").Subs(
enc.NewEncodeTool(
"hex",
hex.NewEncoder,
),
),
)
func main() {
root.Run(os.Args[1:])
}

27
enc/enc.go Normal file
View file

@ -0,0 +1,27 @@
package enc
import "surdeus.su/core/cli/mtool"
import "io"
import "os"
type EncodeOptions struct {
}
func NewEncodeTool(
name string,
encFn func (io.Writer) io.Writer,
) *mtool.Tool {
ret := mtool.T(name).Func(func(flags *mtool.Flags){
//var opts EncodeOptions
_ = flags.Parse()
input := os.Stdin
output := os.Stdout
encOutput := encFn(output)
io.Copy(encOutput, input)
})
return ret
}

5
go.mod Normal file
View file

@ -0,0 +1,5 @@
module surdeus.su/util/gore
go 1.21.7
require surdeus.su/core/cli v0.1.2

2
go.sum Normal file
View file

@ -0,0 +1,2 @@
surdeus.su/core/cli v0.1.2 h1:qPzjawqPyZsO4Z5SaA1u141recVE65yioA83Qs7Jecs=
surdeus.su/core/cli v0.1.2/go.mod h1:r9JtQz3aEJzpYzMaNUNQHJoYkoWKNPi047qhd5uGlmA=