mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
Add interactive mode for tea issue create
(#302)
Implement interactive issue creation Comment PromptRepoSlug Move PromptRepoSlug to the right place Hide promptRepoSlug Signed-off-by: Martin Reboredo <yakoyoku@gmail.com> Co-authored-by: Martin Reboredo <yakoyoku@gmail.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/302 Reviewed-by: Norwin <noerw@noreply.gitea.io> Reviewed-by: khmarbaise <khmarbaise@noreply.gitea.io> Reviewed-by: 6543 <6543@obermui.de> Co-Authored-By: Martin Reboredo <yakoyakoyokuyoku@noreply.gitea.io> Co-Committed-By: Martin Reboredo <yakoyakoyokuyoku@noreply.gitea.io>
This commit is contained in:
@ -5,14 +5,11 @@
|
||||
package issues
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"code.gitea.io/tea/cmd/flags"
|
||||
"code.gitea.io/tea/modules/config"
|
||||
"code.gitea.io/tea/modules/print"
|
||||
"code.gitea.io/tea/modules/interact"
|
||||
"code.gitea.io/tea/modules/task"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@ -39,23 +36,15 @@ var CmdIssuesCreate = cli.Command{
|
||||
func runIssuesCreate(ctx *cli.Context) error {
|
||||
login, owner, repo := config.InitCommand(flags.GlobalRepoValue, flags.GlobalLoginValue, flags.GlobalRemoteValue)
|
||||
|
||||
issue, _, err := login.Client().CreateIssue(owner, repo, gitea.CreateIssueOption{
|
||||
Title: ctx.String("title"),
|
||||
Body: ctx.String("body"),
|
||||
// TODO:
|
||||
//Assignee string `json:"assignee"`
|
||||
//Assignees []string `json:"assignees"`
|
||||
//Deadline *time.Time `json:"due_date"`
|
||||
//Milestone int64 `json:"milestone"`
|
||||
//Labels []int64 `json:"labels"`
|
||||
//Closed bool `json:"closed"`
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if ctx.NumFlags() == 0 {
|
||||
return interact.CreateIssue(login, owner, repo)
|
||||
}
|
||||
|
||||
print.IssueDetails(issue)
|
||||
fmt.Println(issue.HTMLURL)
|
||||
return nil
|
||||
return task.CreateIssue(
|
||||
login,
|
||||
owner,
|
||||
repo,
|
||||
ctx.String("title"),
|
||||
ctx.String("body"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user