amend
This commit is contained in:
parent
de9b799e4b
commit
6108435b43
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"gitea.meta-tech.academy/go/core/sys"
|
||||
"gitea.meta-tech.academy/go/core/test"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
@ -14,6 +15,10 @@ func tutu() {
|
|||
sys.RunShellCmd("ls -la")
|
||||
}
|
||||
|
||||
func tata() {
|
||||
test.Test()
|
||||
}
|
||||
|
||||
type Cfg interface {
|
||||
GetVar() []VarConfig
|
||||
}
|
||||
|
|
3
go.work.sum
Normal file
3
go.work.sum
Normal file
|
@ -0,0 +1,3 @@
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
13
style/go.mod
Normal file
13
style/go.mod
Normal file
|
@ -0,0 +1,13 @@
|
|||
module gitea.meta-tech.academy/go/core/style
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134
|
||||
github.com/gookit/color v1.5.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
|
||||
golang.org/x/sys v0.10.0 // indirect
|
||||
)
|
12
style/go.sum
Normal file
12
style/go.sum
Normal file
|
@ -0,0 +1,12 @@
|
|||
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134 h1:DTCBfyJ1HRBThmlYwFU6bLA2JV70inG1Yp/gug/pirk=
|
||||
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134/go.mod h1:q+p8vM+aQ36GVspuTTupRBNDUKrsXCccx4k3f7IKfx8=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
|
||||
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
@ -62,9 +62,7 @@ func NewStyleByDef(def string) *Style {
|
|||
if len(d) > KEY_STYLE_OPTION {
|
||||
o = strings.Split(d[KEY_STYLE_OPTION], ",")
|
||||
}
|
||||
azz := util.str2int("123")
|
||||
fmt.Printf(azz)
|
||||
util.prependToSliceStr(&c, "#")
|
||||
util.PrependToSliceStr(&c, "#")
|
||||
var s *color.RGBStyle
|
||||
switch len(c) {
|
||||
case 1:
|
||||
|
@ -74,7 +72,7 @@ func NewStyleByDef(def string) *Style {
|
|||
}
|
||||
for _, elm := range o {
|
||||
|
||||
s.AddOpts(color.Color(util.str2int(elm, 10, 0)))
|
||||
s.AddOpts(color.Color(util.Str2int(elm, 10, 0)))
|
||||
}
|
||||
// s.Printf(" %-20s\n", d[KEY_STYLE_NAME])
|
||||
return &Style{s, d[KEY_STYLE_NAME]}
|
||||
|
|
3
test/go.mod
Normal file
3
test/go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module gitea.meta-tech.academy/go/core/test
|
||||
|
||||
go 1.20
|
9
test/test.go
Normal file
9
test/test.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Test() {
|
||||
fmt.Printf("test")
|
||||
}
|
10
util/util.go
10
util/util.go
|
@ -5,19 +5,19 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func prependToSliceStr(strs *[]string, prefix string) {
|
||||
func PrependToSliceStr(strs *[]string, prefix string) {
|
||||
for i, elm := range *strs {
|
||||
(*strs)[i] = prefix + elm
|
||||
}
|
||||
}
|
||||
|
||||
func appendToSliceStr(strs *[]string, suffix string) {
|
||||
func AppendToSliceStr(strs *[]string, suffix string) {
|
||||
for i, elm := range *strs {
|
||||
(*strs)[i] = elm + suffix
|
||||
}
|
||||
}
|
||||
|
||||
func str2int64(str string, base int, fallback int64) int64 {
|
||||
func Str2int64(str string, base int, fallback int64) int64 {
|
||||
str = strings.TrimSuffix(str, "\n")
|
||||
num, err := strconv.ParseInt(str, base, 64)
|
||||
if err != nil {
|
||||
|
@ -26,11 +26,11 @@ func str2int64(str string, base int, fallback int64) int64 {
|
|||
return num
|
||||
}
|
||||
|
||||
func str2int(str string, base int, fallback int) int {
|
||||
func Str2int(str string, base int, fallback int) int {
|
||||
return int(str2int64(str, base, int64(fallback)))
|
||||
}
|
||||
|
||||
func castStrings2ints(strs *[]string) []int {
|
||||
func CastStrings2ints(strs *[]string) []int {
|
||||
a := make([]int, len(*strs))
|
||||
for i, elm := range *strs {
|
||||
var f int = str2int(elm, 10, 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user