Skip to content

Commit

Permalink
feat: add option to filter issues by developer
Browse files Browse the repository at this point in the history
```
storypointer -d <developer>
```
  • Loading branch information
jamacku committed Aug 12, 2024
1 parent 10eed02 commit 4cddbff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ storypointer
>
> This tool is intended to be used by Red Hat employees on the Red Hat JIRA instance. It may be adapted to work with other JIRA instances in the future.
```bash
```md
$ storypointer --help
Usage: storypointer [options] [string]

Expand All @@ -68,6 +68,7 @@ Options:
-V, --version output the version number
-c, --component [component] Issue component
-a, --assignee [assignee] Issue assignee
-d, --developer [developer] Issue developer
-h, --help display help for command
```

Expand All @@ -79,7 +80,7 @@ Options:

Size all issues of the `curl` component:

```bash
```md
storypointer -c curl
# output:
JIRA Version: 9.12.10
Expand Down
11 changes: 8 additions & 3 deletions src/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ export class Jira {
return response.issues ?? raise('Jira.getIssuesByID(): missing issues.');
}

async getIssues(component: string, assignee?: string) {
const assigneeQuery = assignee ? `AND assignee = "${assignee}"` : '';
async getIssues(
component: string | undefined,
assignee: string | undefined,
developer: string | undefined
) {
const componentQuery = component ? `AND component = ${component}` : '';
const assigneeQuery = assignee ? `AND assignee = "${assignee}"` : '';
const developerQuery = developer ? `AND developer = "${developer}"` : '';

const response = await this.api.issueSearch.searchForIssuesUsingJqlPost({
jql: `${this.baseJQL} ${assigneeQuery} ${componentQuery} ORDER BY id DESC`,
jql: `${this.baseJQL} ${componentQuery} ${assigneeQuery} ${developerQuery} ORDER BY id DESC`,
fields: [
'id',
'issuetype',
Expand Down
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const cli = async () => {

program
.option('-c, --component [component]', 'Issue component')
.option('-a, --assignee [assignee]', 'Issue assignee');
.option('-a, --assignee [assignee]', 'Issue assignee')
.option('-d, --developer [developer]', 'Issue developer');

program.argument('[string]', 'Issue keys separated by `␣`');

Expand All @@ -61,7 +62,11 @@ const cli = async () => {
const issues =
args.length > 0
? await jira.getIssuesByID(args)
: await jira.getIssues(options.component, options.assignee);
: await jira.getIssues(
options.component,
options.assignee,
options.developer
);

const numberOfIssues = issues.length;

Expand Down

0 comments on commit 4cddbff

Please sign in to comment.