diff --git a/core/code/go.go b/core/code/go.go index a2707433..cf23d047 100644 --- a/core/code/go.go +++ b/core/code/go.go @@ -137,6 +137,7 @@ const ( ENV = "env" DOC = "doc" GET = "get" + TAG = "tag" ) const SUM = "sum" const MOD = "mod" diff --git a/core/code/version.go b/core/code/version.go index d0d3384e..b4de0789 100644 --- a/core/code/version.go +++ b/core/code/version.go @@ -42,6 +42,9 @@ func init() { m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GO, MOD, "tidy") }}, "add": {Name: "add version", Hand: func(m *ice.Message, arg ...string) { + m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GIT, TAG, m.Option(VERSION)) + m.Cmd(SPACE, m.Option(SPACE), VIMER, COMPILE) + m.Sleep3s() }}, }), Hand: func(m *ice.Message, arg ...string) { repos := map[string]string{} @@ -81,7 +84,7 @@ func init() { if diff { m.Push(mdb.STATUS, html.DANGER).PushButton("sync", "add") } else { - if strings.Contains(m.Option(VERSION), "-") { + if strings.Contains(list[space][VERSION], "-") { m.Push(mdb.STATUS, "").PushButton("add") } else { m.Push(mdb.STATUS, "").PushButton("") diff --git a/misc/git/repos.go b/misc/git/repos.go index a0cd9051..fa02bee9 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -476,6 +476,17 @@ func init() { m.Echo(_repos_remote(m, _repos_origin(m, _repos_open(m, path.Base(kit.Path("")))))) }}, mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + if arg[0] == VERSION { + ls := kit.Split(kit.Split(strings.TrimPrefix(m.Option(VERSION), "v"), "-")[0], ".") + if len(ls) > 2 { + m.Push(arg[0], kit.Format("v%d.%d.%d", kit.Int(ls[0]), kit.Int(ls[1]), kit.Int(ls[2])+1)) + m.Push(arg[0], kit.Format("v%d.%d.%d", kit.Int(ls[0]), kit.Int(ls[1])+1, 0)) + m.Push(arg[0], kit.Format("v%d.%d.%d", kit.Int(ls[0])+1, 0, 0)) + } else { + m.Push(arg[0], "v0.0.1") + } + return + } switch mdb.HashInputs(m, arg); m.Option(ctx.ACTION) { case INIT: m.Cmd(web.SPIDE, ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+web.X(path.Base(kit.Path("")))) }) @@ -494,7 +505,6 @@ func init() { m.Push(arg[0], kit.Join(kit.Slice(ls, -2), nfs.PS)) m.Push(arg[0], m.Option(nfs.FILE)) case VERSION: - m.Push(arg[0], _repos_tag(m, m.Option(TAGS))) } } }}, @@ -640,7 +650,15 @@ func init() { }}, }, web.StatsAction("", "代码库总数"), web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) { if len(arg) == 0 { - mdb.HashSelect(m, arg...).Sort(REPOS).PushAction(STATUS, mdb.REMOVE).Action(CLONE, PULL, PUSH, STATUS) + mdb.HashSelect(m, arg...).Sort(REPOS) + m.Table(func(value ice.Maps) { + if strings.Contains(value[VERSION], "-") { + m.PushButton(STATUS, TAG, mdb.REMOVE) + } else { + m.PushButton(STATUS, mdb.REMOVE) + } + }) + m.Action(CLONE, PULL, PUSH, STATUS) } else if repos := _repos_open(m, arg[0]); len(arg) == 1 { _repos_branch(m, repos) } else if len(arg) == 2 {