Add support for search command arguments and JQL queries #261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
A much better (I think) version of #241. This allows arguments and JQL queries to be used within the
!jira search
command. This also fixes up a few other things with the search command, such as the "No results found" message not being displayed when no results were found as a result of executing a search. Additionally, this adds the JQL query used into the embed, and adds the total number of results found into the title of the embed.Approach
First, the modifiers are grouped together. Then, if one of the modifiers is
:jql
, the text following it is used as the JQL query. However, if:jql
is not present, the modifiers will be used in building the query. A modifier is built with a hyphen or an underscore preceding a field name or a field shortcut (for fields like Mojang Priority, this is "mp" [these have been manually added in the config]). When using an underscore, the modifier is directly paired with its argument. However, when using a hyphen, the modifier is paired with its argument, and then the clause is negated. Finally, any text not part of a modifier is treated astext ~ <content>
, allowing classic search features to continue to function.Additionally, some custom search clauses have been implemented:
_commenter
usesissueFunction in commented("by <arg>")
_transitionedby
usesstatus changed by <arg>
Searches are automatically ordered by
created, updated DESC
.An example of a valid command:
!jira search _transitionedby violine1101 -resolution Unresolved _commenter "Darth Cobby"
This searches with this query:
status changed by violine1101 AND resolution != Unresolved AND issueFunction in commented("by \"Darth Cobby\"") ORDER BY created, updated DESC