gitclone
v2.0.0
Published
Powerful and flexible programmatic interface for the `git clone` command, using [gitclone-defaults][] and [cross-spawn][]
Downloads
42
Readme
gitclone
Powerful and flexible programmatic interface for the
git clone
command, using gitclone-defaults and cross-spawn
Install
Install with npm
$ npm i gitclone --save
Usage
For more use-cases see the tests
const gitclone = require('gitclone')
API
gitclone
Clones github repository, optionally pass destination folder. By defaults uses HTTPS to clone the repository. If you want SSH clone you should pass second, third or fourth argument boolean
true
, or object{ssh: true}
. Pattern can beuser/repo#branch
as first argument. Or first argumentuser
, second argumentrepo
, thirdbranch
, fourthssh
.
Hint: All arguments are super flexible and they are handled
absolutely directly with gitclone-defaults,
so read its API docs.
In addition, you also can pass callback
as last argument, otherwise
it will return Spawn stream.
Params
[callback]
{Function}: optional, if not given, returns a streamreturns
{Stream}: if notcallback
given as last argument - a Spawn stream
Example
const gitclone = require('gitclone')
// clones with SSH
gitclone('node-minibase/minibase', true)
// clone with HTTPS
gitclone('node-minibase/minibase', (err) => {
if (err) return console.error(err)
})
// clone `dev` branch from `verbose/verb` repo
gitclone('verbose/verb#dev', console.log)
// clone `jonschlinkert/nanomatch` with SSH
gitclone('jonchlinkert', 'nanomatch', true)
// clone to different destination folder
gitclone('hybridables/always-done', { dest: 'foobar' })
// clone SSH + dest + branch
gitclone('verbose/verb', { dest: 'verb0.9.0', branch: 'dev', ssh: true })
Related
- always-done: Handle completion and errors with elegance! Support for streams, callbacks, promises, child… more | homepage
- gitclone-defaults: Powerful and flexible signature for
gitclone
- defaults, checks, validating, etc. | homepage - minibase: MiniBase is minimalist approach to Base - @node-base, the awesome framework. Foundation… more | homepage
- try-catch-callback: try/catch block with a callback, used in try-catch-core. Use it when you… more | homepage
- try-catch-core: Low-level package to handle completion and errors of sync or asynchronous functions… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.