diff --git a/internal/app/pull_edit.go b/internal/app/pull_edit.go index 8ff33472..bd2b7dfb 100644 --- a/internal/app/pull_edit.go +++ b/internal/app/pull_edit.go @@ -19,7 +19,8 @@ func (a *application) pullEditCommand() *cobra.Command { var draft, ready, maintainer, useEditor, removeMilestone bool var metadata metadataFlags var reviewers services.ReviewRequestChanges - cmd := &cobra.Command{Use: "edit [ | | ]", Short: "Edit a pull request: title, body, base, reviewers, labels, assignees, milestone, due date", Annotations: pullArgumentsAnnotation(nil), Args: usageArgs(cobra.MaximumNArgs(1)), RunE: func(cmd *cobra.Command, args []string) (runErr error) { + cmd := &cobra.Command{Use: "edit [ | | ]", Short: "Edit a pull request", Long: `Edit the title, body, base branch, reviewers, labels, assignees, milestone or due date of a +pull request, or mark it as a draft or ready for review.`, Annotations: pullArgumentsAnnotation(nil), Args: usageArgs(cobra.MaximumNArgs(1)), RunE: func(cmd *cobra.Command, args []string) (runErr error) { var editorDraft terminal.Draft defer finishDraft(&editorDraft, &runErr) if err := validateBodySources(cmd); err != nil { diff --git a/internal/app/pull_integration_test.go b/internal/app/pull_integration_test.go index 6c5f41c4..b3a28163 100644 --- a/internal/app/pull_integration_test.go +++ b/internal/app/pull_integration_test.go @@ -147,8 +147,8 @@ func TestGiteaPullEditLifecycle(t *testing.T) { diagnostics.Reset() require.NoError(t, Execute(context.Background(), deps, []string{"pr", "checkout", n, "-R", repo.FullName, "--cwd", workingTree, "--no-input", "--json"})) require.NoError(t, json.Unmarshal(out.Bytes(), &checkout)) - require.Contains(t, diagnostics.String(), "FETCH_HEAD") - require.Equal(t, "pr/"+n, checkout.Branch) + require.Empty(t, diagnostics.String(), "checkout fetches quietly") + require.Equal(t, "feature", checkout.Branch, "the local branch takes the head branch name") require.Equal(t, head.Head.SHA, checkout.Commit) actual, err := runner.Output(context.Background(), workingTree, false, "rev-parse", "HEAD") require.NoError(t, err) @@ -233,7 +233,7 @@ func TestGiteaPullEditLifecycle(t *testing.T) { diagnostics.Reset() require.NoError(t, Execute(context.Background(), deps, []string{"pr", "review", "resolve", commentID, "-R", repo.FullName})) require.Empty(t, out.String()) - require.Contains(t, diagnostics.String(), "resolved") + require.Empty(t, diagnostics.String(), "feedback is for terminals") require.NoError(t, json.Unmarshal(execute("pr", "review", "comments", n, "-R", repo.FullName, "--review", fmt.Sprint(review.ID), "--json"), &comments)) require.NotEmpty(t, comments[0].Resolver) out.Reset() @@ -254,7 +254,7 @@ func TestGiteaPullEditLifecycle(t *testing.T) { require.NoError(t, Execute(context.Background(), deps, []string{"pr", "review", "delete", n, fmt.Sprint(submitted.ID), "-R", repo.FullName, "--yes"})) verifyEditorSubmission(t, deps, repo.FullName, n, true) require.Empty(t, out.String()) - require.Contains(t, diagnostics.String(), "Deleted review") + require.Empty(t, diagnostics.String(), "feedback is for terminals") if reviewerTokenFile := os.Getenv("GITEA_TEA_TEST_REVIEWER_TOKEN_FILE"); reviewerTokenFile != "" { reviewerDeps := deps reviewerDeps.Getenv = gitea.env(readTokenFile(t, reviewerTokenFile)) diff --git a/internal/app/pull_review.go b/internal/app/pull_review.go index 379774de..77b23726 100644 --- a/internal/app/pull_review.go +++ b/internal/app/pull_review.go @@ -244,8 +244,8 @@ func (a *application) reviewCreateCommand(use, short string) *cobra.Command { cmd.Flags().StringVarP(&body, "body", "b", "", "Review body") cmd.Flags().StringVarP(&file, "body-file", "F", "", "Read the body from `file`, or - for stdin") cmd.Flags().BoolVarP(&useEditor, "editor", "e", false, "Write the body in your editor") - cmd.Flags().StringVar(&commentsFile, "comments-file", "", "JSON array of inline comments: path, body, and new_position or old_position") - cmd.Flags().StringVar(&commit, "commit", "", "Commit to review (default: the head of the pull request)") + cmd.Flags().StringVar(&commentsFile, "comments-file", "", "Read inline comments from a JSON `file`: an array of path, body, and new_position or old_position") + cmd.Flags().StringVar(&commit, "commit", "", "Commit `sha` to review (default: the head of the pull request)") cmd.ValidArgsFunction = a.completePulls("open") return cmd }