GutenYe
GutenYe

Reputation: 3389

Github Search: how to search in multiple languages

Github search supports:

<keyword> language:javascript

But I want something like:

<keyword> language:javascript OR language:typescript

So that I can sort them by stars or do other filters in a single search.

The reason is: with typescript becoming more and more popular each day, a single filter with language:javascript is no longer enough.

Edit: the OR syntax works fine for code search, but not for repositories search, I want repositories search.

Upvotes: 11

Views: 4640

Answers (2)

Raine Revere
Raine Revere

Reputation: 33637

As of 2020, you can now search multiple languages:

<keyword> language:javascript language:typescript

This will search for any Javascript or Typescript repo matching the keyword.

(I would expect nested OR to work, but the addition of parentheses for grouping leads to unexpected result counts.)

Upvotes: 3

bourehim youssef
bourehim youssef

Reputation: 29

You can do it in the command line by using github Api by a + symbol:

curl "https://api.github.com/search/repositoriesq=$guitar-scales+language:"javascript"+language:"typescript"&per_page=100&page=$i" | jq ".items[] | {name, language}"

And here is a sample from the search result:

{
  "name": "react-boilerplate",
  "language": "JavaScript"
}
{
  "name": "electrode",
  "language": "JavaScript"
}
{
  "name": "claygl",
  "language": "JavaScript"
}
{
  "name": "mean",
  "language": "TypeScript"
}
{
  "name": "rapidpro",
  "language": "JavaScript"
}
{
  "name": "react-native-scaling-drawer",
  "language": "JavaScript"
}

Upvotes: 3

Related Questions