-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pr list --search
and --author
flags
#3294
Conversation
Also splits List vs. Search queries into separate methods for better maintanability.
Thanks for looping me in @mislav 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Nice work! I think searching for issues and prs is going to be a very popular feature.
pkg/cmd/pr/list/http.go
Outdated
q.SetType(githubsearch.PullRequest) | ||
q.InRepository(ghrepo.FullName(repo)) | ||
q.AddQuery(filters.Search) | ||
q.SortBy(githubsearch.CreatedAt, githubsearch.Desc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this override any sort parameter the user might have specified in filters.Search
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great question. Any user's query will always be appended at the end, so their own sort:*
directive would override this implicit sort:
directive after ElasticSearch parses it. However, after some thought, I decided that since sort:created-desc
is already the default for issue search, it doesn't really need to be explicitly specified here. I'll remove it 👍
@@ -153,6 +153,34 @@ type FilterOptions struct { | |||
Search string | |||
} | |||
|
|||
func (opts *FilterOptions) IsDefault() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much cleaner!
This is the default sort mode for issues, so it's not needed to explicitly set it. Furthermore, the user can specify their own sort mode through the `--search` option.
This adds search functionality to
pr list
to complementissue list --search
.Since the search backend is now easily available through code, this also adds support for
--author
filter for compatibility withissue list
#2628 /cc @GeorgeMacFollowup to #3196 /cc @g14a
Fixes #452, ref. #641