amend module vs package

This commit is contained in:
Mahdi Abu Yasmine 2023-11-03 03:10:55 +01:00
parent 76ec47c9d5
commit dea5ddc7b0
11 changed files with 29 additions and 49 deletions

View File

@ -1,5 +0,0 @@
module gitea.meta-tech.academy/go/core/config
go 1.20
require gopkg.in/yaml.v3 v3.0.1

View File

@ -1,4 +0,0 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

11
go.mod Normal file
View File

@ -0,0 +1,11 @@
module gitea.meta-tech.academy/go/core
go 1.20
require (
github.com/gookit/color v1.5.4
golang.org/x/sys v0.13.0
gopkg.in/yaml.v3 v3.0.1
)
require github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect

View File

@ -1,5 +1,3 @@
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/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 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
@ -7,6 +5,9 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 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 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= 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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -1,8 +0,0 @@
go 1.20
use (
./config
./style
./sys
./util
)

View File

@ -1,3 +0,0 @@
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=

View File

@ -1,13 +0,0 @@
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
)

View File

@ -3,6 +3,7 @@ package style
import ( import (
"fmt" "fmt"
"strings" "strings"
"gitea.meta-tech.academy/go/core/util" "gitea.meta-tech.academy/go/core/util"
"github.com/gookit/color" "github.com/gookit/color"
) )
@ -62,7 +63,7 @@ func NewStyleByDef(def string) *Style {
if len(d) > KEY_STYLE_OPTION { if len(d) > KEY_STYLE_OPTION {
o = strings.Split(d[KEY_STYLE_OPTION], ",") o = strings.Split(d[KEY_STYLE_OPTION], ",")
} }
util.PrependToSliceStr(&c, "#") prependToSliceStr(&c, "#")
var s *color.RGBStyle var s *color.RGBStyle
switch len(c) { switch len(c) {
case 1: case 1:
@ -72,7 +73,7 @@ func NewStyleByDef(def string) *Style {
} }
for _, elm := range o { for _, elm := range o {
s.AddOpts(color.Color(util.Str2int(elm, 10, 0))) s.AddOpts(color.Color(str2int(elm, 10, 0)))
} }
// s.Printf(" %-20s\n", d[KEY_STYLE_NAME]) // s.Printf(" %-20s\n", d[KEY_STYLE_NAME])
return &Style{s, d[KEY_STYLE_NAME]} return &Style{s, d[KEY_STYLE_NAME]}
@ -113,3 +114,13 @@ func (s *Styles) Keyval(key string, val string, names ...string) {
sv.Apply(val), sv.Apply(val),
) )
} }
func prependToSliceStr(strs *[]string, prefix string) {
for i, elm := range *strs {
(*strs)[i] = prefix + elm
}
}
func str2int(str string, base int, fallback int) int {
return int(util.Str2int64(str, base, int64(fallback)))
}

View File

@ -1,5 +0,0 @@
module gitea.meta-tech.academy/go/core/sys
go 1.20
require golang.org/x/sys v0.13.0

View File

@ -1,2 +0,0 @@
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View File

@ -1,3 +0,0 @@
module gitea.meta-tech.academy/go/core/util
go 1.20