Skip to content

Commit

Permalink
feat(cli): Add option to disable repo cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
João Neto authored and netoax committed May 28, 2020
1 parent 9cc62a7 commit ac4ce35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ npm install -g @cesarbr/knot-cloud

The development stack must be created using the tool described in the previous section. Firstly, inform which `stack` you want to create: `cloud` or `core` (defaults to `cloud`). Lastly, Choose a `<path>` where the stack should be created (defaults to the current directory) and then run:

> **_NOTE:_** The following command assumes you don't have a workspace with the repositories and clone them. To disable this, run it with the `--no-clone` flag.
```bash
knot-cloud init [stack] [path]
```
Expand Down
26 changes: 19 additions & 7 deletions src/cmds/stack/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ const initStack = (args) => {
fs.unlinkSync(KNOT_ERR_PATH);
}

if (version === 'cloud') {
cloneRepositories(initPath, KNOT_CLOUD_REPOSITORIES);
} else if (version === 'core') {
cloneRepositories(initPath, KNOT_CLOUD_CORE_REPOSITORIES);
} else {
console.log('Invalid cloud version selected. Please type \'cloud\' or \'core\'');
return;
if (args.clone) {
if (version === 'cloud') {
cloneRepositories(initPath, KNOT_CLOUD_REPOSITORIES);
} else if (version === 'core') {
cloneRepositories(initPath, KNOT_CLOUD_CORE_REPOSITORIES);
} else {
console.log('Invalid cloud version selected. Please type \'cloud\' or \'core\'');
return;
}
}

cpDevDir(initPath, version);
Expand All @@ -104,6 +106,16 @@ yargs // eslint-disable-line import/no-extraneous-dependencies
.command({
command: 'init [cloudVersion] [path]',
desc: 'Initialize [cloudVersion] stack at [path]',
builder: (_yargs) => {
_yargs
.options({
clone: {
describe: 'Disable cloning repositories',
default: true,
demandOption: false,
},
});
},
handler: (args) => {
initStack(args);
},
Expand Down

0 comments on commit ac4ce35

Please sign in to comment.