Fix context requirements of subcommands #474
|
@ -54,10 +54,6 @@ func runReleaseDelete(cmd *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if release == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = client.DeleteRelease(ctx.Owner, ctx.Repo, release.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -72,10 +72,6 @@ func runReleaseEdit(cmd *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if release == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var isDraft, isPre *bool
|
||||
if ctx.IsSet("draft") {
|
||||
isDraft = gitea.OptionalBool(strings.ToLower(ctx.String("draft"))[:1] == "t")
|
||||
|
|
|
@ -50,14 +50,12 @@ func getReleaseByTag(owner, repo, tag string, client *gitea.Client) (*gitea.Rele
|
|||
return nil, err
|
||||
}
|
||||
if len(rl) == 0 {
|
||||
fmt.Println("Repo does not have any release")
|
||||
return nil, nil
|
||||
return nil, fmt.Errorf("Repo does not have any release")
|
||||
}
|
||||
for _, r := range rl {
|
||||
if r.TagName == tag {
|
||||
return r, nil
|
||||
}
|
||||
}
|
||||
fmt.Println("Release tag does not exist")
|
||||
return nil, nil
|
||||
return nil, fmt.Errorf("Release tag does not exist")
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ func promptIssueProperties(login *config.Login, owner, repo string, o *gitea.Cre
|
|||
}
|
||||
|
||||
// assignees
|
||||
if o.Assignees, err = promptMultiSelect("Assignees:", selectables.Collaborators, "[other]"); err != nil {
|
||||
if o.Assignees, err = promptMultiSelect("Assignees:", selectables.Assignees, "[other]"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ func promptIssueProperties(login *config.Login, owner, repo string, o *gitea.Cre
|
|||
|
||||
type issueSelectables struct {
|
||||
Repo *gitea.Repository
|
||||
Collaborators []string
|
||||
Assignees []string
|
||||
MilestoneList []string
|
||||
MilestoneMap map[string]int64
|
||||
LabelList []string
|
||||
|
@ -124,17 +124,15 @@ func fetchIssueSelectables(login *config.Login, owner, repo string, done chan is
|
|||
return
|
||||
}
|
||||
|
||||
// FIXME: this should ideally be ListAssignees(), https://github.com/go-gitea/gitea/issues/14856
|
||||
colabs, _, err := c.ListCollaborators(owner, repo, gitea.ListCollaboratorsOptions{})
|
||||
assignees, _, err := c.GetAssignees(owner, repo)
|
||||
if err != nil {
|
||||
r.Err = err
|
||||
done <- r
|
||||
return
|
||||
}
|
||||
r.Collaborators = make([]string, len(colabs)+1)
|
||||
r.Collaborators[0] = login.User
|
||||
for i, u := range colabs {
|
||||
r.Collaborators[i+1] = u.UserName
|
||||
r.Assignees = make([]string, len(assignees))
|
||||
for i, u := range assignees {
|
||||
r.Assignees[i] = u.UserName
|
||||
}
|
||||
|
||||
milestones, _, err := c.ListRepoMilestones(owner, repo, gitea.ListMilestoneOption{})
|
||||
|
|
Loading…
Reference in New Issue
Block a user