Coder Social home page Coder Social logo

cloudxtreme / github-clone-all Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rhysd/github-clone-all

0.0 0.0 0.0 54 KB

Clone (~1000) repos matched to query on GitHub using Search API

License: MIT License

Ruby 1.33% Go 97.30% Shell 1.37%

github-clone-all's Introduction

Clone matching repos on GitHub

GoDoc Badge Mac and Linux Build Status Windows Build Status Coverage Status

$ github-clone-all [flags] {query}

github-clone-all is a small command to clone all repositories matching to given query and language via GitHub Search API. To know the detail of query, please read official document for GitHub Repository Search. The query should be in GitHub search syntax and cannot be empty. It clones many repositories in parallel. Please see -help option to know all flags.

Repository is cloned to 'dest' directory. It is $cwd/repos by default and can be specified with -dest flag. And in order to reduce size of cloned repositories, -extract option is available. -extract only leaves files matching to given regular expression.

Because of restriction of GitHub search API, max number of results is 1000 repositories. And you may need to gain GitHub API token in advance to avoid reaching API rate limit. github-clone-all will refer the token via -token flag or $GITHUB_TOKEN environment variable.

All arguments in {query} are regarded as query. For example, github-clone-all foo bar will search foo bar. But quoting the query is recommended to avoid conflicting with shell special characters as github-clone-all 'foo bar'.

Installation

Use go get or released binaries.

$ go get github.com/rhysd/github-clone-all

Example

$ github-clone-all -extract '(\.vim|vimrc)$' 'language:vim fork:false stars:>1'

Above command will clone first 1000 repositories into 'repos' directory in the current working directory. And it only leaves files whose file name ends with .vim or vimrc. So it collects many Vim script codes from famous repositories on GitHub.

Query condition:

  • language is 'vim'
  • not a fork repo
  • stars of repo is more than 1
$ github-clone-all -count 1 'language:javascript'

Above command will clone the most popular repository of JavaScript on GitHub.

$ github-clone-all -dry 'language:go'

Above command will only list up most popular 1000 repositories of Go instead of cloning them.

How to get GitHub API token

  1. Visit https://github.com/settings/tokens in a browser
  2. Click 'Generate new token'
  3. Add token description
  4. Without checking any checkbox, click 'Generate token'
  5. Generated token is shown at the top of your tokens list

Use github-clone-all programmatically

github-clone-all consists of tiny main.go and ghca package. You can import ghca to utilize functions of the tool.

import "github.com/rhysd/github-clone-all/ghca"

Please read documentation for more detail.

License

MIT license

github-clone-all's People

Contributors

rhysd avatar

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.