* deletion for issues with confirmation flag
* add handling for interaction case
* finish implementation for issues
* finish the implementation for issues
* finalize the implementation for PR
* fix missing --yes flag for PR
* address PR comments related to feedbacks
* improve CommentablePreRun for pre checks
* improve confirmation prompt and truncate long comment body
* address PR comments on tests
* Truncate comment for confirmation prompt
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Improve test case descriptions
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Fix mock comment body
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Remove irrelevant prompt stub
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Use `opts.Interactive` as TTY indicator
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Fix expected `Interactive` value
Signed-off-by: Babak K. Shandiz <babakks@github.com>
* Polish `TestNewCmdComment`
Signed-off-by: Babak K. Shandiz <babakks@github.com>
---------
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Co-authored-by: Babak K. Shandiz <babakks@github.com>
The "Author" struct was too overloaded in different types of queries that treat struct fields in incompatible ways. This change defines a simpler CommentAuthor struct for use in comments until we can figure out how to query `... on User` information for comments too.
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.
Features:
- Each pr command now gets assigned a concept of a Finder. This makes it
easier to stub the PR in tests without having to stub the underlying
HTTP calls or git invocations.
- `pr view --web` is much faster since it only fetches the "url" field.
- `pr diff 123` now skips a whole API call where a whole PR was
unnecessarily preloaded just to access its diff in a subsequent call.
- PullRequestGraphQL query builder is now used to construct queries.
- A bunch of individual commands are now freed of having to know about
concepts such as BaseRepo, Branch, Config, or Remotes.
The `--json` flag accepts a list of GraphQL fields to query for and
output in JSON format. To get the list of available flags, run the
command with a blank value for `--json`. Additional `--jq` and
`--template` flags are available just like in `gh api`.