|
|
|
@ -18,7 +18,7 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var issueFieldsFlag = flags.FieldsFlag(print.IssueFields, []string{
|
|
|
|
|
"index", "title", "state", "author", "milestone", "labels",
|
|
|
|
|
"index", "title", "state", "author", "milestone", "labels", "owner", "repo",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// CmdIssuesList represents a sub command of issues to list issues
|
|
|
|
@ -35,7 +35,6 @@ var CmdIssuesList = cli.Command{
|
|
|
|
|
// RunIssuesList list issues
|
|
|
|
|
func RunIssuesList(cmd *cli.Context) error {
|
|
|
|
|
ctx := context.InitCommand(cmd)
|
|
|
|
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
|
|
|
|
|
|
|
|
|
state := gitea.StateOpen
|
|
|
|
|
switch ctx.String("state") {
|
|
|
|
@ -75,27 +74,52 @@ func RunIssuesList(cmd *cli.Context) error {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
owner := ctx.Owner
|
|
|
|
|
if ctx.IsSet("owner") {
|
|
|
|
|
owner = ctx.String("owner")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ignore error, as we don't do any input validation on these flags
|
|
|
|
|
labels, _ := flags.LabelFilterFlag.GetValues(cmd)
|
|
|
|
|
milestones, _ := flags.MilestoneFilterFlag.GetValues(cmd)
|
|
|
|
|
var issues []*gitea.Issue
|
|
|
|
|
if ctx.Repo != "" {
|
|
|
|
|
issues, _, err = ctx.Login.Client().ListRepoIssues(owner, ctx.Repo, gitea.ListIssueOption{
|
|
|
|
|
ListOptions: ctx.GetListOptions(),
|
|
|
|
|
State: state,
|
|
|
|
|
Type: kind,
|
|
|
|
|
KeyWord: ctx.String("keyword"),
|
|
|
|
|
CreatedBy: ctx.String("author"),
|
|
|
|
|
AssignedBy: ctx.String("assigned-to"),
|
|
|
|
|
MentionedBy: ctx.String("mentions"),
|
|
|
|
|
Labels: labels,
|
|
|
|
|
Milestones: milestones,
|
|
|
|
|
Since: from,
|
|
|
|
|
Before: until,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
issues, _, err := ctx.Login.Client().ListRepoIssues(ctx.Owner, ctx.Repo, gitea.ListIssueOption{
|
|
|
|
|
ListOptions: ctx.GetListOptions(),
|
|
|
|
|
State: state,
|
|
|
|
|
Type: kind,
|
|
|
|
|
KeyWord: ctx.String("keyword"),
|
|
|
|
|
CreatedBy: ctx.String("author"),
|
|
|
|
|
AssignedBy: ctx.String("assigned-to"),
|
|
|
|
|
MentionedBy: ctx.String("mentions"),
|
|
|
|
|
Labels: labels,
|
|
|
|
|
Milestones: milestones,
|
|
|
|
|
Since: from,
|
|
|
|
|
Before: until,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
issues, _, err = ctx.Login.Client().ListIssues(gitea.ListIssueOption{
|
|
|
|
|
ListOptions: ctx.GetListOptions(),
|
|
|
|
|
State: state,
|
|
|
|
|
Type: kind,
|
|
|
|
|
KeyWord: ctx.String("keyword"),
|
|
|
|
|
CreatedBy: ctx.String("author"),
|
|
|
|
|
AssignedBy: ctx.String("assigned-to"),
|
|
|
|
|
MentionedBy: ctx.String("mentions"),
|
|
|
|
|
Labels: labels,
|
|
|
|
|
Milestones: milestones,
|
|
|
|
|
Since: from,
|
|
|
|
|
Before: until,
|
|
|
|
|
Owner: owner,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fields, err := issueFieldsFlag.GetValues(cmd)
|
|
|
|
|