Compare commits
1 Commits
v0.0.0-202
...
main
Author | SHA1 | Date |
---|---|---|
徐晓伟 | 9a00cb52ed |
|
@ -544,6 +544,7 @@ COPYRIGHT:
|
|||
OPTIONS:
|
||||
--base-url value 实例地址,例如:https://gitlab.xuxiaowei.com.cn/api/v4 (default: "https://gitlab.com/api/v4") [%CI_API_V4_URL%]
|
||||
--token value your_access_token
|
||||
--owned 当前用户明确拥有的项目。 (default: false)
|
||||
--sort value 按照 asc 或者 desc 排序 (default: "desc")
|
||||
--page value 页码(默认:1),中文文档 https://docs.gitlab.cn/jh/api/rest/index.html#pagination (default: 1)
|
||||
--per-page value 每页列出的项目数(默认:20;最大:100),中文文档 https://docs.gitlab.cn/jh/api/rest/index.html#pagination (default: 20)
|
||||
|
|
|
@ -15,12 +15,13 @@ func List() *cli.Command {
|
|||
return &cli.Command{
|
||||
Name: "list",
|
||||
Usage: "列出所有项目",
|
||||
Flags: append(flag.Common(), flag.Sort(), flag.Page(), flag.PerPage(), flag.PrintJson(), flag.PrintTime(),
|
||||
flag.Search(), flag.SearchNamespaces(),
|
||||
Flags: append(flag.Common(), flag.Owned(true), flag.Sort(), flag.Page(), flag.PerPage(),
|
||||
flag.PrintJson(), flag.PrintTime(), flag.Search(), flag.SearchNamespaces(),
|
||||
flag.OrderBy(OrderByUsage)),
|
||||
Action: func(context *cli.Context) error {
|
||||
var baseUrl = context.String(constant.BaseUrl)
|
||||
var token = context.String(constant.Token)
|
||||
var owned = context.Bool(constant.Owned)
|
||||
var sort = context.String(constant.Sort)
|
||||
var page = context.Int(constant.Page)
|
||||
var perPage = context.Int(constant.PerPage)
|
||||
|
@ -43,6 +44,7 @@ func List() *cli.Command {
|
|||
Sort: &sort,
|
||||
Search: &search,
|
||||
SearchNamespaces: &searchNamespaces,
|
||||
Owned: &owned,
|
||||
OrderBy: &orderBy,
|
||||
}
|
||||
projects, response, err := gitClient.Projects.ListProjects(opt)
|
||||
|
|
|
@ -18,8 +18,8 @@ func Projects() *cli.Command {
|
|||
Name: "project",
|
||||
Aliases: []string{"projects", "p"},
|
||||
Usage: "项目 API,中文文档:https://docs.gitlab.cn/jh/api/projects.html",
|
||||
Flags: append(flag.Common(), flag.Sort(), flag.Page(), flag.PerPage(), flag.PrintJson(), flag.PrintTime(),
|
||||
flag.Search(), flag.SearchNamespaces(),
|
||||
Flags: append(flag.Common(), flag.Owned(false), flag.Sort(), flag.Page(), flag.PerPage(),
|
||||
flag.PrintJson(), flag.PrintTime(), flag.Search(), flag.SearchNamespaces(),
|
||||
flag.OrderBy(OrderByUsage)),
|
||||
Subcommands: []*cli.Command{
|
||||
List(),
|
||||
|
|
Loading…
Reference in New Issue