Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Commit

Permalink
fix: added back --clone option (#108)
Browse files Browse the repository at this point in the history
* added back --clone option in order to be able to clone repo (for example its private repo) instead of unsuccess downloads

* prettier fix
  • Loading branch information
vadzappa authored and egoist committed Nov 14, 2018
1 parent 4fc26cc commit ac55732
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ cli
type: 'boolean',
alias: 'u'
})
.option('clone', {
desc: 'Clone repository instead of archive download',
type: 'boolean',
alias: 'c'
})
.option('yes', {
desc: 'Use the default options',
alias: 'y'
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SAO {
generator = generator || this.parsedGenerator

if (generator.type === 'repo') {
await ensureRepo(generator, this.opts.update)
await ensureRepo(generator, this.opts.update, this.opts.clone)
} else if (generator.type === 'npm') {
await ensurePackage(generator, this.opts.update)
} else if (generator.type === 'local') {
Expand Down Expand Up @@ -164,15 +164,15 @@ function downloadRepo(repo, target, opts) {
* @param {Object} generator
* @param {boolean=} update
*/
async function ensureRepo(generator, update) {
async function ensureRepo(generator, update, clone) {
if (!update && (await fs.pathExists(generator.path))) {
return
}

// Download repo
spinner.start('Downloading repo')
try {
await downloadRepo(generator.slug, generator.path)
await downloadRepo(generator.slug, generator.path, { clone })
spinner.stop()
logger.success('Downloaded repo')
} catch (err) {
Expand Down

0 comments on commit ac55732

Please sign in to comment.