gitee-cli 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +6 -0
- data/CHANGELOG.md +76 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/images/AppLogo.jpg +0 -0
- data/images/banner.jpg +0 -0
- data/lib/gitee/cli.rb +10 -5
- data/lib/gitee/gitee4cli.rb +0 -1
- metadata +25 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deb17c89cad566a3524baffb93d5b95aee4d10b9a3efa5f164e47ab5bc7579f0
|
4
|
+
data.tar.gz: d1a6233fa18d18fd20858bae20f9fdeb8d7e2d5a153e2d25ef517410460349ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e9992d9e89944e88d9c646157262c2572ec34237cc1783c19fdf23188aba193ab48ba44a03cbbec3f9fd3972964a73a517ae5ac107c8c8c39673f82c803079
|
7
|
+
data.tar.gz: 031e2f6f5605eb2fc4db9dd344538a54fb042cc0743cee287c1a697eed4c7cacfb18fb8ec051de9c22dd11d3b155f0018f802b6f8d9de194371ddcfd3e2086b9
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [Unreleased](#) (2023-05-19)
|
4
|
+
|
5
|
+
<br>
|
6
|
+
|
7
|
+
## [v0.2.2](#) (2023-05-19)
|
8
|
+
|
9
|
+
### Enhancements:
|
10
|
+
|
11
|
+
- Distinguish `gitee help` from `gitee -h`
|
12
|
+
- Use `standard_path` to make corss-platform path
|
13
|
+
|
14
|
+
<br>
|
15
|
+
|
16
|
+
## [v0.2.1](#) (2023-05-19)
|
17
|
+
|
18
|
+
### Enhancements:
|
19
|
+
|
20
|
+
- Enhance online docs
|
21
|
+
|
22
|
+
<br>
|
23
|
+
|
24
|
+
## [v0.2.0](#) (2023-05-08)
|
25
|
+
|
26
|
+
### New features:
|
27
|
+
|
28
|
+
- Add `YARD` documents
|
29
|
+
- Add authorization `task auth:apply`
|
30
|
+
- Support auto refresh access token
|
31
|
+
|
32
|
+
### Enhancements:
|
33
|
+
|
34
|
+
- Reserve temporary authorization `task auth:temp_apply`
|
35
|
+
- Load faster
|
36
|
+
|
37
|
+
### Deprecations:
|
38
|
+
|
39
|
+
- Remove support of `GITEE_TOKEN_FILE`
|
40
|
+
|
41
|
+
<br>
|
42
|
+
|
43
|
+
## [v0.1.0](#) (2023-05-01)
|
44
|
+
|
45
|
+
### New features:
|
46
|
+
|
47
|
+
- Get token ~~from file by `GITEE_TOKEN_FILE` or~~ directly from environment variable `GITEE_TOKEN`
|
48
|
+
|
49
|
+
Not support `GITEE_TOKEN_FILE` since `v0.2.0`
|
50
|
+
|
51
|
+
- ~~Add compromising method to get token by hand `task auth:apply`~~
|
52
|
+
|
53
|
+
Changed to `task auth:temp_apply` since `v0.2.0`
|
54
|
+
|
55
|
+
- Support
|
56
|
+
|
57
|
+
- `repo:branches`
|
58
|
+
- `repo:create`
|
59
|
+
- `repo:delete`
|
60
|
+
- `repo:view`
|
61
|
+
- `repo:list`
|
62
|
+
|
63
|
+
- Work basically
|
64
|
+
|
65
|
+
<br>
|
66
|
+
|
67
|
+
## [Initialize](#) (2023-04-28)
|
68
|
+
|
69
|
+
Begin to work.
|
70
|
+
|
71
|
+
<br>
|
72
|
+
|
73
|
+
<hr>
|
74
|
+
|
75
|
+
This Changelog is maintained with [chlog](https://github.com/ccmywish/chlog)
|
76
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023-present Aoran Zeng. All rights reserved.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
<div align="center">
|
2
|
+
|
3
|
+
# Gitee CLI
|
4
|
+
|
5
|
+
![Banner](./images/banner.jpg)
|
6
|
+
|
7
|
+
Work with [Gitee](https://gitee.com/) from the command line.
|
8
|
+
|
9
|
+
</div>
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ gem install gitee-cli
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
使用`gitee-cli`需要`Gitee Access Token`,我们可以通过以下两种方式实现:
|
20
|
+
|
21
|
+
### 方式1(推荐)
|
22
|
+
|
23
|
+
正常情况下,您应当使用该方式。在[Gitee个人设置](https://gitee.com/profile/account_information) -> [第三方应用](https://gitee.com/oauth/applications),创建要接入Gitee的应用,我们在此创建一个应用叫做`gitee-cli`,我们填入以下资料:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
# 应用名称
|
27
|
+
gitee-cli
|
28
|
+
|
29
|
+
# 应用描述
|
30
|
+
第三方Gitee命令行客户端gitee-cli
|
31
|
+
|
32
|
+
# 应用主页
|
33
|
+
https://gitee.com/ccmywish/gitee-cli
|
34
|
+
|
35
|
+
# 应用回调地址(必填以下内容)
|
36
|
+
http://localhost
|
37
|
+
|
38
|
+
# 权限,一般勾选以下即可
|
39
|
+
- user_info
|
40
|
+
- projects
|
41
|
+
- pull_requests
|
42
|
+
- issues
|
43
|
+
|
44
|
+
# Logo上传gitee-cli的logo即可
|
45
|
+
# 使用下面命令下载
|
46
|
+
curl -fsSL https://gitee.com/ccmywish/gitee-cli/raw/main/images/AppLogo.jpg -o ~/Desktop/GiteeCLIAppLogo.jpg
|
47
|
+
```
|
48
|
+
|
49
|
+
注册完成后,我们会得到`Client ID`和`Client Secret`。最后一步,在命令行上运行:
|
50
|
+
```bash
|
51
|
+
# 注意,括号和逗号都是必需的,之间是否空格没有要求
|
52
|
+
$ gitee auth:apply[id, secret]
|
53
|
+
```
|
54
|
+
|
55
|
+
之后,便可以使用任何其它`gitee`命令了。
|
56
|
+
|
57
|
+
<br>
|
58
|
+
|
59
|
+
### 方式2(临时)
|
60
|
+
|
61
|
+
如果您只想临时使用,或者不方便将token等关键信息存储在本机,请运行:
|
62
|
+
```bash
|
63
|
+
$ gitee auth:temp_apply
|
64
|
+
```
|
65
|
+
跟随返回的地址申请`token`。
|
66
|
+
|
67
|
+
之后,在使用任何其它`gitee`命令时,带上参数`GITEE_TOKEN=xxx`即可,例如:
|
68
|
+
```bash
|
69
|
+
$ gitee repo:branches[ccmywish, gitee-cli] GITEE_TOKEN=xxx
|
70
|
+
```
|
71
|
+
|
72
|
+
## 命令行
|
73
|
+
|
74
|
+
```bash
|
75
|
+
gitee -h # 快速帮助
|
76
|
+
|
77
|
+
gitee help [pattern] # 显示可执行命令,可以使用pattern来搜索相关命令
|
78
|
+
|
79
|
+
gitee auth:apply[id,secret] # Apply for an access token using Gitee app
|
80
|
+
gitee auth:temp_apply # Apply for an access token temporarily
|
81
|
+
gitee repo:branches[user,repo] # Get all branches of a repository
|
82
|
+
gitee repo:create[repo] # Create a repository under your space
|
83
|
+
gitee repo:delete[user,repo] # Delete the '<user>/<repo>' repository
|
84
|
+
gitee repo:list[user] # List repositories owned by user/organization
|
85
|
+
gitee repo:view[user,repo] # View the repository's README
|
86
|
+
```
|
87
|
+
|
88
|
+
<br>
|
data/images/AppLogo.jpg
ADDED
Binary file
|
data/images/banner.jpg
ADDED
Binary file
|
data/lib/gitee/cli.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# File : cli.rb
|
3
3
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
4
4
|
# Created on : <2023-04-28>
|
5
|
-
# Last modified : <2023-05-
|
5
|
+
# Last modified : <2023-05-19>
|
6
6
|
#
|
7
7
|
# cli:
|
8
8
|
#
|
9
9
|
# Comamnd line processing by first hand
|
10
|
-
#
|
11
10
|
# ---------------------------------------------------------------
|
12
11
|
|
13
12
|
require 'rake'
|
13
|
+
require 'standard_path'
|
14
14
|
|
15
15
|
# Add method for Rake application
|
16
16
|
#
|
@@ -32,9 +32,9 @@ module Gitee
|
|
32
32
|
module CLI
|
33
33
|
|
34
34
|
# gitee-cli version
|
35
|
-
VERSION = "0.2.
|
35
|
+
VERSION = "0.2.2"
|
36
36
|
|
37
|
-
DEFAULT_TOKEN_DIR =
|
37
|
+
DEFAULT_TOKEN_DIR = StandardPath.app_data "Gitee CLI in Ruby"
|
38
38
|
DEFAULT_TOKEN_FILE = File.join DEFAULT_TOKEN_DIR, "sec.json"
|
39
39
|
|
40
40
|
# Read token from local or environment variable
|
@@ -83,7 +83,7 @@ module Gitee
|
|
83
83
|
def self.run
|
84
84
|
argv = ARGV.dup
|
85
85
|
|
86
|
-
help_opts = ['-h', '-H', '--help'
|
86
|
+
help_opts = ['-h', '-H', '--help']
|
87
87
|
version_opts = ['-v', '-V', '--version']
|
88
88
|
|
89
89
|
if argv.empty?
|
@@ -93,6 +93,11 @@ module Gitee
|
|
93
93
|
argv -= help_opts
|
94
94
|
puts help_banner
|
95
95
|
argv << '-T'
|
96
|
+
elsif argv[0] == 'help'
|
97
|
+
help_what = argv[1]
|
98
|
+
argv.clear
|
99
|
+
argv << '-D'
|
100
|
+
argv << help_what if not help_what.nil?
|
96
101
|
elsif argv.intersect? version_opts
|
97
102
|
argv -= version_opts
|
98
103
|
puts version_banner
|
data/lib/gitee/gitee4cli.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitee-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aoran Zeng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: standard_path
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.0
|
69
83
|
description: 'Work with Gitee from the command line.
|
70
84
|
|
71
85
|
'
|
@@ -75,7 +89,13 @@ executables:
|
|
75
89
|
extensions: []
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
92
|
+
- ".yardopts"
|
93
|
+
- CHANGELOG.md
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
78
96
|
- exe/gitee
|
97
|
+
- images/AppLogo.jpg
|
98
|
+
- images/banner.jpg
|
79
99
|
- lib/gitee-cli.rb
|
80
100
|
- lib/gitee/cli.rb
|
81
101
|
- lib/gitee/cli/Rakefile
|
@@ -85,8 +105,8 @@ homepage: https://gitee.com/ccmywish
|
|
85
105
|
licenses:
|
86
106
|
- MIT
|
87
107
|
metadata:
|
88
|
-
bug_tracker_uri: https://gitee.com/ccmywish
|
89
|
-
source_code_uri: https://gitee.com/ccmywish
|
108
|
+
bug_tracker_uri: https://gitee.com/ccmywish/gitee-cli/issues
|
109
|
+
source_code_uri: https://gitee.com/ccmywish/gitee-cli
|
90
110
|
post_install_message:
|
91
111
|
rdoc_options: []
|
92
112
|
require_paths:
|
@@ -105,5 +125,5 @@ requirements: []
|
|
105
125
|
rubygems_version: 3.4.8
|
106
126
|
signing_key:
|
107
127
|
specification_version: 4
|
108
|
-
summary:
|
128
|
+
summary: Unofficial Gitee command line client
|
109
129
|
test_files: []
|