From a9dcd1569b795e8e6eb6243faef307745485684b Mon Sep 17 00:00:00 2001 From: Zoker Date: Sat, 6 Jun 2020 20:47:51 +0800 Subject: [PATCH] ask for error and exist projects --- platform/gitee.go | 10 ++++++++++ share/tools.go | 26 +++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/platform/gitee.go b/platform/gitee.go index 11aa192..0c91802 100644 --- a/platform/gitee.go +++ b/platform/gitee.go @@ -96,6 +96,16 @@ func syncGitee(c *gcli.Command, args []string) error { // show results showRepoRes(repoRes) + // ask for exist and error details + asErr := share.AskError() + if asErr == "0" { + return nil + } + asExi := share.AskExist() + if asExi == "0" { + return nil + } + fmt.Println(asExi) return nil } diff --git a/share/tools.go b/share/tools.go index 3686c7c..a16684b 100644 --- a/share/tools.go +++ b/share/tools.go @@ -198,10 +198,26 @@ func AskPublic(npType string) string { if npType == "Enterprise" { namespace = append(namespace, "Inner public (Only enterprise members can see this repository)") } - public := interact.SelectOne( - "Please choose this project's public type: (all projects will apply)", - namespace, - "", - ) + ques := "Please choose this project's public type: (all projects will apply)" + public := selectOne(namespace, ques) return public +} + +func AskError() string { + howTo := []string{"Exit and fix them", + "Skip them"} + ques := "There are errors on some dirs, what would you like to do?" + return selectOne(howTo, ques) +} + +func AskExist() string { + howTo := []string{"Exit and fix them", + "Overwrite the remote (same as git push --force, you need exactly know what you do before you select this item)", + "Skip them"} + ques := "The are some projects name already exists, what would you like to do?" + return selectOne(howTo, ques) +} + +func selectOne(items []string, ques string) string { + return interact.SelectOne(ques, items, "",) } \ No newline at end of file