Add tea comment and show comments of issues/pulls #313

Merged
6543 merged 10 commits from noerw/tea:issue-172-comments into master 2020-12-21 16:07:36 +00:00
Showing only changes of commit 8db6b965c1 - Show all commits

View File

@ -13,6 +13,7 @@ import (
"code.gitea.io/sdk/gitea"
"code.gitea.io/tea/cmd/flags"
"code.gitea.io/tea/modules/context"
"code.gitea.io/tea/modules/print"
"code.gitea.io/tea/modules/utils"
"github.com/urfave/cli/v2"
)
@ -20,6 +21,7 @@ import (
// CmdAddComment is the main command to operate with notifications
var CmdAddComment = cli.Command{
Name: "comment",
Aliases: []string{"c"},
Usage: "Add a comment to an issue / pr",
Description: "Add a comment to an issue / pr",
ArgsUsage: "<issue / pr index> [<comment body>]",
@ -49,8 +51,14 @@ func runAddComment(cmd *cli.Context) error {
}
client := ctx.Login.Client()
_, _, err = client.CreateIssueComment(ctx.Owner, ctx.Repo, idx, gitea.CreateIssueCommentOption{
comment, _, err := client.CreateIssueComment(ctx.Owner, ctx.Repo, idx, gitea.CreateIssueCommentOption{
Body: body,
})
return err
if err != nil {
return err
}
print.Comment(comment)
return nil
}