From 1a4a897b6e1d7538e6da3b09eb13383208fa2241 Mon Sep 17 00:00:00 2001 From: Zoker Date: Sat, 11 Jul 2020 10:33:08 +0800 Subject: [PATCH] update readme and some description --- README.zh-CN.md | 39 ++++++++++++++++++++++++--------------- platform/gitee.go | 3 +-- share/tools.go | 2 +- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 6bd4f49..c2ed139 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,13 +6,15 @@ ### 功能特点 - [简单] 可自动在对应平台创建同名仓库并上传 - [可靠] 可选择是否本地覆盖远程(如果同名仓库在远端已存在) -- [灵活] 可通过多种方式导入仓库源(目录、文本列表) +- [方便] 可选择上传到 Gitee 组织或者新建组织上传 +- [灵活] 可通过多种方式导入仓库源(目录、文本列表、Github 源) - [快速] 并发5个同时操作(各平台均有限制,5个并发可保证成功率及速度) ### 注意事项 - 工具会自动生成临时的一个 Remote `up2GitX-{timestamp}` 进行推送,不会影响现有的 Remote 配置 - 工具会调用OAuth授权进行仓库的创建,后续可以在第三方应用管理取消授权 - 工具在进行处理的过程中会对特殊情况进行交互,请仔细阅读并慎重选择 +- Github 的镜像操作会生成临时目录来存储这些临时的裸仓库,同步完成后,自行删除即可 ### 设计流程 @@ -38,31 +40,38 @@ Global Options: --no-color Disable color when outputting message -h, --help Display this help information + Arguments: repoSource Tell me which repo dir or list your want to sync, is required + token Provide platform token for skip api rate limit Examples: Using dir: ./up2 gitee /Zoker/repos/ Dir example - $ ls -l /Zoker/repos/ - drwxr-xr-x 4 zoker 128B Jun 1 19:05 git-work-repo1 - drwxr-xr-x 4 zoker 128B Jun 1 19:02 taskover - drwxr-xr-x 4 zoker 128B Jun 1 19:03 blogine - drwxr-xr-x 3 zoker 96B Jun 1 12:15 git-bare-repo3 - ... + $ ls -l /Zoker/repos/ + drwxr-xr-x 4 zoker 128B Jun 1 19:05 git-work-repo1 + drwxr-xr-x 4 zoker 128B Jun 1 19:02 taskover + drwxr-xr-x 4 zoker 128B Jun 1 19:03 blogine + drwxr-xr-x 3 zoker 96B Jun 1 12:15 git-bare-repo3 + ... Using file: ./up2 gitee /Zoker/repos.list File example - $ cat /Zoker/repos.list - /tmp/repos/git-work-repo1 - /Zoker/workspace/git-work-repo2 - /other/path/to/git-bare-repo3 - ... + $ cat /Zoker/repos.list + /tmp/repos/git-work-repo1 + /Zoker/workspace/git-work-repo2 + /other/path/to/git-bare-repo3 + ... + + Using Source: ./up2 gitee github:zoker YOUR_TOKEN_HERE(OPTIONAL) + Support import from Github source, replace {zoker} with your expected Github path + It better to provide your own access_token to avoid api rate limit, eg on Github: https://github.com/settings/tokens + Alert: Only Github source and public project supported, other platform like Gitlab, Bitbucket will be added later ``` ### 使用示例 -这里以上传到 Gitee 为例 +这里以上传到 Gitee 为例([镜像 Github 空间到 Gitee 示例](https://gitee.com/kesin/up2GitX/releases/v1.1.0)) #### 1、指定 RepoSource @@ -74,9 +83,9 @@ Examples: #### 2、输入 Gitee 账号信息并选择同步到哪个 Namespace -![输入图片说明](https://images.gitee.com/uploads/images/2020/0613/174031_79068a5e_62561.png "2.png") +![输入图片说明](https://images.gitee.com/uploads/images/2020/0711/102903_f774ef30_62561.png "屏幕截图.png") -输入注册 Gitee 所用的邮箱以及密码,认证成功后会列出可用的 Namespace,在 Gitee 上,它可以是个人名下、组织名下或者企业名下。(目前仅支持上传到个人名下,后续接口功能到位会支持组织和企业) +输入注册 Gitee 所用的邮箱以及密码,认证成功后会列出可用的 Namespace,你也可以选择新建一个组织。在 Gitee 上,它可以是个人名下、组织名下或者企业名下。(目前仅支持上传到个人和组织,后续接口功能到位会支持企业) #### 3、确认将要生成的仓库链接并选择公开属性 diff --git a/platform/gitee.go b/platform/gitee.go index fb9b9a5..661138a 100644 --- a/platform/gitee.go +++ b/platform/gitee.go @@ -277,12 +277,11 @@ func createGroup(token string) []string { if result, _, err := share.PostFormByte(orgUrl, paramsJson); err == nil { orgRes, _ := simplejson.NewJson([]byte(result)) login, _ := orgRes.Get("login").String() - errorMsg, _ := orgRes.Get("message").String() if login == orgPath { color.Green.Printf("\nGroup https://gitee.com/%s has been successfully Created!\n", orgPath) return []string{orgPath, orgPath, "Group"} } else { - color.Red.Println(errorMsg) + color.Red.Println(orgRes) } } else { color.Red.Println(err.Error()) diff --git a/share/tools.go b/share/tools.go index 6e2762b..0e3a021 100644 --- a/share/tools.go +++ b/share/tools.go @@ -429,7 +429,7 @@ func AskPublic(npType string) string { func AskError() string { howTo := []string{"Exit and fix them", "Skip them"} - ques := "There are errors on some dirs, what would you like to do?" + ques := "There are errors on some projects, what would you like to do?" return selectOne(howTo, ques) }