forked from x/icebergs
add git
This commit is contained in:
parent
7c6cfde7ba
commit
0ef623ae25
@ -138,6 +138,7 @@ func init() {
|
|||||||
} else {
|
} else {
|
||||||
_config_make(m, arg[0], arg[1:]...)
|
_config_make(m, arg[0], arg[1:]...)
|
||||||
m.Action(mdb.EXPORT, mdb.IMPORT, nfs.TRASH)
|
m.Action(mdb.EXPORT, mdb.IMPORT, nfs.TRASH)
|
||||||
|
DisplayStoryJSON(m)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -2,11 +2,8 @@ package git
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,7 +24,6 @@ const (
|
|||||||
|
|
||||||
GLOBAL = "--global"
|
GLOBAL = "--global"
|
||||||
UNSET = "--unset"
|
UNSET = "--unset"
|
||||||
UNSET_ALL = "--unset-all"
|
|
||||||
LIST = "--list"
|
LIST = "--list"
|
||||||
)
|
)
|
||||||
const CONFIGS = "configs"
|
const CONFIGS = "configs"
|
||||||
@ -40,28 +36,13 @@ func init() {
|
|||||||
kit.For(v, func(k string, v string) { _configs_set(m, kit.Keys(p, k), v) })
|
kit.For(v, func(k string, v string) { _configs_set(m, kit.Keys(p, k), v) })
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
switch mdb.HashInputs(m, arg); m.Option(ctx.ACTION) {
|
|
||||||
case INSTEADOF:
|
|
||||||
switch arg[0] {
|
|
||||||
case nfs.FROM:
|
|
||||||
m.Cmdy(REPOS).CutTo(ORIGIN, arg[0]).Sort(arg[0])
|
|
||||||
case nfs.TO:
|
|
||||||
from := kit.ParseURL(m.Option(nfs.FROM))
|
|
||||||
m.Cmd("web.spide", kit.Dict(ice.MSG_FIELDS, web.CLIENT_ORIGIN), func(value ice.Maps) {
|
|
||||||
m.Push(arg[0], value[web.CLIENT_ORIGIN]+from.Path)
|
|
||||||
})
|
|
||||||
m.Sort(arg[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
mdb.CREATE: {Name: "create name* value*", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name* value*", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_configs_set(m, m.Option(mdb.NAME), m.Option(mdb.VALUE))
|
_configs_set(m, m.Option(mdb.NAME), m.Option(mdb.VALUE))
|
||||||
mdb.HashRemove(m, m.Option(mdb.NAME))
|
mdb.HashRemove(m, m.Option(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashCreate(m.Spawn(), m.OptionSimple(mdb.NAME, mdb.VALUE))
|
mdb.HashCreate(m.Spawn(), m.OptionSimple(mdb.NAME, mdb.VALUE))
|
||||||
_configs_set(m, UNSET_ALL, m.Option(mdb.NAME))
|
_configs_set(m, UNSET, m.Option(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == mdb.VALUE {
|
if arg[0] == mdb.VALUE {
|
||||||
@ -69,16 +50,13 @@ func init() {
|
|||||||
mdb.HashRemove(m, m.Option(mdb.NAME))
|
mdb.HashRemove(m, m.Option(mdb.NAME))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
INSTEADOF: {Name: "insteadof from* to*", Help: "代理", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_git_cmd(m, CONFIG, GLOBAL, "url."+m.Option(nfs.TO)+".insteadof", m.Option(nfs.FROM))
|
|
||||||
}},
|
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,value", ice.INIT, kit.Dict(
|
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,value", ice.INIT, kit.Dict(
|
||||||
"alias", kit.Dict("s", STATUS, "b", BRANCH, "l", "log --oneline --decorate"),
|
"alias", kit.Dict("s", STATUS, "b", BRANCH, "l", "log --oneline --decorate"),
|
||||||
"push", kit.Dict("default", "simple"), "credential", kit.Dict("helper", "store"),
|
"push", kit.Dict("default", "simple"), "credential", kit.Dict("helper", "store"),
|
||||||
"core", kit.Dict("quotepath", "false"), "color", kit.Dict("ui", "always"),
|
"core", kit.Dict("quotepath", "false"), "color", kit.Dict("ui", "always"),
|
||||||
))), Hand: func(m *ice.Message, arg ...string) {
|
))), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
_configs_list(m).Action(mdb.CREATE, INSTEADOF, ice.INIT)
|
_configs_list(m).Action(mdb.CREATE, ice.INIT)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
kit.If(len(arg) > 1, func() { _configs_set(m, arg[0], arg[1]) })
|
kit.If(len(arg) > 1, func() { _configs_set(m, arg[0], arg[1]) })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user