A terminal client for Tangled, the git forge built on AT Protocol.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344package cli
import ( "fmt"
"github.com/alyraffauf/tg/internal/app" "github.com/spf13/cobra")
func newIssueCommentCommand(service *app.Service) *cobra.Command { var bodyText, bodyFile, repository string
command := &cobra.Command{ Use: "comment <rkey>", Short: "Add a comment to an issue", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { body, err := commandBody(bodyText, bodyFile) if err != nil { return err } if body == "" { return fmt.Errorf("provide --body or --body-file") } ctx := cmd.Context() target, err := resolveTargetFlag(ctx, repository, service) if err != nil { return err } result, err := service.CommentIssue(ctx, target, args[0], body) if err != nil { return err } return output(cmd, result, func(result *app.CreatedRecordResult) { fmt.Fprintf(cmd.OutOrStdout(), "Added comment %s\n", result.URI) }) }, } command.Flags().StringVarP(&bodyText, "body", "b", "", "Comment body") command.Flags().StringVarP(&bodyFile, "body-file", "F", "", "Read comment body from file") command.Flags().StringVarP(&repository, "repo", "R", "", "Target repository as handle/repo") return command}