Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

feat: add ability to search for many apis #129

Merged
merged 2 commits into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ async function getRepoIssues(repo: Repo, flags?: Flags): Promise<IssueResult> {

let use = true;
if (flags) {
if (flags.api && r.api !== flags.api) {
use = false;
if (flags.api) {
const apiTypes =
flags.api.split(',').map(t => t.trim()).filter(t => t.length > 0);
if (!r.api || apiTypes.indexOf(r.api) === -1) {
use = false;
}
}
if (flags.repo && r.repo !== flags.repo) {
use = false;
}
if (flags.api && r.api !== flags.api) {
use = false;
}
if (flags.outOfSlo && !r.isOutOfSLO) {
use = false;
}
Expand Down
7 changes: 2 additions & 5 deletions src/slo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function getRepoResults(repos: IssueResult[]) {
return {repos: results, totals};
}

function getLanguageResults(repos: IssueResult[], api?: string) {
function getLanguageResults(repos: IssueResult[]) {
const results = new Map<string, LanguageResult>();
const issues = new Array<Issue>();
repos.forEach(r => {
Expand All @@ -75,9 +75,6 @@ function getLanguageResults(repos: IssueResult[], api?: string) {
if (isPullRequest(i)) {
return;
}
if (api && !isApi(i, api)) {
return;
}
issues.push(i);
});
});
Expand Down Expand Up @@ -430,7 +427,7 @@ export async function showApiSLOs(cli: meow.Result) {
export async function showLanguageSLOs(cli: meow.Result) {
const output = new Array<string>();
const issues = await getIssues(cli.flags as Flags);
const res = getLanguageResults(issues, cli.flags.api);
const res = getLanguageResults(issues);
const languageHeader =
['Language', 'Total', 'P0', 'P1', 'P2', 'Untriaged', 'Out of SLO'];
let t2: Table;
Expand Down