Git Product home page Git Product logo

starred_search's Introduction

✴    ✴   ✴              ✴       ✴              ✴                ✴
  ✴  _      ✴      ✴   ✴        _    ✴              ✴   ✴     _   ✴  
 ___| |_ __ _ _✴__ _ __ ___  __| |    ___ ✴___  __ _ _✴__ ___| |__  
/ __| __/ _` | '✴_| '__/ _ \/ _` |  ✴/ __|/ _ \/✴_` | '__/ __| '_ \✴
\__ \ || (✴| ||  | | |  __/ (_| |\__ \  __/ (_| | | | (__| || |
|___/\__\__,_|_|  |_|\___|\__,_|___|___/\___|\__✴_|_|\___|_| |_|
          ✴            ✴        |_____|      ✴       ✴               

Search your starred ★ repositories on GitHub from your terminal

npm npm GitHub

You know those repositories you like and star into the abyss? Yes those, this cli tool will help you do a fuzzy search on them. You can search any GitHub user's starred repositories by providing their handle only.

This tool will cache the results locally so that you don't risk abusing the API requests limit.

"Starred Search Demo"

Notice: This project is still in alpha and the API might change without notice. Update only after reviewing the changelog for breaking changes.

Installation

Minimum Requirements

  • 🐧 Linux
  • 🍎 macOS
  • 📦 Node v12.x.x+

Setup

# Install
npm install starred_search -g

# Usage
starred_search --user 'link-' --find 'es6'

I recommend that you create an alias in your shell to avoid repeating the required parameters.

Example alias in fish and bash:

# Create an alias (this is temporary, you might want to make it permanent)
alias stars="starred_search --user 'link-'"

# Then you can use it as:
stars -f 'es6'

Usage

Usage: starred_search [OPTIONS] [ARGS]...

  Search your or any other user's starred repositories on GitHub for a keyword.

Options:
  -h, --help
    Show this message and exit.

  -u, --user <handle>
    Any GitHub handle. Example: link-

  -c, --cache-dir <directory>
    Directory you want to store the cache file in. Example: /tmp/.cache

  -f, --find <keyword>
    The keyword you want to search for. Example: es6

  -o, --org <org name>  (optional)
    GitHub organisation name. Example: GitHub

  -l, --limit <number>
    Limit the search results to the specified number. Default is 10

  -V, --verbose
    Outputs debugging log

  -v, --version
    Outputs release version

  -d, --debug
    Outputs stack trace in case an exception is thrown

Non-verbose output

starred_search --user 'link-' --find 'es6'
[
  {
    "repo_name": "lukehoban/es6features",
    "repo_description": "Overview of ECMAScript 6 features",
    "repo_url": "https://github.com/lukehoban/es6features",
    "repo_stars": 27672
  },
  {
    "repo_name": "google/sa360-flightsfeed",
    "repo_description": "Generate SA360 compatible feeds for airlines on BigQuery  :rocket:",
    "repo_url": "https://github.com/google/sa360-flightsfeed",
    "repo_stars": 8
  },
  {
    "repo_name": "DrkSephy/es6-cheatsheet",
    "repo_description": "ES2015 [ES6] cheatsheet containing tips, tricks, best practices and code snippets",
    "repo_url": "https://github.com/DrkSephy/es6-cheatsheet",
    "repo_stars": 11410
  }
]

Verbose output & override cache directory

starred_search --user 'link-' --cache-dir '/tmp/.cache' --find 'es6' --verbose
🕵    INFO: Searching for "es6" in "link-'s" starred catalogue
⚠️    INFO:: Serving search results from cache
[
  {
    "repo_name": "lukehoban/es6features",
    "repo_description": "Overview of ECMAScript 6 features",
    "repo_url": "https://github.com/lukehoban/es6features",
    "repo_stars": 27672
  },
  {
    "repo_name": "google/sa360-flightsfeed",
    "repo_description": "Generate SA360 compatible feeds for airlines on BigQuery  :rocket:",
    "repo_url": "https://github.com/google/sa360-flightsfeed",
    "repo_stars": 8
  },
  {
    "repo_name": "DrkSephy/es6-cheatsheet",
    "repo_description": "ES2015 [ES6] cheatsheet containing tips, tricks, best practices and code snippets",
    "repo_url": "https://github.com/DrkSephy/es6-cheatsheet",
    "repo_stars": 11410
  }
]

Parsing the output with jq

You can pipe the standard output to be handled by tools like jq for more magic:

# Return the first search result only
starred_search -u 'link-' -f 'es6' | jq '.[0]'
{
  "repo_name": "lukehoban/es6features",
  "repo_description": "Overview of ECMAScript 6 features",
  "repo_url": "https://github.com/lukehoban/es6features",
  "repo_stars": 27672
}
# Return repo_name of every result element
starred_search -u 'link-' -f 'es6' | jq 'map(.repo_name)'
[
  "lukehoban/es6features",
  "google/sa360-flightsfeed",
  "DrkSephy/es6-cheatsheet"
]

Using a personal access token to increase the API rate limit

You can use a personal access token to increase the API rate limit from 60 requests per hour to 5000 requests per hour. Learn more about personal access tokens here.

# Assuming you're using a bash shell
export GITHUB_TOKEN="ghp_1234567890"
starred_search -u 'link-' -f 'es6'
{
  "repo_name": "lukehoban/es6features",
  "repo_description": "Overview of ECMAScript 6 features",
  "repo_url": "https://github.com/lukehoban/es6features",
  "repo_stars": 27672
}

Release History

  • 0.1.12
    • Update packages to resolve security vulnerabilities
  • 0.1.11
    • Fix repo_url value to reference the Repository's GitHub URL
    • Default homepage_url to N.A
  • 0.1.10
  • 0.1.9
    • Replaced the flaky fuzzy search with an enhanced full text search
    • Updated cache invalidation logic to rely on etags
    • Add -d, --debug option
    • Automatic discovery of cache directory based on OS
    • Updates user agent for API requests
  • 0.1.8
    • API BREAKING CHANGES
    • Change alias for --verbose from -v to -V
    • Add -v, --version option
  • 0.1.7
    • Added -h, --help option
    • Added -l, --limit option to limit the search results
  • 0.1.6
    • Added aliases to documentation
  • 0.1.5
    • API BREAKING CHANGES
    • Add verbose flag
    • Fix output to return valid JSON
    • Fix output to return results in an array instead of separated objects
  • 0.1.0 - 0.1.4
    • Basic functionality

starred_search's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar link- avatar raamyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

raamyy

starred_search's Issues

Add parameter for github access token

Unauthenticated requests without github access tokens are rate limited to 60 requests per hour, and the application may send many requests in one run. A parameter should be added to allow users to add their access token to the requests.

-t, --token <github access token> (optional)
  A github access token to be used in sending requests. generate one from here (https://github.com/settings/tokens?type=beta)

# usage example
$ starred_search -u 'link-' -f 'es6' -t github_pat_*****

facing `UnhandledPromiseRejectionWarning: Error: Request failed with status code 403` on making API requests.

λ starred_search --user 'link-' --find 'es6' -d
(node:12837) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403
    at createError (/home/greyhound/.nvm/versions/node/v14.15.0/lib/node_modules/starred_search/bin/starred_search:1212:15)
    at settle (/home/greyhound/.nvm/versions/node/v14.15.0/lib/node_modules/starred_search/bin/starred_search:1471:12)
    at IncomingMessage.handleStreamEnd (/home/greyhound/.nvm/versions/node/v14.15.0/lib/node_modules/starred_search/bin/starred_search:598:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12837) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:12837) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

λ starred_search --version
0.1.10

λ node --version 
v14.15.0

I installed using npm install starred_search -g
The operating system is Ubuntu 20.04 LTS in WSL1.

I'm not a nodejs person, but these warnings/errors are not fetching any results, yields 403. README didn't say anything about adding keys.
Is there anything i'm doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.