// fake //伪造submodule // add //添加伪submodule // recover //恢复伪submodule(可能要拉项目) // status func init() { kmgConsole.AddAction(kmgConsole.Command{ Name: "GitSubmoduleCommit", Desc: "git fake submodule Commit", Runner: func() { kmgGit.DefaultRepository().MustFakeSubmoduleCommit() }, }) kmgConsole.AddAction(kmgConsole.Command{ Name: "GitSubmoduleUpdate", Desc: "git fake submodule Update", Runner: func() { kmgGit.DefaultRepository().MustFakeSubmoduleUpdate() }, }) kmgConsole.AddAction(kmgConsole.Command{ Name: "GitSmallestChange", Runner: func() { Local := "" Target := "" flag.StringVar(&Local, "local", "", "localcommit id (sha256 commit id or branch name or HEAD)") flag.StringVar(&Target, "target", "", "targetCommit id (sha256 commit id or branch name or HEAD)") flag.Parse() if Local == "" || Target == "" { flag.Usage() return } result := kmgGit.DefaultRepository().MustSmallestChange(Local, Target) fmt.Println(result) fmt.Println("#see diff: git diff --stat " + Local + " " + result) }, }) }
func AddCommandList() { kmgConsole.AddAction(kmgConsole.Command{ Name: "GitPull", Desc: "git pull origin master", Runner: gitPull, }) kmgConsole.AddAction(kmgConsole.Command{ Name: "GitPush", Desc: "add,commit,push this git resp", Runner: gitPush, }) }
func AddCommandList() { kmgConsole.AddAction(kmgConsole.Command{ Name: "FileHttpServer", Runner: runFileHttpServer, }) kmgConsole.AddCommandWithName("HttpGet", func() { requestUrl := "" key := "" flag.StringVar(&requestUrl, "url", "", "") flag.StringVar(&key, "key", "", "crypto key use to decrypt respond") flag.Parse() if requestUrl == "" { kmgConsole.ExitOnErr(errors.New("Usage: kmg HttpGet -url http://xxx")) } b := MustUrlGetContent(requestUrl) var err error if key != "" { b, err = kmgCrypto.CompressAndEncryptBytesDecodeV2(kmgCrypto.Get32PskFromString(key), b) if err != nil { panic(err) } } fmt.Print(string(b)) }) }
func init() { kmgConsole.AddAction(kmgConsole.Command{ Name: "GitFixNameCase", Desc: "fix git name case problem on case insensitive opearate system(windows,osx)", Runner: gitFixNameCaseCmd, }) }
func AddSelfUpdate() { kmgConsole.AddAction(kmgConsole.Command{ Name: "SelfUpdate", Desc: "update kmg tool from our server", Runner: selfUpdate, }) }
func AddSelfInstallCommand() { kmgConsole.AddAction(kmgConsole.Command{ Name: "_SelfInstall", Desc: "install kmg in this computer(should call in install bash)", Runner: selfInstallCmd, Hidden: true, }) }
func AddCommandList() { kmgConsole.AddAction(kmgConsole.Command{ Name: "install", Desc: "install tool", Runner: installCmd, }) }