-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcommand.py
More file actions
41 lines (31 loc) · 1.32 KB
/
command.py
File metadata and controls
41 lines (31 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import sys
from lib.workflow.config import read_config, save_config
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
from lib.workflow.common_util import editor # noqa: E402
@editor(
"Input the issues repository, "
"If the issue is within this repository, no need to specify. "
"Otherwise, format as: username/repository-name"
)
@editor(
"Input your gitlab API URL to access gitlab api, if not specified, default is https://gitlab.com/api/v4"
)
@editor("Input your gitlab TOKEN to access gitlab api")
def edit_config(issue_url, gitlab_api_url, gitlab_token):
pass
def main():
issue_url = read_config("git_issue_repo", is_global=True)
gitlab_token = read_config("gitlab_token", is_global=True)
gitlab_api_url = read_config("gitlab_api_url", is_global=True)
issue_url, gitlab_api_url, gitlab_token = edit_config(issue_url, gitlab_api_url, gitlab_token)
if not gitlab_token:
print("Please specify the gitlab token to access gitlab api.")
sys.exit(0)
save_config("git_issue_repo", issue_url, is_global=True)
save_config("gitlab_token", gitlab_token, is_global=True)
save_config("gitlab_api_url", gitlab_api_url, is_global=True)
print("config gitlab settings successfully.")
sys.exit(0)
if __name__ == "__main__":
main()