forked from x/icebergs
opt some
This commit is contained in:
parent
39f30857f0
commit
b5d80fcb77
2
go.mod
2
go.mod
@ -5,5 +5,5 @@ go 1.11
|
||||
require (
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
shylinux.com/x/toolkits v0.3.8
|
||||
shylinux.com/x/toolkits v0.3.9
|
||||
)
|
||||
|
6
go.sum
6
go.sum
@ -1,6 +1,4 @@
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
shylinux.com/x/toolkits v0.3.8 h1:72akO7wEm0T4xvxm4hZGsx6mO62sBzeY7QWAoLFzgRA=
|
||||
shylinux.com/x/toolkits v0.3.8/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
|
||||
shylinux.com/x/toolkits v0.3.9 h1:apRA1BljrzFCBcesOpeIWYWsoC0JN6tgVO8TM+wUrg8=
|
||||
shylinux.com/x/toolkits v0.3.9/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
|
||||
|
@ -12,6 +12,17 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _status_tags(m *ice.Message, tags string) string {
|
||||
ls := kit.Split(strings.TrimPrefix(kit.Split(tags, "-")[0], "v"), ".")
|
||||
if v := kit.Int(ls[2]); v < 9 {
|
||||
return kit.Format("v%v.%v.%v", ls[0], ls[1], v+1)
|
||||
} else if v := kit.Int(ls[1]); v < 9 {
|
||||
return kit.Format("v%v.%v.0", ls[0], v+1)
|
||||
} else if v := kit.Int(ls[0]); v < 9 {
|
||||
return kit.Format("v%v.0.0", v+1)
|
||||
}
|
||||
return "v0.0.1"
|
||||
}
|
||||
func _status_each(m *ice.Message, title string, cmds ...string) {
|
||||
m.GoToast(title, func(toast func(string, int, int)) {
|
||||
count, total := 0, len(m.Confm(REPOS, kit.MDB_HASH))
|
||||
@ -205,6 +216,9 @@ func init() {
|
||||
}},
|
||||
|
||||
TAG: {Name: "tag version@key", Help: "标签", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(VERSION) == "" {
|
||||
m.Option(VERSION, _status_tags(m, m.Option(TAGS)))
|
||||
}
|
||||
m.Option(cli.CMD_DIR, _repos_path(m.Option(kit.MDB_NAME)))
|
||||
m.Cmdy(cli.SYSTEM, GIT, TAG, m.Option(VERSION))
|
||||
m.Cmdy(cli.SYSTEM, GIT, PUSH, "--tags")
|
||||
@ -230,16 +244,8 @@ func init() {
|
||||
case TAGS, VERSION:
|
||||
if m.Option(TAGS) == ice.ErrWarn {
|
||||
m.Push(VERSION, kit.Format("v0.0.%d", 1))
|
||||
return
|
||||
}
|
||||
|
||||
ls := kit.Split(strings.TrimPrefix(kit.Split(m.Option(TAGS), "-")[0], "v"), ".")
|
||||
if v := kit.Int(ls[2]); v < 9 {
|
||||
m.Push(VERSION, kit.Format("v%v.%v.%v", ls[0], ls[1], v+1))
|
||||
} else if v := kit.Int(ls[1]); v < 9 {
|
||||
m.Push(VERSION, kit.Format("v%v.%v.0", ls[0], v+1))
|
||||
} else if v := kit.Int(ls[0]); v < 9 {
|
||||
m.Push(VERSION, kit.Format("v%v.0.0", v+1))
|
||||
} else {
|
||||
m.Push(VERSION, _status_tags(m, m.Option(TAGS)))
|
||||
}
|
||||
|
||||
case COMMENT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user